From f3c73ba79bd152c414b786232ea90f0f980e35bb Mon Sep 17 00:00:00 2001 From: link Date: Fri, 18 Feb 2022 19:14:11 +0800 Subject: [PATCH] Update usb-mount.sh --- shell/usb-mount.sh | 48 +++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/shell/usb-mount.sh b/shell/usb-mount.sh index d09a02b..0376bb9 100644 --- a/shell/usb-mount.sh +++ b/shell/usb-mount.sh @@ -30,31 +30,39 @@ do_mount() { # Figure out a mount point to use # LABEL=${ID_FS_LABEL} - # LABEL=${DEVBASE} - # if grep -q " /DATA/USB_${LABEL} " /etc/mtab; then - # # Already in use, make a unique one - # LABEL+="-${DEVBASE}" - # fi - # DEV_LABEL="${LABEL}" + LABEL=${DEVBASE} + if grep -q " /DATA/USB_Storage_${LABEL} " /etc/mtab; then + # Already in use, make a unique one + LABEL+="_${DEVBASE}" + fi + DEV_LABEL="${LABEL}" - # # Use the device name in case the drive doesn't have label - # if [ -z ${DEV_LABEL} ]; then - # DEV_LABEL="${DEVBASE}" - # fi + # Use the device name in case the drive doesn't have label + if [ -z ${DEV_LABEL} ]; then + DEV_LABEL="${DEVBASE}" + fi - MOUNT_POINT="/DATA/USB_Storage1" - arr=("/DATA/USB_Storage1" "/DATA/USB_Storage2" "/DATA/USB_Storage3" "/DATA/USB_Storage4" "/DATA/USB_Storage5" "/DATA/USB_Storage6" "/DATA/USB_Storage7" "/DATA/USB_Storage8" "/DATA/USB_Storage9" "/DATA/USB_Storage10" "/DATA/USB_Storage11" "/DATA/USB_Storage12") - for folder in ${arr[@]}; do - #如果文件夹不存在,创建文件夹 - if [ ! -d "$folder" ]; then - mkdir -p ${folder} - MOUNT_POINT=$folder - break - fi - done + + MOUNT_POINT="/DATA/USB_Storage_${DEV_LABEL}" ${log} "Mount point: ${MOUNT_POINT}" + mkdir -p ${MOUNT_POINT} + + + # MOUNT_POINT="/DATA/USB_Storage1" + # arr=("/DATA/USB_Storage1" "/DATA/USB_Storage2" "/DATA/USB_Storage3" "/DATA/USB_Storage4" "/DATA/USB_Storage5" "/DATA/USB_Storage6" "/DATA/USB_Storage7" "/DATA/USB_Storage8" "/DATA/USB_Storage9" "/DATA/USB_Storage10" "/DATA/USB_Storage11" "/DATA/USB_Storage12") + # for folder in ${arr[@]}; do + # #如果文件夹不存在,创建文件夹 + # if [ ! -d "$folder" ]; then + # mkdir -p ${folder} + # MOUNT_POINT=$folder + # break + # fi + # done + + # ${log} "Mount point: ${MOUNT_POINT}" + # # Global mount options