Update 00-global_var.sh

This commit is contained in:
Alexandre
2022-02-17 17:11:18 +01:00
committed by GitHub
parent 3df9d17a8f
commit 7b577767d5

View File

@@ -15,7 +15,7 @@ mapfile -t arr < <(jq -r 'keys[]' "${JSONSOURCE}")
for KEYS in "${arr[@]}"; do
# export key
VALUE=$(jq ."$KEYS" "${JSONSOURCE}")
line="${KEYS}=\"${VALUE//[\"\']/}\""
line="${KEYS}=\'${VALUE//[\"\']/}\'"
# Use locally
if bashio::config.false "verbose" || [[ "${KEYS}" == *"PASS"* ]]; then
bashio::log.blue "${KEYS}=******"
@@ -23,8 +23,8 @@ for KEYS in "${arr[@]}"; do
bashio::log.blue "$line"
fi
# Export the variable to run scripts
if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export ${KEYS}=\"${VALUE//[\"\']/}\"" /etc/services.d/*/*run* 2>/dev/null; fi
if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export ${KEYS}=\"${VALUE//[\"\']/}\"" /etc/cont-init.d/*run* 2>/dev/null; fi
if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null; fi
if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null; fi
done
################