From aed0aab9e48b0df8bedfab982d74562da6ff2a97 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Sun, 24 Aug 2025 16:47:23 +0000 Subject: [PATCH] improve: always prompt for network and storage in quick mode addresses #352 quick mode now: - shows available network bridges and prompts for selection - shows available storage pools with usage info and prompts for selection - properly handles cases where defaults (vmbr0, local-lvm) don't exist - gives clear error messages when no bridges or storage pools are found this ensures users always see what's available and can make informed choices even in quick mode, preventing installation failures due to missing defaults --- install.sh | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/install.sh b/install.sh index 2d1a720d2..afd14732f 100755 --- a/install.sh +++ b/install.sh @@ -346,21 +346,51 @@ create_lxc_container() { safe_read "Startup order [99]: " startup startup=${startup:-99} else - # Quick mode - use defaults - # But if no valid bridge exists, we must ask the user + # Quick mode - but still need to verify critical settings + + # Network bridge selection + echo + if [[ -n "$BRIDGES" ]]; then + echo "Available network bridges: $BRIDGES" + else + echo "No network bridges detected" + fi + + # Always ask if default doesn't exist or no bridges found if [[ "$DEFAULT_BRIDGE" == "vmbr0" && -n "$BRIDGES" && ! "$BRIDGES" =~ vmbr0 ]]; then - echo - print_info "No default bridge found. Available bridges: $BRIDGES" - safe_read "Please select a network bridge: " bridge - elif [[ "$DEFAULT_BRIDGE" == "vmbr0" && -z "$BRIDGES" ]]; then - echo + print_info "Default bridge vmbr0 not found" + safe_read "Select network bridge: " bridge + elif [[ -z "$BRIDGES" ]]; then print_error "No network bridges detected on this system" print_info "You may need to create a bridge first (e.g., vmbr0)" safe_read "Enter network bridge name to use: " bridge else - bridge=$DEFAULT_BRIDGE + safe_read "Network bridge [$DEFAULT_BRIDGE]: " bridge + bridge=${bridge:-$DEFAULT_BRIDGE} fi - storage=$DEFAULT_STORAGE + + # Storage selection + echo + if [[ -n "$STORAGE_INFO" ]]; then + echo "Available storage pools:" + echo "$STORAGE_INFO" | awk '{printf " %-15s %-8s %5s used\n", $1, $2, $6}' + else + echo "No storage pools detected" + fi + + # Always ask if default doesn't exist + local STORAGE_LIST=$(echo "$STORAGE_INFO" | awk '{print $1}' | paste -sd',' -) + if [[ "$DEFAULT_STORAGE" == "local-lvm" && -n "$STORAGE_LIST" && ! "$STORAGE_LIST" =~ local-lvm ]]; then + print_info "Default storage local-lvm not found" + safe_read "Select storage pool: " storage + elif [[ -z "$STORAGE_INFO" ]]; then + print_error "No storage pools detected" + safe_read "Enter storage pool name to use: " storage + else + safe_read "Storage [$DEFAULT_STORAGE]: " storage + storage=${storage:-$DEFAULT_STORAGE} + fi + static_ip="" nameserver="" startup=99