mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-18 13:44:20 +01:00
Merge pull request #52 from home-assistant/build
New addon, check config (#51)
This commit is contained in:
15
check_config/Dockerfile
Normal file
15
check_config/Dockerfile
Normal 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
16
check_config/config.json
Normal 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
25
check_config/run.sh
Normal 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
|
||||||
Reference in New Issue
Block a user