diff --git a/backup.sh b/backup.sh index dd0ea96..637d422 100755 --- a/backup.sh +++ b/backup.sh @@ -36,6 +36,17 @@ until [ ! -z $CARD_READER ] CARD_READER=$(ls /dev/sd* | grep $CARD_DEV | cut -d"/" -f3) done +# If there is a wpa_supplicant.conf file in the root of the storage device +# Rename the original config file, +# move wpa_supplicant.conf from the card to /etc/wpa_supplicant/ +# Reboot to enable networking +if [ -f "$STORAGE_MOUNT_POINT/wpa_supplicant.conf" ]; then + sudo sh -c "echo 100 > /sys/class/leds/led0/delay_on" + mv /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.bak + mv "$STORAGE_MOUNT_POINT/wpa_supplicant.conf" /etc/wpa_supplicant/wpa_supplicant.conf + reboot +fi + # If the card reader is detected, mount it and obtain its UUID if [ ! -z $CARD_READER ]; then mount /dev/$CARD_DEV $CARD_MOUNT_POINT @@ -45,18 +56,6 @@ if [ ! -z $CARD_READER ]; then if [ ! -f $CARD_MOUNT_POINT/CARD_ID ]; then < /dev/urandom tr -cd 0-9 | head -c 8 > $CARD_MOUNT_POINT/CARD_ID fi - - # If there is a wpa_supplicant.conf file in the root of the storage device - # Rename the original config file, - # move wpa_supplicant.conf from the card to /etc/wpa_supplicant/ - # Reboot to enable networking - - if [ -f "$STORAGE_MOUNT_POINT/wpa_supplicant.conf" ]; then - sudo sh -c "echo 100 > /sys/class/leds/led0/delay_on" - mv /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.bak - mv "$STORAGE_MOUNT_POINT/wpa_supplicant.conf" /etc/wpa_supplicant/wpa_supplicant.conf - reboot - fi # Read the 8-digit identifier number from the CARD_ID file on the card # and use it as a directory name in the backup path