remove lastboot before supervisor startup (#1065)

* Add devcontainer (generic add-on devcontainer also available at https://github.com/issacg/hassio-addon-devcontainer)

* remove example code (https://github.com/home-assistant/hassio-addons/pull/1040#discussion_r374373037)

* Run start_hassio.sh from inside .devcontainer (https://github.com/home-assistant/hassio-addons/pull/1040#discussion_r374373323)

* Revert "Fix HA container"

This reverts commit 7062117d46.

* Fix lastboot
This commit is contained in:
Issac
2020-02-10 14:52:34 +02:00
committed by GitHub
parent 5f5f7dae57
commit 6725b3f7da
2 changed files with 9 additions and 3 deletions

View File

@@ -19,6 +19,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
gpg-agent \
git \
jq \
sudo \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \
&& add-apt-repository "deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \

View File

@@ -68,10 +68,14 @@ function cleanup_hass_data() {
function cleanup_docker() {
echo "Cleaning up stopped containers..."
docker rm $(docker ps -a -q)
}
# Clean homeassistant instance
if docker rm -f homeassistant 2> /dev/null; then
echo "Cleanup HomeAssistant instance"
function cleanup_lastboot() {
if [[ -f /workspaces/test_hassio/config.json ]]; then
echo "Cleaning up last boot"
cp /workspaces/test_hassio/config.json /tmp/config.json
jq -rM 'del(.last_boot)' /tmp/config.json > /workspaces/test_hassio/config.json
rm /tmp/config.json
fi
}
@@ -102,6 +106,7 @@ case "$1" in
start_docker
trap "stop_docker" ERR
cleanup_docker || true
cleanup_lastboot || true
install
run_supervisor
stop_docker;;