Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup container and stop services before installing #343

Merged
merged 3 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions homeassistant-supervised/DEBIAN/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ URL_VERSION="https://version.home-assistant.io/stable.json"
HASSIO_VERSION=$(curl -s ${URL_VERSION} | jq -e -r '.supervisor')
URL_APPARMOR_PROFILE="https://version.home-assistant.io/apparmor.txt"

# reload systemd
info "Reload systemd"
systemctl daemon-reload

# Restart NetworkManager
info "Restarting NetworkManager"
Expand Down
17 changes: 17 additions & 0 deletions homeassistant-supervised/DEBIAN/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,24 @@ if [[ "$(sysctl --values kernel.dmesg_restrict)" != "0" ]]; then
echo "kernel.dmesg_restrict=0" >> /etc/sysctl.conf
fi

# If the hassio_supervisor service is running or exists, stop it
if [[ "$(systemctl is-active hassio-supervisor.service)" == "active" ]]; then
info "Stopping hassio_supervisor service"
systemctl stop hassio-supervisor.service
fi

# If the hassio_apparmor service is running or exists, stop it
if [[ "$(systemctl is-active hassio-apparmor.service)" == "active" ]]; then
info "Stopping hassio_apparmor service"
systemctl stop hassio-apparmor.service
fi

# Check for existing hassio_supervisor container and destroy it
if [[ "$(docker ps -aq -f name=hassio_supervisor)" ]]; then
# ensure the hassio_supervisor service is stopped
info "Removing existing hassio_supervisor container"
docker container rm --force hassio_supervisor > /dev/null
fi

dpkg-divert --package homeassistant-supervised --add --rename \
--divert /etc/NetworkManager/NetworkManager.conf.real /etc/NetworkManager/NetworkManager.conf
Expand Down