diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d9c8870..76fab8b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -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" \ diff --git a/.devcontainer/start_hassio.sh b/.devcontainer/start_hassio.sh index eeb2800..48abeb8 100644 --- a/.devcontainer/start_hassio.sh +++ b/.devcontainer/start_hassio.sh @@ -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;;