Update 99-run.sh

This commit is contained in:
Alexandre
2021-11-14 11:59:57 +01:00
committed by GitHub
parent 9d24ca1fb7
commit 20c7c3554e

View File

@@ -30,7 +30,7 @@ for KEYS in ${arr[@]}; do
# Write it in the config file # Write it in the config file
echo ${SUBKEYS} >>${CONFIGSOURCE} echo ${SUBKEYS} >>${CONFIGSOURCE}
# Say it loud # Say it loud
echo "... ${SUBKEYS}" # echo "... ${SUBKEYS}"
done done
# If it is a normal field # If it is a normal field
else else
@@ -39,7 +39,7 @@ for KEYS in ${arr[@]}; do
# Write it in the config file # Write it in the config file
echo "${KEYS}=$(jq .$KEYS ${JSONSOURCE})" >>${CONFIGSOURCE} echo "${KEYS}=$(jq .$KEYS ${JSONSOURCE})" >>${CONFIGSOURCE}
# Say it loud # Say it loud
echo "... ${KEYS}=$(jq .$KEYS ${JSONSOURCE})" # echo "... ${KEYS}=$(jq .$KEYS ${JSONSOURCE})"
fi fi
done done
@@ -50,7 +50,7 @@ done
bashio::log.info "Starting the app with the variables in /config/enedisgateway2mqtt" bashio::log.info "Starting the app with the variables in /config/enedisgateway2mqtt"
# Remove ' # Remove '
sed -i 's|\x27||g' $CONFIGSOURCE # sed -i 's|\x27||g' $CONFIGSOURCE
sed -i 's|"||g' $CONFIGSOURCE sed -i 's|"||g' $CONFIGSOURCE
# For all keys in config file # For all keys in config file
@@ -58,7 +58,7 @@ for word in $(cat $CONFIGSOURCE); do
# Data validation # Data validation
if [[ $word =~ ^.+[=].+$ ]]; then if [[ $word =~ ^.+[=].+$ ]]; then
export $word # Export the variable export $word # Export the variable
bashio::log.blue "... $word" bashio::log.blue "$word"
else else
bashio::log.fatal "$word does not follow the structure KEY=text, it will be ignored and removed from the config" bashio::log.fatal "$word does not follow the structure KEY=text, it will be ignored and removed from the config"
sed -i "/$word/ d" ${CONFIGSOURCE} sed -i "/$word/ d" ${CONFIGSOURCE}