Cleanup container and stop services before installing (#343)
This commit is contained in:
parent
13ffd23c36
commit
77d549776c
2 changed files with 20 additions and 0 deletions
|
@ -19,6 +19,9 @@ URL_VERSION="https://version.home-assistant.io/stable.json"
|
||||||
HASSIO_VERSION=$(curl -s ${URL_VERSION} | jq -e -r '.supervisor')
|
HASSIO_VERSION=$(curl -s ${URL_VERSION} | jq -e -r '.supervisor')
|
||||||
URL_APPARMOR_PROFILE="https://version.home-assistant.io/apparmor.txt"
|
URL_APPARMOR_PROFILE="https://version.home-assistant.io/apparmor.txt"
|
||||||
|
|
||||||
|
# reload systemd
|
||||||
|
info "Reload systemd"
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
# Restart NetworkManager
|
# Restart NetworkManager
|
||||||
info "Restarting NetworkManager"
|
info "Restarting NetworkManager"
|
||||||
|
|
|
@ -51,7 +51,24 @@ 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
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue