mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-30 04:14:04 +02:00
lint
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user