Ensure Services are stopped and old container is destroyed

This commit is contained in:
Matheson Steplock 2023-12-17 23:52:04 -05:00 committed by GitHub
parent 8f0a7f3808
commit 1839b35051
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,7 +51,30 @@ if [[ "$(sysctl --values kernel.dmesg_restrict)" != "0" ]]; then
echo "kernel.dmesg_restrict=0" >> /etc/sysctl.conf echo "kernel.dmesg_restrict=0" >> /etc/sysctl.conf
fi 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
# If docker is running, stop it
if [[ "$(systemctl is-active docker.service)" == "active" ]]; then
info "Stopping Docker service"
systemctl stop docker.service
fi
dpkg-divert --package homeassistant-supervised --add --rename \ dpkg-divert --package homeassistant-supervised --add --rename \
--divert /etc/NetworkManager/NetworkManager.conf.real /etc/NetworkManager/NetworkManager.conf --divert /etc/NetworkManager/NetworkManager.conf.real /etc/NetworkManager/NetworkManager.conf