mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-01 21:34:06 +02:00
Update 00-global_var.sh
This commit is contained in:
@@ -41,7 +41,11 @@ for KEYS in "${arr[@]}"; do
|
|||||||
######################################
|
######################################
|
||||||
# Export the variable to run scripts #
|
# Export the variable to run scripts #
|
||||||
######################################
|
######################################
|
||||||
export "${KEYS}='${VALUE}'"
|
|
||||||
|
# Sanitize " ' ` in current variable
|
||||||
|
VALUE="${VALUE//[\"\'\`]/}"
|
||||||
|
# Export
|
||||||
|
export "${KEYS}=\"${VALUE}\""
|
||||||
# set .env
|
# set .env
|
||||||
echo "$KEYS=\"$VALUE\"" >> /.env || true
|
echo "$KEYS=\"$VALUE\"" >> /.env || true
|
||||||
# set /etc/environment
|
# set /etc/environment
|
||||||
@@ -51,7 +55,7 @@ for KEYS in "${arr[@]}"; do
|
|||||||
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/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/cont-init.d/*run* &>/dev/null; then sed -i "1a export ${KEYS}=\"${VALUE}\"" /etc/cont-init.d/*run* 2>/dev/null; fi
|
||||||
# For s6
|
# For s6
|
||||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" > /var/run/s6/container_environment/"${KEYS}"; fi
|
if [ -d /var/run/s6/container_environment ]; then printf "%s" "\"${VALUE}\"" > /var/run/s6/container_environment/"${KEYS}"; fi
|
||||||
echo "export ${KEYS}=\"${VALUE}\"" >> ~/.bashrc
|
echo "export ${KEYS}=\"${VALUE}\"" >> ~/.bashrc
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user