From d8947336f3358bd8849af98fbcc4aa71c9f0b82c Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Fri, 16 May 2025 10:38:36 +0200 Subject: [PATCH] Refactor config_file function to improve handling of empty Container Type and enhance user interaction with whiptail for type selection --- misc/build.func | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/misc/build.func b/misc/build.func index 5aebb07..3d59382 100644 --- a/misc/build.func +++ b/misc/build.func @@ -831,7 +831,7 @@ config_file() { fi fi - if [[ -n "$CT_TYPE" ]]; then + if [[ -n "${CT_TYPE-}" ]]; then if [[ "$CT_TYPE" -eq 0 ]]; then CT_TYPE_DESC="Privileged" elif [[ "$CT_TYPE" -eq 1 ]]; then @@ -842,8 +842,20 @@ config_file() { fi echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}" else - msg_error "Container Type cannot be empty" - exit + if CT_TYPE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \ + "1" "Unprivileged" ON \ + "0" "Privileged" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$CT_TYPE" ]; then + CT_TYPE_DESC="Unprivileged" + if [ "$CT_TYPE" -eq 0 ]; then + CT_TYPE_DESC="Privileged" + fi + echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}" + fi + else + exit_script + fi fi if [[ -n "${PW-}" ]]; then