allows a device in any slot to work

This commit is contained in:
Dave
2018-10-06 21:26:10 +01:00
parent 7a2842ae7d
commit a90ff2c1f8
2 changed files with 8 additions and 7 deletions

View File

@@ -26,7 +26,7 @@ sudo chmod -R 775 /media/storage
sudo setfacl -Rdm g:pi:rw /media/storage sudo setfacl -Rdm g:pi:rw /media/storage
cd cd
git clone https://github.com/dmpop/little-backup-box.git git clone https://github.com/skidave/little-backup-box.git
cd little-backup-box/fonts cd little-backup-box/fonts
sudo cp -R . /home/pi/.fonts sudo cp -R . /home/pi/.fonts
cd cd

View File

@@ -21,7 +21,7 @@
# and other settings # and other settings
STORAGE_DEV="sda1" # Name of the storage device STORAGE_DEV="sda1" # Name of the storage device
STORAGE_MOUNT_POINT="/media/storage" # Mount point of the storage device STORAGE_MOUNT_POINT="/media/storage" # Mount point of the storage device
CARD_DEV="sdb1" # Name of the storage card CARD_DEV="sd[b-z]1" # Name of the storage card
CARD_MOUNT_POINT="/media/card" # Mount point of the storage card CARD_MOUNT_POINT="/media/card" # Mount point of the storage card
SHUTD="5" # Minutes to wait before shutdown due to inactivity SHUTD="5" # Minutes to wait before shutdown due to inactivity
@@ -50,16 +50,17 @@ sudo sh -c "echo timer > /sys/class/leds/led0/trigger"
sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on" sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on"
# Wait for a card reader or a camera # Wait for a card reader or a camera
CARD_READER=$(ls /dev/* | grep "$CARD_DEV" | cut -d"/" -f3) # takes first device found
until [ ! -z "$CARD_READER" ] CARD_READER=($(ls /dev/* | grep "$CARD_DEV" | cut -d"/" -f3))
until [ ! -z "${CARD_READER[0]}" ]
do do
sleep 1 sleep 1
CARD_READER=$(ls /dev/sd* | grep "$CARD_DEV" | cut -d"/" -f3) CARD_READER=$(ls /dev/sd* | grep "$CARD_DEV" | cut -d"/" -f3)
done done
# If the card reader is detected, mount it and obtain its UUID # If the card reader is detected, mount it and obtain its UUID
if [ ! -z "$CARD_READER" ]; then if [ ! -z "${CARD_READER[0]}" ]; then
mount /dev"/$CARD_DEV" "$CARD_MOUNT_POINT" mount /dev"/${CARD_READER[0]}" "$CARD_MOUNT_POINT"
# # Set the ACT LED to blink at 500ms to indicate that the card has been mounted # # Set the ACT LED to blink at 500ms to indicate that the card has been mounted
sudo sh -c "echo 500 > /sys/class/leds/led0/delay_on" sudo sh -c "echo 500 > /sys/class/leds/led0/delay_on"