Update lxc-mount-manager.sh

This commit is contained in:
MacRimi
2025-09-06 11:55:23 +02:00
parent a5560a3123
commit 1c2f67d43d

View File

@@ -303,8 +303,6 @@ add_bind_mount() {
mount_host_directory_to_lxc() { mount_host_directory_to_lxc() {
# Step 1: Select container # Step 1: Select container
@@ -314,22 +312,25 @@ mount_host_directory_to_lxc() {
return 1 return 1
fi fi
show_proxmenux_logo
msg_title "$(translate 'Mount Host Directory to LXC Container')"
# Step 1.1: Ensure running # Step 1.1: Ensure running
ct_status=$(pct status "$container_id" | awk '{print $2}') ct_status=$(pct status "$container_id" | awk '{print $2}')
if [[ "$ct_status" != "running" ]]; then if [[ "$ct_status" != "running" ]]; then
show_proxmenux_logo
msg_title "$(translate 'Mount Host Directory to LXC Container')"
msg_info "$(translate "Starting container") $container_id..." msg_info "$(translate "Starting container") $container_id..."
if pct start "$container_id"; then if pct start "$container_id"; then
sleep 3 sleep 3
msg_ok "$(translate "Container started")" msg_ok "$(translate "Container started")"
else else
msg_error "$(translate "Failed to start container")" msg_error "$(translate "Failed to start container")"
echo -e ""
msg_success "$(translate 'Press Enter to continue...')"
read -r
return 1 return 1
fi fi
fi fi
msg_ok "$(translate 'Container selected and running')"
# Step 2: Select host directory # Step 2: Select host directory
local host_dir local host_dir
@@ -337,7 +338,7 @@ mount_host_directory_to_lxc() {
if [[ -z "$host_dir" ]]; then if [[ -z "$host_dir" ]]; then
return 1 return 1
fi fi
msg_ok "$(translate 'Host directory selected')"
# Step 3: Setup group # Step 3: Setup group
local group_name="sharedfiles" local group_name="sharedfiles"
@@ -360,6 +361,8 @@ mount_host_directory_to_lxc() {
return 1 return 1
fi fi
# Step 5: Confirmation # Step 5: Confirmation
local uid_shift container_type local uid_shift container_type
uid_shift=$(get_container_uid_shift "$container_id") uid_shift=$(get_container_uid_shift "$container_id")
@@ -378,10 +381,17 @@ $(translate "Shared Group:"): $group_name (GID: $group_gid)
$(translate "Proceed?")" $(translate "Proceed?")"
if ! whiptail --title "$(translate "Confirm Mount")" --yesno "$confirm_msg" 16 70; then if ! dialog --title "$(translate "Confirm Mount")" --yesno "$confirm_msg" 16 70; then
return 1 return 1
fi fi
show_proxmenux_logo
msg_title "\n$(translate 'Mount Host Directory to LXC Container')"
msg_ok "$(translate 'Container selected and running')"
msg_ok "$(translate 'Host directory selected')"
msg_ok "$(translate 'Host group configured')"
# Step 6: Add mount # Step 6: Add mount
if ! add_bind_mount "$container_id" "$host_dir" "$ct_mount_point"; then if ! add_bind_mount "$container_id" "$host_dir" "$ct_mount_point"; then
return 1 return 1