I was thinking through ways to set up the Pi's network when using it headless after changing the SD card's image. I can get access to a Linux box, where I can mount the SD card and adjust the interfaces and wpa_supplicant.conf files to preconfigure it, but have often flashed a card from Windows and then needed to 'improvise' to get access and configure the system (particularly when configuring WiFi on a Model A.)
I cobbled together the following script from some example code, which I think would offer a reasonable solution to the problem:
Code: Select all
#!/bin/bash
if ls /boot/interfaces > /dev/null 2>&1
then
mv /boot/interfaces /etc/network/interfaces
fi
if ls /boot/wpa_supplicant.conf > /dev/null 2>&1
then
mv /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
fiBeing a relatively new Linux user, there may be a permission problems with this, and it's probable that a restart will also be necessary, but given the readily available information on setting up these two files both on this forum and on the internet in general, this could be a useful technique to integrate into the Raspbian boot sequence to make setup easier for the headless users.