From a8df9b69f5d58452ebf26aa4080e774deb284cbe Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 24 Feb 2023 22:29:03 +0100 Subject: [PATCH] Escape dollar https://github.com/alexbelgium/hassio-addons/issues/729 --- .templates/90-config_yaml.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.templates/90-config_yaml.sh b/.templates/90-config_yaml.sh index 1ad3852e9..73ae12699 100755 --- a/.templates/90-config_yaml.sh +++ b/.templates/90-config_yaml.sh @@ -112,12 +112,6 @@ while IFS= read -r line; do # Data validation if [[ "$line" =~ ^.+[=].+$ ]]; then export "$line" - # Export to scripts - sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true - sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null || true - sed -i "1a export $line" /scripts/*run* 2>/dev/null || true - # Export to s6 - if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" > /var/run/s6/container_environment/"${KEYS}"; fi # export to python if command -v "python3" &>/dev/null; then [ ! -f /env.py ] && echo "import os" > /env.py @@ -128,6 +122,14 @@ while IFS= read -r line; do echo "$line" >> /.env || true mkdir -p /etc echo "$line" >> /etc/environmemt + # Escape dollars + line="${line//$/\\$}" + # Export to scripts + sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true + sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null || true + sed -i "1a export $line" /scripts/*run* 2>/dev/null || true + # Export to s6 + if [ -d /var/run/s6/container_environment ]; then printf "%s" "${VALUE}" > /var/run/s6/container_environment/"${KEYS}"; fi # Show in log if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi else