This commit is contained in:
Alexandre
2022-02-18 09:14:08 +01:00
parent 0e58af718b
commit b23670350e
8 changed files with 24 additions and 25 deletions

View File

@@ -19,14 +19,14 @@ if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then
fi
# Check if config file is there, or create one from template
if [ -f $CONFIGSOURCE ]; then
if [ -f "$CONFIGSOURCE" ]; then
# Create symlink if not existing yet
[ ! -L /data/config.yaml ] && ln -sf $CONFIGSOURCE /data
[ ! -L /data/config.yaml ] && ln -sf "$CONFIGSOURCE" /data
bashio::log.info "Using config file found in $CONFIGSOURCE"
# Check if yaml is valid
EXIT_CODE=0
yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$?
yamllint -d relaxed "$CONFIGSOURCE" &>ERROR || EXIT_CODE=$?
if [ $EXIT_CODE = 0 ]; then
echo "Config file is a valid yaml"
else
@@ -37,10 +37,10 @@ if [ -f $CONFIGSOURCE ]; then
else
# Create symlink for addon to create config
touch ${CONFIGSOURCE}
ln -sf $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."
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
# Remove previous link or file