diff --git a/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh b/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh index 943fd57f1..69cf60ea5 100644 --- a/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh +++ b/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh @@ -73,7 +73,7 @@ while IFS= read -r line; do secret=${line#*secret } # Check if single match secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml) - [[ $(echo $secretnum) == *' '* ]] && bashio::log.fatal "There are multiple matches for your password name. Please check your secrets.yaml file" && bashio::exit.nok + [[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file" # Get text secret=$(sed -n "/$secret:/p" /config/secrets.yaml) secret=${secret#*: } @@ -81,20 +81,14 @@ while IFS= read -r line; do fi # Data validation if [[ $line =~ ^.+[=].+$ ]]; then - export $line # Export the variable - logmsg="Variable set : $line" - if [ -f /etc/services.d/*/*run* ]; then - sed -i "1a export $line" /etc/services.d/*/run # Export the variable - sed -i "1a bashio::log.blue \"$logmsg\" || echo \"$logmsg\"" /etc/services.d/*/run # Show text in colour - fi - if [ -f /scripts/*run* ]; then - sed -i "1a export $line" /scripts/*run* # Export the variable - sed -i "1a bashio::log.blue \"$logmsg\" || echo \"$logmsg\"" /scripts/*run* # Show text in colour - fi + export $line + # Export the variable + [ -f /etc/services.d/*/*run* ] && sed -i "1a export $line" /etc/services.d/*/*run* + [ -f /scripts/*run* ] && sed -i "1a export $line" /scripts/*run* + # Show in log bashio::log.blue "$line" else - bashio::log.fatal "$line does not follow the structure KEY=text" - bashio::exit.nok + bashio::exit.nok "$line does not follow the correct structure. Please check your yaml file." fi done <"/tmpfile" diff --git a/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh b/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh index 1b22437f5..69cf60ea5 100644 --- a/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh +++ b/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh @@ -45,10 +45,10 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; @@ -73,7 +73,7 @@ while IFS= read -r line; do secret=${line#*secret } # Check if single match secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml) - [[ $(echo $secretnum) == *' '* ]] && bashio::log.fatal "There are multiple matches for your password name. Please check your secrets.yaml file" && bashio::exit.nok + [[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file" # Get text secret=$(sed -n "/$secret:/p" /config/secrets.yaml) secret=${secret#*: } @@ -81,28 +81,22 @@ while IFS= read -r line; do fi # Data validation if [[ $line =~ ^.+[=].+$ ]]; then - export $line # Export the variable - logmsg="Variable set : $line" - if [ -f /etc/services.d/*/*run* ]; then - sed -i "1a export $line" /etc/services.d/*/run # Export the variable - sed -i "1a bashio::log.blue $logmsg 2>/dev/null || echo \$(tput -T xterm setaf 2)$logmsg\$(tput -T xterm setaf 0) 2>/dev/null" /etc/services.d/*/run # Show text in colour - fi - if [ -f /scripts/*run* ]; then - sed -i "1a export $line" /scripts/*run* # Export the variable - sed -i "1a bashio::log.blue $logmsg 2>/dev/null || echo \$(tput -T xterm setaf 2)$logmsg\$(tput -T xterm setaf 0) 2>/dev/null" /scripts/*run* # Show text in colour - fi + export $line + # Export the variable + [ -f /etc/services.d/*/*run* ] && sed -i "1a export $line" /etc/services.d/*/*run* + [ -f /scripts/*run* ] && sed -i "1a export $line" /scripts/*run* + # Show in log bashio::log.blue "$line" else - bashio::log.fatal "$line does not follow the structure KEY=text" - bashio::exit.nok + bashio::exit.nok "$line does not follow the correct structure. Please check your yaml file." fi done <"/tmpfile" # Test mode TZ=$(bashio::config "TZ") if [ $TZ = "test" ]; then - echo "secret mode found, launching script in /config/test.sh" - cd /config - chmod 777 test.sh - ./test.sh + echo "secret mode found, launching script in /config/test.sh" + cd /config + chmod 777 test.sh + ./test.sh fi diff --git a/webtrees/rootfs/scripts/90-config_yaml.sh b/webtrees/rootfs/scripts/90-config_yaml.sh index 1b22437f5..69cf60ea5 100644 --- a/webtrees/rootfs/scripts/90-config_yaml.sh +++ b/webtrees/rootfs/scripts/90-config_yaml.sh @@ -45,10 +45,10 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; @@ -73,7 +73,7 @@ while IFS= read -r line; do secret=${line#*secret } # Check if single match secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml) - [[ $(echo $secretnum) == *' '* ]] && bashio::log.fatal "There are multiple matches for your password name. Please check your secrets.yaml file" && bashio::exit.nok + [[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file" # Get text secret=$(sed -n "/$secret:/p" /config/secrets.yaml) secret=${secret#*: } @@ -81,28 +81,22 @@ while IFS= read -r line; do fi # Data validation if [[ $line =~ ^.+[=].+$ ]]; then - export $line # Export the variable - logmsg="Variable set : $line" - if [ -f /etc/services.d/*/*run* ]; then - sed -i "1a export $line" /etc/services.d/*/run # Export the variable - sed -i "1a bashio::log.blue $logmsg 2>/dev/null || echo \$(tput -T xterm setaf 2)$logmsg\$(tput -T xterm setaf 0) 2>/dev/null" /etc/services.d/*/run # Show text in colour - fi - if [ -f /scripts/*run* ]; then - sed -i "1a export $line" /scripts/*run* # Export the variable - sed -i "1a bashio::log.blue $logmsg 2>/dev/null || echo \$(tput -T xterm setaf 2)$logmsg\$(tput -T xterm setaf 0) 2>/dev/null" /scripts/*run* # Show text in colour - fi + export $line + # Export the variable + [ -f /etc/services.d/*/*run* ] && sed -i "1a export $line" /etc/services.d/*/*run* + [ -f /scripts/*run* ] && sed -i "1a export $line" /scripts/*run* + # Show in log bashio::log.blue "$line" else - bashio::log.fatal "$line does not follow the structure KEY=text" - bashio::exit.nok + bashio::exit.nok "$line does not follow the correct structure. Please check your yaml file." fi done <"/tmpfile" # Test mode TZ=$(bashio::config "TZ") if [ $TZ = "test" ]; then - echo "secret mode found, launching script in /config/test.sh" - cd /config - chmod 777 test.sh - ./test.sh + echo "secret mode found, launching script in /config/test.sh" + cd /config + chmod 777 test.sh + ./test.sh fi diff --git a/zzz_templates/90-config_yaml.sh b/zzz_templates/90-config_yaml.sh index 0824cc367..69cf60ea5 100644 --- a/zzz_templates/90-config_yaml.sh +++ b/zzz_templates/90-config_yaml.sh @@ -45,10 +45,10 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; @@ -73,7 +73,7 @@ while IFS= read -r line; do secret=${line#*secret } # Check if single match secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml) - [[ $(echo $secretnum) == *' '* ]] && bashio::log.fatal "There are multiple matches for your password name. Please check your secrets.yaml file" && bashio::exit.nok + [[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file" # Get text secret=$(sed -n "/$secret:/p" /config/secrets.yaml) secret=${secret#*: } @@ -81,28 +81,22 @@ while IFS= read -r line; do fi # Data validation if [[ $line =~ ^.+[=].+$ ]]; then - export $line # Export the variable - logmsg="Variable set : $line" - if [ -f /etc/services.d/*/*run* ]; then - sed -i "1a export $line" /etc/services.d/*/run # Export the variable - sed -i "1a bashio::log.blue $logmsg || echo \$(tput -T xterm setaf 2)$logmsg\$(tput -T xterm setaf 0) || echo $logmsg" /etc/services.d/*/run # Show text in colour - fi - if [ -f /scripts/*run* ]; then - sed -i "1a export $line" /scripts/*run* # Export the variable - sed -i "1a bashio::log.blue $logmsg || echo \$(tput -T xterm setaf 2)$logmsg\$(tput -T xterm setaf 0) || echo $logmsg" /scripts/*run* # Show text in colour - fi + export $line + # Export the variable + [ -f /etc/services.d/*/*run* ] && sed -i "1a export $line" /etc/services.d/*/*run* + [ -f /scripts/*run* ] && sed -i "1a export $line" /scripts/*run* + # Show in log bashio::log.blue "$line" else - bashio::log.fatal "$line does not follow the structure KEY=text" - bashio::exit.nok + bashio::exit.nok "$line does not follow the correct structure. Please check your yaml file." fi done <"/tmpfile" # Test mode TZ=$(bashio::config "TZ") if [ $TZ = "test" ]; then - echo "secret mode found, launching script in /config/test.sh" - cd /config - chmod 777 test.sh - ./test.sh + echo "secret mode found, launching script in /config/test.sh" + cd /config + chmod 777 test.sh + ./test.sh fi