mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-13 12:15:03 +00:00
quickfix; trim timezone
This commit is contained in:
@@ -588,6 +588,12 @@ load_vars_file() {
|
|||||||
[[ "$var_key" != var_* ]] && continue
|
[[ "$var_key" != var_* ]] && continue
|
||||||
_is_whitelisted "$var_key" || continue
|
_is_whitelisted "$var_key" || continue
|
||||||
|
|
||||||
|
# Strip inline comments (anything after unquoted #)
|
||||||
|
# Only strip if not inside quotes
|
||||||
|
if [[ ! "$var_val" =~ ^[\"\'] ]]; then
|
||||||
|
var_val="${var_val%%#*}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Strip quotes
|
# Strip quotes
|
||||||
if [[ "$var_val" =~ ^\"(.*)\"$ ]]; then
|
if [[ "$var_val" =~ ^\"(.*)\"$ ]]; then
|
||||||
var_val="${BASH_REMATCH[1]}"
|
var_val="${BASH_REMATCH[1]}"
|
||||||
@@ -595,6 +601,9 @@ load_vars_file() {
|
|||||||
var_val="${BASH_REMATCH[1]}"
|
var_val="${BASH_REMATCH[1]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Trim trailing whitespace
|
||||||
|
var_val="${var_val%"${var_val##*[![:space:]]}"}"
|
||||||
|
|
||||||
# Set variable: force mode overrides existing, otherwise only set if empty
|
# Set variable: force mode overrides existing, otherwise only set if empty
|
||||||
if [[ "$force" == "yes" ]]; then
|
if [[ "$force" == "yes" ]]; then
|
||||||
export "${var_key}=${var_val}"
|
export "${var_key}=${var_val}"
|
||||||
|
|||||||
Reference in New Issue
Block a user