From 808538020363c06336f0359780bc9182ebc3c945 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 18 Nov 2021 22:21:54 +0100 Subject: [PATCH] Update 99-run.sh --- enedisgateway2mqtt/rootfs/scripts/99-run.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/enedisgateway2mqtt/rootfs/scripts/99-run.sh b/enedisgateway2mqtt/rootfs/scripts/99-run.sh index 6dd32e501..989d9e3e5 100644 --- a/enedisgateway2mqtt/rootfs/scripts/99-run.sh +++ b/enedisgateway2mqtt/rootfs/scripts/99-run.sh @@ -43,16 +43,13 @@ else bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." fi -# Check absence of database file -if [ -f /data/enedisgateway.db ] && [ ! -L /data/enedisgateway.db ]; then - bashio::log.warning "A current database was found in /data, it is backuped to ${DATABASESOURCE}.bak" - mv /data/enedisgateway.db $DATABASESOURCE.bak -fi +# Remove previous link or file +[ -f /data/enedisgateway.db ] && rm /data/enedisgateway.db # Check if database is here or create symlink if [ -f $DATABASESOURCE ]; then # Create symlink if not existing yet - [ ! -L /data/enedisgateway.db ] && ln -sf ${DATABASESOURCE} /data && echo "creating symlink" + ln -sf ${DATABASESOURCE} /data && echo "creating symlink" bashio::log.info "Using database file found in $DATABASESOURCE" else # Create symlink for addon to create database