From f9c24070048af8e387e5a8aea5d8dc37767c08ca Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 22 Nov 2023 16:52:43 +0100 Subject: [PATCH] Update 01-config_yaml.sh --- .templates/01-config_yaml.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.templates/01-config_yaml.sh b/.templates/01-config_yaml.sh index f5b552dca..68dd78e8f 100755 --- a/.templates/01-config_yaml.sh +++ b/.templates/01-config_yaml.sh @@ -161,6 +161,9 @@ while IFS= read -r line; do VALUE="${line#*=}" # Sanitize " ' ` in current variable VALUE="${VALUE//[\"\'\`]/}" + if [[ "$VALUE" = *" "* ]]; then + VALUE="'$VALUE'" + fi # export to python if command -v "python3" &>/dev/null; then [ ! -f /env.py ] && echo "import os" > /env.py @@ -168,17 +171,17 @@ while IFS= read -r line; do python3 /env.py fi # set .env - if [ -f /.env ]; then echo "$KEYS=\"$VALUE\"" >> /.env; fi + if [ -f /.env ]; then echo "$KEYS=$VALUE" >> /.env; fi mkdir -p /etc - echo "$KEYS=\"$VALUE\"" >> /etc/environment + echo "$KEYS=$VALUE" >> /etc/environment # Export to 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 $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 # For s6 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 # Show in log - if ! bashio::config.false "verbose"; then bashio::log.blue "$KEYS=\"$VALUE\""; fi + if ! bashio::config.false "verbose"; then bashio::log.blue "$KEYS=$VALUE"; fi else bashio::log.red "$line does not follow the correct structure. Please check your yaml file." fi