From cfb02c1a7c5274cf2240ba36d9acab618a3359d1 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Thu, 22 Sep 2016 16:45:28 +0100 Subject: [PATCH] Try to avoid conflicting with other lighttpd config that touches the stat cache settings. --- debian/dump1090-fa.postinst | 9 +++++++++ debian/dump1090-fa.postrm | 18 ++++++++++++++++-- debian/lighttpd/88-dump1090-fa-statcache.conf | 4 ++++ debian/lighttpd/89-dump1090-fa.conf | 5 ----- 4 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 debian/lighttpd/88-dump1090-fa-statcache.conf diff --git a/debian/dump1090-fa.postinst b/debian/dump1090-fa.postinst index a2c430e..8bb872d 100644 --- a/debian/dump1090-fa.postinst +++ b/debian/dump1090-fa.postinst @@ -34,6 +34,15 @@ case "$1" in # set up lighttpd echo "Enabling lighttpd integration.." >&2 lighty-enable-mod dump1090-fa || true + + # only enable the statcache config if there is nothing else around that already + # configures it, because lighttpd fails if it's configured twice + if ! grep -q -E '^\S*server.stat-cache-engine' /etc/lighttpd/conf-enabled/*.conf + then + echo "Enabling lighttpd integration (stat cache).." >&2 + lighty-enable-mod dump1090-fa-statcache || true + fi + echo "Restarting lighttpd.." >&2 invoke-rc.d lighttpd restart || true ;; diff --git a/debian/dump1090-fa.postrm b/debian/dump1090-fa.postrm index ca0b0e9..39182bc 100644 --- a/debian/dump1090-fa.postrm +++ b/debian/dump1090-fa.postrm @@ -25,9 +25,23 @@ case "$1" in ;; remove) - if [ -e /etc/lighttpd/conf-enabled/89-dump1090.conf ]; then + changed=false + if [ -e /etc/lighttpd/conf-enabled/89-dump1090-fa.conf ] + then echo "Disabling lighttpd integration.." >&2 - lighty-disable-mod dump1090 || true + lighty-disable-mod dump1090-fa || true + changed=true + fi + + if [ -e /etc/lighttpd/conf-enabled/88-dump1090-fa-statcache.conf ] + then + echo "Disabling lighttpd integration (stat cache).." >&2 + lighty-disable-mod dump1090-fa-statcache || true + changed=true + fi + + if $changed + then echo "Restarting lighttpd.." >&2 invoke-rc.d lighttpd restart || echo "Warning: lighttpd failed to restart." >&2 fi diff --git a/debian/lighttpd/88-dump1090-fa-statcache.conf b/debian/lighttpd/88-dump1090-fa-statcache.conf new file mode 100644 index 0000000..1f85e34 --- /dev/null +++ b/debian/lighttpd/88-dump1090-fa-statcache.conf @@ -0,0 +1,4 @@ +# The stat cache must be disabled, as aircraft.json changes +# frequently and lighttpd's stat cache often ends up with the +# wrong content length. +server.stat-cache-engine = "disable" diff --git a/debian/lighttpd/89-dump1090-fa.conf b/debian/lighttpd/89-dump1090-fa.conf index f5d93fb..bf02c6e 100644 --- a/debian/lighttpd/89-dump1090-fa.conf +++ b/debian/lighttpd/89-dump1090-fa.conf @@ -7,11 +7,6 @@ alias.url += ( "/dump1090-fa/" => "/usr/share/dump1090-fa/html/" ) -# The stat cache must be disabled, as aircraft.json changes -# frequently and lighttpd's stat cache often ends up with the -# wrong content length. -server.stat-cache-engine = "disable" - # Listen on port 8080 and emit 301s pointing to port 80 # to support the old convention of the map being on 8080 $SERVER["socket"] == ":8080" {