mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-03 14:24:06 +02:00
Update 90-config_yaml.sh
This commit is contained in:
@@ -45,10 +45,10 @@ function parse_yaml {
|
|||||||
local prefix=$2 || local prefix=""
|
local prefix=$2 || local prefix=""
|
||||||
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034')
|
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034')
|
||||||
sed -ne "s|^\($s\):|\1|" \
|
sed -ne "s|^\($s\):|\1|" \
|
||||||
-e "s| #.*$||g" \
|
-e "s| #.*$||g" \
|
||||||
-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" \
|
||||||
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
|
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
|
||||||
awk -F$fs '{
|
awk -F$fs '{
|
||||||
indent = length($1)/2;
|
indent = length($1)/2;
|
||||||
vname[indent] = $2;
|
vname[indent] = $2;
|
||||||
@@ -81,10 +81,11 @@ while IFS= read -r line; do
|
|||||||
fi
|
fi
|
||||||
# Data validation
|
# Data validation
|
||||||
if [[ $line =~ ^.+[=].+$ ]]; then
|
if [[ $line =~ ^.+[=].+$ ]]; then
|
||||||
export $line 2> /dev/null
|
export $line
|
||||||
# Export the variable
|
# Export the variable
|
||||||
[ -f /etc/services.d/*/*run* ] && sed -i "1a export $line 2>/dev/null || true" /etc/services.d/*/*run* || true
|
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true
|
||||||
[ -f /etc/cont-init.d/*run* ] && sed -i "1a export $line 2>/dev/null || true" /etc/cont-init.d/*run* || 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
|
||||||
# Show in log
|
# Show in log
|
||||||
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user