Skip to content

Commit

Permalink
Fix issues with diversion removal on install/upgrade (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
pssc authored Oct 27, 2021
1 parent a13eda0 commit ab687fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion homeassistant-supervised/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: homeassistant-supervised
Section: base
Version: 1.0.0
Version: 1.0.1
Priority: optional
Architecture: all
Depends: curl, bash, docker-ce, dbus, network-manager, apparmor, jq, systemd, os-agent
Expand Down
20 changes: 15 additions & 5 deletions homeassistant-supervised/DEBIAN/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@ function info { echo -e "\e[32m[info] $*\e[39m"; }
function warn { echo -e "\e[33m[warn] $*\e[39m"; }
function error { echo -e "\e[31m[error] $*\e[39m"; exit 1; }


# Undo diversions
dpkg-divert --package homeassistant-supervised --remove --rename \
function undo_divert () {
dpkg-divert --package homeassistant-supervised --remove --rename \
--divert /etc/NetworkManager/NetworkManager.conf.real /etc/NetworkManager/NetworkManager.conf

dpkg-divert --package homeassistant-supervised --remove --rename \
dpkg-divert --package homeassistant-supervised --remove --rename \
--divert /etc/NetworkManager/system-connections/default.real /etc/NetworkManager/system-connections/default

dpkg-divert --package homeassistant-supervised --remove --rename \
dpkg-divert --package homeassistant-supervised --remove --rename \
--divert /etc/docker/daemon.json.real /etc/docker/daemon.json

dpkg-divert --package homeassistant-supervised --remove --rename \
--divert /etc/network/interfaces.real /etc/network/interfaces
dpkg-divert --package homeassistant-supervised --remove --rename \
--divert /etc/network/interfaces.real /etc/network/interfaces
}

case "$1" in
remove|abort-install|disappear)
info Undo divert on "$@"
undo_divert
;;
esac

0 comments on commit ab687fd

Please sign in to comment.