New addon, check config (#51)

* New addon, check config

* map folders
This commit is contained in:
Pascal Vizeli
2017-05-13 10:17:14 +02:00
committed by GitHub
parent 6d62a68387
commit 923057c751
3 changed files with 56 additions and 0 deletions

15
check_config/Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
FROM %%BASE_IMAGE%%
# Add version
ENV VERSION %%VERSION%%
ENV LANG C.UTF-8
# Setup base
RUN apk add --no-cache jq python3 \
&& pip3 install --no-cache --upgrade pip
# Copy data
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]

16
check_config/config.json Normal file
View File

@@ -0,0 +1,16 @@
{
"name": "Check HomeAssistant config",
"version": "0.1",
"slug": "check_config",
"description": "Check HomeAssistant config with a new version",
"url": "https://home-assistant.io/addons/check_config/",
"startup": "once",
"boot": "manual",
"map": ["config", "ssl"],
"options": {
"version": "latest"
},
"schema": {
"version": "str"
}
}

25
check_config/run.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/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"
exec hass -c /config --script check_config