diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-06-27 21:03:59 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-06-28 18:44:00 +0300 |
commit | c94bc52dc2779f4c9ecbd961b0c9805b5011de62 (patch) | |
tree | e15122cf4cc29ca796c7a9cd51110e08758aeb69 | |
parent | bb61bb7c0e0f33b96c699dccf35b6b6e52e2ac31 (diff) |
nc-automount fixesv0.14.4
-rw-r--r-- | etc/nextcloudpi-config.d/nc-automount.sh | 16 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-backup.sh | 2 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-restore.sh | 2 |
3 files changed, 7 insertions, 13 deletions
diff --git a/etc/nextcloudpi-config.d/nc-automount.sh b/etc/nextcloudpi-config.d/nc-automount.sh index 3e95db67..59c595a1 100644 --- a/etc/nextcloudpi-config.d/nc-automount.sh +++ b/etc/nextcloudpi-config.d/nc-automount.sh @@ -52,18 +52,11 @@ EOF cat > /usr/local/etc/blknum <<'EOF' #!/bin/bash -OUT=$( lsblk -l ) +# count all block devices with a file system, except /boot and /root. Start in 0 +NUM=$(( $( lsblk -l -n -o NAME,FSTYPE | grep -v mmcblk | awk '{ print $2 }' | sed '/^$/d' | wc -l ) - 1 )) -# partitions, from USB hard drives -PARTS=$( grep part <<< "$OUT" | wc -l ) - -# removable flash sticks -RM=$( awk '{ print $3 }' <<< "$OUT" | grep -c 1 ) - -# discount /boot and /root, start at 0 -RES=$(( RM + PARTS - 3 )) - -[[ $RES > 0 ]] && echo $RES || exit 0 +# first drive will be USBdrive, second USBdrive1 ... +[[ $NUM > 0 ]] && echo $NUM || exit 0 EOF chmod +x /usr/local/etc/blknum @@ -103,6 +96,7 @@ EOF [[ "$ACTIVE_" != "yes" ]] && rm -f /etc/udev/rules.d/50-automount.rules + # mount whatever is currently plugged in udevadm control --reload-rules && udevadm trigger } diff --git a/etc/nextcloudpi-config.d/nc-backup.sh b/etc/nextcloudpi-config.d/nc-backup.sh index b097c9c9..185b85c1 100644 --- a/etc/nextcloudpi-config.d/nc-backup.sh +++ b/etc/nextcloudpi-config.d/nc-backup.sh @@ -7,7 +7,7 @@ # # Usage: # -# ./installer.sh nc-backup <IP> (<img>) +# ./installer.sh nc-backup.sh <IP> (<img>) # # See installer.sh instructions for details # diff --git a/etc/nextcloudpi-config.d/nc-restore.sh b/etc/nextcloudpi-config.d/nc-restore.sh index 1d3d1b1b..8adea371 100644 --- a/etc/nextcloudpi-config.d/nc-restore.sh +++ b/etc/nextcloudpi-config.d/nc-restore.sh @@ -9,7 +9,7 @@ # # Usage: # -# ./installer.sh nc-restore <IP> (<img>) +# ./installer.sh nc-restore.sh <IP> (<img>) # # See installer.sh instructions for details # |