From 14c458db8c38e6bd22a7d1471e0fdb1728dd583a Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Tue, 12 Mar 2019 11:39:05 +0000 Subject: [PATCH] Add an ENABLED line to /etc/default/dump1090-fa on upgrade if missing --- debian/dump1090-fa.postinst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/debian/dump1090-fa.postinst b/debian/dump1090-fa.postinst index 8c58aa7..d533ccf 100644 --- a/debian/dump1090-fa.postinst +++ b/debian/dump1090-fa.postinst @@ -49,6 +49,20 @@ case "$1" in fi fi + # on upgrade, add an ENABLED line if it's not already present + if dpkg --compare-versions "$2" lt-nl "3.7.0" + then + if [ -f /etc/default/dump1090-fa ] + then + if ! grep -q -E '^ENABLED=' /etc/default/dump1090-fa + then + echo "Setting ENABLED=yes in /etc/default/dump1090-fa.." >&2 + echo "# Automatically added by upgrade from $2" >>/etc/default/dump1090-fa + echo "ENABLED=yes" >>/etc/default/dump1090-fa + fi + fi + fi + echo "Restarting lighttpd.." >&2 invoke-rc.d lighttpd restart || true ;;