From 2ff8c373b1136a1595699aeca2a906d9c4d170d1 Mon Sep 17 00:00:00 2001 From: pvincent Date: Thu, 23 Oct 2025 01:39:18 +0400 Subject: [PATCH] fix install.sh no configuration file --- install.sh | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/install.sh b/install.sh index 6e2adc5..846d7e4 100755 --- a/install.sh +++ b/install.sh @@ -57,31 +57,35 @@ function compute_cpu_cores { } function choose_default { + echo 'initializing default values...' storage_size='20G' memory='2G' swap='2G' cpu=$(compute_cpu_cores) mapfile -t storages <<< $(pvesm status | grep zfspool | cut -d' ' -f1) - PS3="Choose default storage number: " - echo "TYPE=ZFSPOOL STORAGE LIST:" - echo "--------------------------" - - echo "$-" if [[ ! "$-" =~ i ]]; then - echo non interactive # non-interactive, default to first item + interactive=false storage_disk="${storages[0]}" + echo "----------------------------------------------------" + echo "first TYPE=ZFSPOOL found: $storage_disk" + echo "to change, please launch one more time: `install.sh`" + echo "----------------------------------------------------" else - echo interactive # interactive, ask for default + interactive=true + PS3="Choose default storage number: " + echo "TYPE=ZFSPOOL STORAGE LIST:" + echo "--------------------------" select storage_disk in "${storages[@]}"; do [[ -n $storage_disk ]] && break done fi - cat > $CONFIG_FILE < $CONFIG_FILE <