Skip to content

CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.

Update usb-mount.sh

linkf3c73ba79bd1
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}"
-
- # # 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
+ 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
+
+
+ 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