Skip to content

Commit

Permalink
nc-automount fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jun 28, 2017
1 parent bb61bb7 commit c94bc52
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
16 changes: 5 additions & 11 deletions etc/nextcloudpi-config.d/nc-automount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion etc/nextcloudpi-config.d/nc-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# Usage:
#
# ./installer.sh nc-backup <IP> (<img>)
# ./installer.sh nc-backup.sh <IP> (<img>)
#
# See installer.sh instructions for details
#
Expand Down
2 changes: 1 addition & 1 deletion etc/nextcloudpi-config.d/nc-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# Usage:
#
# ./installer.sh nc-restore <IP> (<img>)
# ./installer.sh nc-restore.sh <IP> (<img>)
#
# See installer.sh instructions for details
#
Expand Down

0 comments on commit c94bc52

Please sign in to comment.