mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-02 13:54:05 +02:00
Update 99-run.sh
This commit is contained in:
@@ -12,10 +12,10 @@ DATABASESOURCE="$(dirname "${CONFIGSOURCE}")/enedisgateway.db"
|
|||||||
mkdir -p "$(dirname "${CONFIGSOURCE}")"
|
mkdir -p "$(dirname "${CONFIGSOURCE}")"
|
||||||
mkdir -p "$(dirname "${DATABASESOURCE}")"
|
mkdir -p "$(dirname "${DATABASESOURCE}")"
|
||||||
|
|
||||||
# Use existing config if present
|
# Check absence of config file
|
||||||
if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then
|
if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then
|
||||||
[ ! -f $CONFIGSOURCE ] && mv /data/config.yaml $(dirname "${CONFIGSOURCE}") \
|
bashio::log.warning "A current config was found in /data, it is backuped to $(dirname ${CONFIGSOURCE}).bak"
|
||||||
|| mv /data/config.yaml /data/config2.yaml
|
mv /data/config.yaml $CONFIGSOURCE.bak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if config file is there, or create one from template
|
# Check if config file is there, or create one from template
|
||||||
@@ -43,10 +43,10 @@ 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."
|
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
|
fi
|
||||||
|
|
||||||
# Use existing database if present
|
# Check absence of database file
|
||||||
if [ -f /data/enedisgateway.db ] && [ ! -L /data/enedisgateway.db ]; then
|
if [ -f /data/enedisgateway.db ] && [ ! -L /data/enedisgateway.db ]; then
|
||||||
[ ! -f $DATABASESOURCE ] && mv /data/enedisgateway.db $(dirname "${DATABASESOURCE}")
|
bashio::log.warning "A current database was found in /data, it is backuped to $(dirname "${DATABASESOURCE}").bak"
|
||||||
[ -f $DATABASESOURCE ] && mv /data/enedisgateway.db /data/enedisgateway2.db
|
mv /data/enedisgateway.db $DATABASESOURCE.bak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if database is here or create symlink
|
# Check if database is here or create symlink
|
||||||
|
|||||||
Reference in New Issue
Block a user