Alexandre
2024-09-22 18:00:26 +02:00
parent 6bfc9585fc
commit b8e2307df4
3 changed files with 20 additions and 17 deletions

View File

@@ -35,23 +35,23 @@ done
# MIGRATE DATA DIR #
####################
if [ -d /homeassistant/addons_config/mealie_data ] && [ ! -f /homeassistant/addons_config/mealie_data/migrated ]; then
bashio::log.warning "Migrating data, current data will not be touched"
cp -rnf /homeassistant/addons_config/mealie_data/* /config/ || true
touch /homeassistant/addons_config/mealie_data/migrated
fi
#if [ -d /homeassistant/addons_config/mealie_data ] && [ ! -f /homeassistant/addons_config/mealie_data/migrated ]; then
# bashio::log.warning "Migrating data, current data will not be touched"
# cp -rnf /homeassistant/addons_config/mealie_data/* /config/ || true
# touch /homeassistant/addons_config/mealie_data/migrated
#fi
if [ -f /homeassistant/addons_config/mealie/config.yaml ] && [ ! -f /homeassistant/addons_config/mealie/migrated ]; then
bashio::log.warning "Migrating config.yaml, current data will not be touched"
cp -nf /homeassistant/addons_config/mealie/config.yaml /config/ || true
touch /homeassistant/addons_config/mealie/migrated
fi
#if [ -f /homeassistant/addons_config/mealie/config.yaml ] && [ ! -f /homeassistant/addons_config/mealie/migrated ]; then
# bashio::log.warning "Migrating config.yaml, current data will not be touched"
# cp -nf /homeassistant/addons_config/mealie/config.yaml /config/ || true
# touch /homeassistant/addons_config/mealie/migrated
#fi
###############
# CONFIG YAML #
###############
CONFIGSOURCE="/config/config.yaml"
CONFIGSOURCE="/config/addons_config/mealie/config.yaml"
if [ -f "$CONFIGSOURCE" ]; then
bashio::log.info "config.yaml found in $CONFIGSOURCE, exporting variables"
@@ -77,7 +77,8 @@ function parse_yaml {
}
# Get list of parameters in a file
parse_yaml "$CONFIGSOURCE" "" >/tmpfile
parse_yaml /tempenv "" >/tmpfile
while IFS= read -r line; do
# Clean output
line="${line//[\"\']/}"
@@ -86,10 +87,10 @@ while IFS= read -r line; do
echo "secret detected"
secret=${line#*secret }
# Check if single match
secretnum=$(sed -n "/$secret:/=" /homeassistant/secrets.yaml)
secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml)
[[ $(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" /homeassistant/secrets.yaml)
secret=$(sed -n "/$secret:/p" /config/secrets.yaml)
secret=${secret#*: }
line="${line%%=*}='$secret'"
fi