From 2b6f6272fcf6e6787ac365841233a5340e3e1c4c Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 18 Nov 2021 15:56:42 +0100 Subject: [PATCH] Prevent error symlinks --- enedisgateway2mqtt/rootfs/scripts/99-run.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/enedisgateway2mqtt/rootfs/scripts/99-run.sh b/enedisgateway2mqtt/rootfs/scripts/99-run.sh index 01a0249c4..26c7ee246 100644 --- a/enedisgateway2mqtt/rootfs/scripts/99-run.sh +++ b/enedisgateway2mqtt/rootfs/scripts/99-run.sh @@ -21,7 +21,7 @@ fi # Check if config file is there, or create one from template if [ -f $CONFIGSOURCE ]; then # Create symlink if not existing yet - [ ! -L /data/config.yaml ] && ln -s $CONFIGSOURCE /data + [ ! -L /data/config.yaml ] && ln -sf $CONFIGSOURCE /data bashio::log.info "Using config file found in $CONFIGSOURCE" # Check if yaml is valid @@ -37,7 +37,7 @@ if [ -f $CONFIGSOURCE ]; then else # Create symlink for addon to create config touch ${CONFIGSOURCE} - ln -s $CONFIGSOURCE /data + ln -sf $CONFIGSOURCE /data rm $CONFIGSOURCE # Need to restart bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." @@ -52,12 +52,12 @@ fi # Check if database is here or create symlink if [ -f $DATABASESOURCE ]; then # Create symlink if not existing yet - [ ! -L /data/enedisgateway.db ] && ln -s ${DATABASESOURCE} /data + [ ! -L /data/enedisgateway.db ] && ln -sf ${DATABASESOURCE} /data bashio::log.info "Using database file found in $DATABASESOURCE" else # Create symlink for addon to create database touch ${DATABASESOURCE} - ln -s $DATABASESOURCE /data + ln -sf $DATABASESOURCE /data rm $DATABASESOURCE fi