mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04: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 \
|
||||
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" \
|
||||
|
||||
@@ -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;;
|
||||
|
||||
Reference in New Issue
Block a user