Allow all options

This commit is contained in:
Alexandre
2023-01-24 16:39:19 +01:00
parent 59bc5e5150
commit db4bb9ccb6
3 changed files with 19 additions and 21 deletions

View File

@@ -19,9 +19,14 @@ if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then
mv /data/config.yaml "$CONFIGSOURCE".bak
fi
############
# DATABASE #
############
#########################################################
# MIGRATION FROM ENEDISGATEWAY2MQTT TO MYELECTRICALDATA #
#########################################################
if [ -f /config/addons_config/enedisgateway2mqtt_dev/config.yaml ]; then
mv /config/addons_config/enedisgateway2mqtt_dev/* "$(dirname "${CONFIGSOURCE}")"/
rm -r /config/addons_config/enedisgateway2mqtt_dev
fi
# If migration was performed, save file in config folder
if [ -f /data/enedisgateway.db.migrate ]; then
@@ -31,7 +36,6 @@ fi
# If migration was performed, save file in config folder
if [ -f /data/cache.db ] && [ ! -f "$DATABASESOURCE" ]; then
if [ -f "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db ]; then mv "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db.bak2; fi
mv /data/cache.db "$(dirname "${CONFIGSOURCE}")"
fi
@@ -40,6 +44,10 @@ if [ -f "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db ]; then
mv "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db /data
fi
############
# DATABASE #
############
# Check if database is here or create symlink
if [ -f "$DATABASESOURCE" ]; then
# Create symlink if not existing yet
@@ -90,13 +98,4 @@ echo " "
bashio::log.info "Starting the app"
echo " "
# Test mode
TZ=$(bashio::config "TZ")
if [ "$TZ" = "test" ]; then
echo "secret mode found, launching script in /config/test.sh"
cd /config || exit
chmod 777 test.sh
./test.sh
fi
python -u /app/main.py || bashio::log.fatal "The app has crashed. Are you sure you entered the correct config options?"