Update build.func
This commit is contained in:
parent
d3eecd770a
commit
47d3048115
@ -1626,13 +1626,12 @@ install_script() {
|
|||||||
# - Updates vars file accordingly
|
# - Updates vars file accordingly
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
check_storage_or_prompt() {
|
check_storage_or_prompt() {
|
||||||
set +u
|
|
||||||
local vars_file="$1"
|
local vars_file="$1"
|
||||||
local changed=0
|
local changed=0
|
||||||
|
|
||||||
if [ ! -f "$vars_file" ]; then
|
if [ ! -f "$vars_file" ]; then
|
||||||
msg_warn "No vars file found at $vars_file"
|
msg_warn "No vars file found at $vars_file"
|
||||||
return 1
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Helper: validate storage ID
|
# Helper: validate storage ID
|
||||||
@ -1642,7 +1641,7 @@ check_storage_or_prompt() {
|
|||||||
pvesm status -content images | awk 'NR>1 {print $1}' | grep -qx "$s"
|
pvesm status -content images | awk 'NR>1 {print $1}' | grep -qx "$s"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load current values (safe with grep/cut, no BRG/HN etc.)
|
# Load current values (empty if not set)
|
||||||
local ct_store tpl_store
|
local ct_store tpl_store
|
||||||
ct_store=$(awk -F= '/^var_container_storage=/ {print $2; exit}' "$vars_file")
|
ct_store=$(awk -F= '/^var_container_storage=/ {print $2; exit}' "$vars_file")
|
||||||
tpl_store=$(awk -F= '/^var_template_storage=/ {print $2; exit}' "$vars_file")
|
tpl_store=$(awk -F= '/^var_template_storage=/ {print $2; exit}' "$vars_file")
|
||||||
@ -1653,7 +1652,7 @@ check_storage_or_prompt() {
|
|||||||
new_ct=$(pvesm status -content images | awk 'NR>1 {print $1" "$2" "$6}')
|
new_ct=$(pvesm status -content images | awk 'NR>1 {print $1" "$2" "$6}')
|
||||||
new_ct=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
|
new_ct=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
|
||||||
--title "Select Container Storage" \
|
--title "Select Container Storage" \
|
||||||
--menu "Choose container storage:" 20 60 10 $new_ct 3>&1 1>&2 2>&3) || return 1
|
--menu "Choose container storage:" 20 60 10 $new_ct 3>&1 1>&2 2>&3) || return 0
|
||||||
if [ -n "$new_ct" ]; then
|
if [ -n "$new_ct" ]; then
|
||||||
sed -i "/^var_container_storage=/d" "$vars_file"
|
sed -i "/^var_container_storage=/d" "$vars_file"
|
||||||
echo "var_container_storage=$new_ct" >>"$vars_file"
|
echo "var_container_storage=$new_ct" >>"$vars_file"
|
||||||
@ -1668,7 +1667,7 @@ check_storage_or_prompt() {
|
|||||||
new_tpl=$(pvesm status -content vztmpl | awk 'NR>1 {print $1" "$2" "$6}')
|
new_tpl=$(pvesm status -content vztmpl | awk 'NR>1 {print $1" "$2" "$6}')
|
||||||
new_tpl=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
|
new_tpl=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
|
||||||
--title "Select Template Storage" \
|
--title "Select Template Storage" \
|
||||||
--menu "Choose template storage:" 20 60 10 $new_tpl 3>&1 1>&2 2>&3) || return 1
|
--menu "Choose template storage:" 20 60 10 $new_tpl 3>&1 1>&2 2>&3) || return 0
|
||||||
if [ -n "$new_tpl" ]; then
|
if [ -n "$new_tpl" ]; then
|
||||||
sed -i "/^var_template_storage=/d" "$vars_file"
|
sed -i "/^var_template_storage=/d" "$vars_file"
|
||||||
echo "var_template_storage=$new_tpl" >>"$vars_file"
|
echo "var_template_storage=$new_tpl" >>"$vars_file"
|
||||||
@ -1677,8 +1676,8 @@ check_storage_or_prompt() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $changed
|
# Always succeed (no aborts from here)
|
||||||
set -u
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user