From 9012b46ee17c27ed73d1b305302cdb4f97a4b5d9 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 10 Jul 2016 12:00:46 +0100 Subject: [PATCH] Make the lighttpd enable/disable a bit more automatic. --- debian/dump1090-mutability.postinst | 8 ++++++++ debian/dump1090-mutability.postrm | 15 ++++++++++++--- debian/dump1090-mutability.templates | 11 ++++++++++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/debian/dump1090-mutability.postinst b/debian/dump1090-mutability.postinst index 244679f..5038c52 100644 --- a/debian/dump1090-mutability.postinst +++ b/debian/dump1090-mutability.postinst @@ -116,6 +116,14 @@ case "$1" in touch $RET chown $RUNAS $RET + # enable lighttpd if needed + db_get $NAME/use-lighttpd + if [ "$RET" = "true" -a -x /usr/sbin/lighty-enable-mod ] + then + echo "Enabling lighttpd integration.." >&2 + /usr/sbin/lighty-enable-mod dump1090 || true + fi + # this config file has changed a few times, restart lighttpd to make sure we # have the latest version if [ -e /etc/lighttpd/conf-enabled/89-dump1090.conf ]; then diff --git a/debian/dump1090-mutability.postrm b/debian/dump1090-mutability.postrm index f5405fa..6251a8f 100644 --- a/debian/dump1090-mutability.postrm +++ b/debian/dump1090-mutability.postrm @@ -24,10 +24,19 @@ case "$1" in rm -f /etc/default/dump1090-mutability rm -f /etc/cron.d/dump1090-mutability rm -rf /var/cache/dump1090-mutability - ;; + ;; - remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; + remove) + if [ -e /etc/lighttpd/conf-enabled/89-dump1090.conf ]; then + echo "Disabling lighttpd integration.." >&2 + lighty-disable-mod dump1090 || true + echo "Restarting lighttpd.." >&2 + invoke-rc.d lighttpd restart || echo "Warning: lighttpd failed to restart." >&2 + fi + ;; + + upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; *) echo "postrm called with unknown argument \`$1'" >&2 diff --git a/debian/dump1090-mutability.templates b/debian/dump1090-mutability.templates index 19762d2..fc9929e 100644 --- a/debian/dump1090-mutability.templates +++ b/debian/dump1090-mutability.templates @@ -186,13 +186,22 @@ Description: Interval between logging stats, in seconds: Type: string Default: 3600 +Template: dump1090-mutability/use-lighttpd +Description: Enable the lighttpd integration? + dump1090 can serve a virtual radar map via a separate webserver. + This package includes a configuration for lighttpd that does this. + To use that configuration, enable this option. +Type: boolean +Default: true + Template: dump1090-mutability/json-dir Description: Directory to write JSON aircraft state to: As this can be written frequently, you should select a location that is not on a sdcard. The default path under /run is on tmpfs and will not write to the sdcard. . - A blank path disables writing JSON state. + A blank path disables writing JSON state. This will also disable + the virtual radar map. Type: string Default: /run/dump1090-mutability