mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 13:14:21 +01:00
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:
@@ -19,6 +19,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
software-properties-common \
|
software-properties-common \
|
||||||
gpg-agent \
|
gpg-agent \
|
||||||
git \
|
git \
|
||||||
|
jq \
|
||||||
sudo \
|
sudo \
|
||||||
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \
|
&& 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" \
|
&& add-apt-repository "deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
|
||||||
|
|||||||
@@ -68,10 +68,14 @@ function cleanup_hass_data() {
|
|||||||
function cleanup_docker() {
|
function cleanup_docker() {
|
||||||
echo "Cleaning up stopped containers..."
|
echo "Cleaning up stopped containers..."
|
||||||
docker rm $(docker ps -a -q)
|
docker rm $(docker ps -a -q)
|
||||||
|
}
|
||||||
|
|
||||||
# Clean homeassistant instance
|
function cleanup_lastboot() {
|
||||||
if docker rm -f homeassistant 2> /dev/null; then
|
if [[ -f /workspaces/test_hassio/config.json ]]; then
|
||||||
echo "Cleanup HomeAssistant instance"
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +106,7 @@ case "$1" in
|
|||||||
start_docker
|
start_docker
|
||||||
trap "stop_docker" ERR
|
trap "stop_docker" ERR
|
||||||
cleanup_docker || true
|
cleanup_docker || true
|
||||||
|
cleanup_lastboot || true
|
||||||
install
|
install
|
||||||
run_supervisor
|
run_supervisor
|
||||||
stop_docker;;
|
stop_docker;;
|
||||||
|
|||||||
Reference in New Issue
Block a user