From 7914fb6bb9f34042d58d656b714feae7495c87e4 Mon Sep 17 00:00:00 2001 From: Dmitri Popov Date: Mon, 14 Aug 2017 11:30:52 +0200 Subject: [PATCH] Fix order :monkey: --- backup.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/backup.sh b/backup.sh index 637d422..ee98f99 100755 --- a/backup.sh +++ b/backup.sh @@ -28,14 +28,6 @@ mount /dev/$STORAGE_DEV $STORAGE_MOUNT_POINT sudo sh -c "echo timer > /sys/class/leds/led0/trigger" sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on" -# Wait for a card reader or a camera -CARD_READER=$(ls /dev/* | grep $CARD_DEV | cut -d"/" -f3) -until [ ! -z $CARD_READER ] - do - sleep 1 - 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/ @@ -47,6 +39,14 @@ if [ -f "$STORAGE_MOUNT_POINT/wpa_supplicant.conf" ]; then reboot fi +# Wait for a card reader or a camera +CARD_READER=$(ls /dev/* | grep $CARD_DEV | cut -d"/" -f3) +until [ ! -z $CARD_READER ] + do + sleep 1 + CARD_READER=$(ls /dev/sd* | grep $CARD_DEV | cut -d"/" -f3) +done + # If the card reader is detected, mount it and obtain its UUID if [ ! -z $CARD_READER ]; then mount /dev/$CARD_DEV $CARD_MOUNT_POINT