diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-06-29 19:48:34 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-06-30 13:28:12 +0300 |
commit | 0e5d8ac05812aa0c175f6d17c2bca0d5857fe994 (patch) | |
tree | 5e654cf06b93dc2815ccec57698186fd16f9c135 /etc/nextcloudpi-config.d/nc-automount.sh | |
parent | dbbdfea70f1388a08b5749f91fc537b5d49c1eb8 (diff) |
nc-automount improvementsv0.15.1
Diffstat (limited to 'etc/nextcloudpi-config.d/nc-automount.sh')
-rw-r--r-- | etc/nextcloudpi-config.d/nc-automount.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/etc/nextcloudpi-config.d/nc-automount.sh b/etc/nextcloudpi-config.d/nc-automount.sh index 59c595a1..7659ac64 100644 --- a/etc/nextcloudpi-config.d/nc-automount.sh +++ b/etc/nextcloudpi-config.d/nc-automount.sh @@ -52,11 +52,15 @@ EOF cat > /usr/local/etc/blknum <<'EOF' #!/bin/bash -# 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 )) +test -e /dev/USBdrive || exit 0 -# first drive will be USBdrive, second USBdrive1 ... -[[ $NUM > 0 ]] && echo $NUM || exit 0 +for i in `seq 1 1 8`; do + test -e /dev/USBdrive$i && continue + echo $i + exit 0 +done + +exit 1 EOF chmod +x /usr/local/etc/blknum @@ -76,7 +80,7 @@ KERNEL!="sd[a-z]*", GOTO="exit" IMPORT{program}="/sbin/blkid -o udev -p %N" # Need to be a filesystem -ENV{ID_FS_TYPE}!="vfat|ntfs|ext4", GOTO="exit" +ENV{ID_FS_TYPE}!="vfat|ntfs|ext4|iso9660", GOTO="exit" # Create symlink that will be understood by fstab, and a directory in /media ACTION!="remove", PROGRAM="/usr/local/etc/blknum", RUN+="/bin/mkdir -p /media/USBdrive%c", SYMLINK+="USBdrive%c" |