mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-06 22:18:48 +02:00
Update 99-run.sh
This commit is contained in:
@@ -4,31 +4,34 @@
|
|||||||
# Check if config is there #
|
# Check if config is there #
|
||||||
############################
|
############################
|
||||||
|
|
||||||
CONFIGSOURCE="/config/enedisgateway2mqtt/config.yaml"
|
if bashio::config.true "test"; then
|
||||||
|
CONFIGSOURCE="/config/enedisgateway2mqtt/config.yaml"
|
||||||
|
# Check if config file is there, or create template
|
||||||
|
if [ -f $CONFIGSOURCE ]; then
|
||||||
|
echo "Using config file found in $CONFIGSOURCE"
|
||||||
|
else
|
||||||
|
mkdir -p "$(dirname "${CONFIGSOURCE}")"
|
||||||
|
cp /templates/config.yaml "$(dirname "${CONFIGSOURCE}")"
|
||||||
|
bashio::log.fatal "Config file not found, creating a new one. Please customize the file in $CONFIGSOURCE"
|
||||||
|
sleep 10
|
||||||
|
bashio::exit.nok
|
||||||
|
fi
|
||||||
|
|
||||||
if false; then
|
# Check if yaml is valid
|
||||||
# Check if config file is there, or create template
|
if [ yamllint $CONFIGSOURCE ]; then
|
||||||
if [ -f $CONFIGSOURCE ]; then
|
echo "Config file is a valid yaml"
|
||||||
echo "Using config file found in $CONFIGSOURCE"
|
else
|
||||||
else
|
bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE"
|
||||||
mkdir -p "$(dirname "${CONFIGSOURCE}")"
|
bashio::exit.nok
|
||||||
cp /templates/config.yaml "$(dirname "${CONFIGSOURCE}")"
|
fi
|
||||||
bashio::log.fatal "Config file not found, creating a new one. Please customize the file in $CONFIGSOURCE"
|
|
||||||
sleep 10
|
# Symlink
|
||||||
bashio::exit.nok
|
rm /data/config.yaml
|
||||||
|
ln -s $CONFIGSOURCE /data
|
||||||
|
echo "Symlink created"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if yaml is valid
|
|
||||||
if [ yamllint $CONFIGSOURCE ]; then
|
|
||||||
echo "Config file is a valid yaml"
|
|
||||||
else
|
|
||||||
bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE"
|
|
||||||
bashio::exit.nok
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Create config #
|
# Create config #
|
||||||
#################
|
#################
|
||||||
|
|||||||
Reference in New Issue
Block a user