Update build.func

This commit is contained in:
CanbiZ 2025-09-16 14:10:44 +02:00
parent 6eb408569e
commit df2e4e6030

View File

@ -792,7 +792,7 @@ advanced_settings() {
case "$SSH_KEY_MODE" in case "$SSH_KEY_MODE" in
found) found)
SEL=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SELECT HOST KEYS" \ SEL=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "SELECT HOST KEYS" \
--checklist "Select one or more keys to import:" 20 20 10 "${CHOICES[@]}" 3>&1 1>&2 2>&3) || exit_script --checklist "Select one or more keys to import:" 20 140 10 "${CHOICES[@]}" 3>&1 1>&2 2>&3) || exit_script
for tag in $SEL; do for tag in $SEL; do
tag="${tag%\"}" tag="${tag%\"}"
tag="${tag#\"}" tag="${tag#\"}"
@ -1203,26 +1203,29 @@ _sanitize_value() {
# Map-Parser: read var_* from file into _VARS_IN associative array # Map-Parser: read var_* from file into _VARS_IN associative array
declare -A _VARS_IN declare -A _VARS_IN
_load_vars_file_to_map() { _load_vars_file() {
local file="$1" local file="$1"
_VARS_IN=() [ -f "$file" ] || return 0
[[ -f "$file" ]] || return 0 msg_info "Loading defaults from ${file}"
local line local line key val
while IFS= read -r line || [[ -n "$line" ]]; do while IFS= read -r line || [ -n "$line" ]; do
line="${line#"${line%%[![:space:]]*}"}" line="${line#"${line%%[![:space:]]*}"}"
line="${line%"${line##*[![:space:]]}"}" line="${line%"${line##*[![:space:]]}"}"
[[ -z "$line" || "$line" == \#* ]] && continue [ -z "$line" ] && continue
if [[ "$line" =~ ^([A-Za-z_][A-Za-z0-9_]*)=(.*)$ ]]; then case "$line" in
local k="${BASH_REMATCH[1]}" \#*) continue ;;
local v="${BASH_REMATCH[2]}" esac
[[ "$k" == var_* ]] || continue key=$(printf "%s" "$line" | cut -d= -f1)
_is_whitelisted_key "$k" || continue val=$(printf "%s" "$line" | cut -d= -f2-)
# strip Quotes case "$key" in
if [[ "$v" =~ ^\"(.*)\"$ ]]; then v="${BASH_REMATCH[1]}"; fi var_*)
if [[ "$v" =~ ^\'(.*)\'$ ]]; then v="${BASH_REMATCH[1]}"; fi if _is_whitelisted_key "$key"; then
_VARS_IN["$k"]="$v" [ -z "${!key+x}" ] && export "$key=$val"
fi fi
;;
esac
done <"$file" done <"$file"
msg_ok "Loaded ${file}"
} }
# Diff function for two var_* files -> produces human-readable diff list for $1 (old) vs $2 (new) # Diff function for two var_* files -> produces human-readable diff list for $1 (old) vs $2 (new)