mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-10-01 23:56:18 +00:00
Update share-common.func
This commit is contained in:
@@ -54,7 +54,7 @@ pmx_choose_or_create_group() {
|
||||
gid_min="$(awk '/^\s*GID_MIN\s+[0-9]+/ {print $2}' /etc/login.defs 2>/dev/null | tail -n1)"
|
||||
[[ -z "$gid_min" ]] && gid_min=1000
|
||||
|
||||
choice=$(dialog --title "$(translate "Shared Group")" \
|
||||
choice=$(whiptail --title "$(translate "Shared Group")" \
|
||||
--menu "$(translate "Choose a group policy for this shared directory:")" 18 78 6 \
|
||||
"1" "$(translate "Use default group:") $default_group $(translate "(recommended)")" \
|
||||
"2" "$(translate "Create a new group for isolation")" \
|
||||
@@ -286,7 +286,7 @@ pmx_select_host_mount_point() {
|
||||
select_host_directory() {
|
||||
local method choice result
|
||||
|
||||
method=$(dialog --title "$(translate "Select Host Directory")" --menu "\n$(translate "How do you want to select the HOST folder to mount?")" 15 70 4 \
|
||||
method=$(whiptail --title "$(translate "Select Host Directory")" --menu "$(translate "How do you want to select the HOST folder to mount?")" 15 70 4 \
|
||||
"mnt" "$(translate "Select from /mnt directories")" \
|
||||
"manual" "$(translate "Enter path manually")" 3>&1 1>&2 2>&3) || return 1
|
||||
|
||||
@@ -303,18 +303,15 @@ select_host_directory() {
|
||||
done
|
||||
|
||||
if [[ ${#options[@]} -eq 0 ]]; then
|
||||
show_proxmenux_logo
|
||||
msg_error "$(translate "No directories found in") $base_path"
|
||||
echo -e ""
|
||||
msg_success "$(translate 'Press Enter to continue...')"
|
||||
return 1
|
||||
fi
|
||||
|
||||
result=$(dialog --title "$(translate "Select Host Folder")" \
|
||||
--menu "\n$(translate "Select the folder to mount:")" 20 80 10 "${options[@]}" 3>&1 1>&2 2>&3)
|
||||
result=$(whiptail --title "$(translate "Select Host Folder")" \
|
||||
--menu "$(translate "Select the folder to mount:")" 20 80 10 "${options[@]}" 3>&1 1>&2 2>&3)
|
||||
;;
|
||||
manual)
|
||||
result=$(dialog --title "$(translate "Enter Path")" \
|
||||
result=$(whiptail --title "$(translate "Enter Path")" \
|
||||
--inputbox "$(translate "Enter the full path to the host folder:")" 10 70 "/mnt/" 3>&1 1>&2 2>&3)
|
||||
;;
|
||||
esac
|
||||
@@ -324,10 +321,7 @@ select_host_directory() {
|
||||
fi
|
||||
|
||||
if [[ ! -d "$result" ]]; then
|
||||
show_proxmenux_logo
|
||||
msg_error "$(translate "The selected path is not a valid directory:") $result"
|
||||
echo -e ""
|
||||
msg_success "$(translate 'Press Enter to continue...')"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -379,7 +373,7 @@ select_container_mount_point() {
|
||||
|
||||
while true; do
|
||||
choice=$(whiptail --title "$(translate "Configure Mount Point inside LXC")" \
|
||||
--menu "\n$(translate "Where to mount inside container?")" 18 70 5 \
|
||||
--menu "$(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")" \
|
||||
@@ -392,25 +386,27 @@ 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 "${options[@]}" 3>&1 1>&2 2>&3) || continue
|
||||
--menu "$(translate "Choose a folder from /mnt:")" 20 70 10 \
|
||||
$existing_dirs 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
|
||||
;;
|
||||
@@ -428,7 +424,6 @@ select_container_mount_point() {
|
||||
|
||||
|
||||
|
||||
|
||||
# ==========================================================
|
||||
# CLIENT MOUNT FUNCTIONS (NFS/SAMBA COMMON)
|
||||
# ==========================================================
|
||||
|
Reference in New Issue
Block a user