Files
addons/check_config/run.sh
Censored3 d7b34cfdc1 check_config: bugfixes (#388)
* do not copy config to /tmp on boot - Closes home-assistant/hassio-addons#374

* check_config: version bump

* check_config: add OS deps to satisfy cffi

* check_config: .. and build-base

* Create build.json

* Update Dockerfile

* Update run.sh
2018-08-29 00:20:36 +02:00

41 lines
829 B
Bash

#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
VERSION=$(jq --raw-output ".version" $CONFIG_PATH)
# generate install string
if [ "$VERSION" == "latest" ]; then
CMD="homeassistant"
else
CMD="homeassistant==$VERSION"
fi
echo "[Info] Start install HomeAssistant $VERSION"
if ! PIP_OUTPUT="$(pip3 install "$CMD")"
then
echo "[Error] Install HomeAssistant: $PIP_OUTPUT"
exit 1
fi
echo "[Info] Install done, check config now"
cp -fr /config /tmp/config
if ! HASS_OUTPUT="$(hass -c /tmp/config --script check_config)"
then
echo "[Error] Wrong config found!"
echo "$HASS_OUTPUT"
exit 1
fi
if echo "$HASS_OUTPUT" | grep -i ERROR > /dev/null
then
echo "[Error] Found error inside log output!"
echo "$HASS_OUTPUT"
exit 1
fi
echo "[Info] Configuration check finished - no error found! :)"