mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-10-02 16:16:19 +00:00
Update share-common.func
This commit is contained in:
@@ -232,13 +232,14 @@ pmx_select_host_mount_point() {
|
||||
local choice folder_name result existing_dirs mount_point
|
||||
|
||||
while true; do
|
||||
choice=$(whiptail --title "$title" --menu "$(translate "Where do you want the host folder?")" 16 76 3 \
|
||||
choice=$(dialog --backtitle "ProxMenux" --title "$title" --menu "$(translate "Where do you want the host folder?")" 16 76 3 \
|
||||
"1" "$(translate "Create new folder in /mnt")" \
|
||||
"2" "$(translate "Use existing folder")" \
|
||||
"3" "$(translate "Enter custom path")" 3>&1 1>&2 2>&3) || { echo ""; return 1; }
|
||||
|
||||
case "$choice" in
|
||||
1)
|
||||
clear
|
||||
folder_name=$(whiptail --inputbox "$(translate "Enter folder name for /mnt:")" 10 70 "$(basename "$default_path")" --title "$(translate "Folder Name")" 3>&1 1>&2 2>&3) || { echo ""; return 1; }
|
||||
[[ -z "$folder_name" ]] && continue
|
||||
mount_point="/mnt/$folder_name"
|
||||
@@ -248,21 +249,22 @@ pmx_select_host_mount_point() {
|
||||
2)
|
||||
existing_dirs=($(ls -1d /mnt/*/ 2>/dev/null | sed 's:/$::'))
|
||||
if [[ ${#existing_dirs[@]} -eq 0 ]]; then
|
||||
whiptail --msgbox "$(translate "No existing folders found in /mnt")" 8 60
|
||||
dialog --msgbox "$(translate "No existing folders found in /mnt")" 8 60
|
||||
continue
|
||||
fi
|
||||
mount_point=$(whiptail --title "$(translate "Select Existing Folder")" \
|
||||
mount_point=$(dialog --backtitle "ProxMenux" --title "$(translate "Select Existing Folder")" \
|
||||
--menu "$(translate "Choose a folder in /mnt:")" 20 70 10 \
|
||||
$(for d in "${existing_dirs[@]}"; do echo "$d" "$(basename "$d")"; done) \
|
||||
3>&1 1>&2 2>&3) || continue
|
||||
|
||||
if [[ "$context" =~ ^(nfs|samba)$ ]] && [[ -n "$(ls -A "$mount_point" 2>/dev/null)" ]]; then
|
||||
whiptail --yesno "$(translate "Warning: The selected folder is not empty. Files may not be accessible once the network share is mounted. Proceed anyway?")" 12 70 || continue
|
||||
dialog --backtitle "ProxMenux" --yesno "$(translate "Warning: The selected folder is not empty. Files may not be accessible once the network share is mounted. Proceed anyway?")" 12 70 || continue
|
||||
fi
|
||||
echo "$mount_point"; return 0
|
||||
;;
|
||||
|
||||
3)
|
||||
clear
|
||||
result=$(whiptail --inputbox "$(translate "Enter full path:")" 10 80 "$default_path" --title "$(translate "Custom Path")" 3>&1 1>&2 2>&3) || { echo ""; return 1; }
|
||||
[[ -z "$result" ]] && continue
|
||||
echo "$result"; return 0
|
||||
|
Reference in New Issue
Block a user