From da4f8a3a192dd95929040dc9c11db2eb62082b21 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Sat, 6 Sep 2025 11:11:19 +0200 Subject: [PATCH] Update share-common.func --- scripts/global/share-common.func | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/scripts/global/share-common.func b/scripts/global/share-common.func index 8cd4a03..df7121e 100644 --- a/scripts/global/share-common.func +++ b/scripts/global/share-common.func @@ -373,7 +373,7 @@ select_container_mount_point() { while true; do choice=$(whiptail --title "$(translate "Configure Mount Point inside LXC")" \ - --menu "$(translate "Where to mount inside container?")" 18 70 5 \ + --menu "\n$(translate "Where to mount inside container?")" 18 70 5 \ "1" "$(translate "Create new directory in /mnt")" \ "2" "$(translate "Use existing directory in /mnt")" \ "3" "$(translate "Enter path manually")" \ @@ -386,27 +386,25 @@ select_container_mount_point() { mount_point="/mnt/$mount_point" pct exec "$ctid" -- mkdir -p "$mount_point" 2>/dev/null ;; - 2) - #existing_dirs=$(pct exec "$ctid" -- ls -1 /mnt 2>/dev/null | awk '{print "/mnt/"$1" "$1}') existing_dirs=$(pct exec "$ctid" -- find /mnt -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sort) - if [[ -z "$existing_dirs" ]]; then whiptail --msgbox "$(translate "No existing directories found in /mnt")" 8 60 continue fi + options=() + while IFS= read -r dir; do + name=$(basename "$dir") + options+=("$dir" "$name") + done <<< "$existing_dirs" mount_point=$(whiptail --title "$(translate "Select Existing Folder")" \ - --menu "$(translate "Choose a folder from /mnt:")" 20 70 10 \ - $existing_dirs 3>&1 1>&2 2>&3) || continue + --menu "$(translate "Choose a folder from /mnt:")" 20 70 10 "${options[@]}" 3>&1 1>&2 2>&3) || continue ;; - 3) mount_point=$(whiptail --inputbox "$(translate "Enter full path:")" 10 70 "/mnt/shared" 3>&1 1>&2 2>&3) || continue [[ -z "$mount_point" ]] && continue - mount_point="/mnt/$mount_point" pct exec "$ctid" -- mkdir -p "$mount_point" 2>/dev/null ;; - 4) return 1 ;; @@ -424,6 +422,7 @@ select_container_mount_point() { + # ========================================================== # CLIENT MOUNT FUNCTIONS (NFS/SAMBA COMMON) # ==========================================================