Thilo Six schrieb/wrote: -- <snip> --
>>> for the purpose you described this line can be dropped completely IMHO. >>> The following line in the init script already has: >>> >>> test -x $DAEMON || exit 0 -- <snip> -- >> The problem that this code is trying to solve is the case when both >> packages are installed, then just dnsmasq is removed. At this point >> dnsmasq should not be started at boot time, but the binary still exists >> (since dnsmasq-base is still installed.) >> >> That explains why the code looks at /etc/dnsmasq.d/README since that's >> installed by the dnsmasq package and isn't a conffile. SO when the >> dnsmasq package is removed /etc/dnsmasq.d/README is removed. Conditions we want to track: * installation state of deb 'dnsmasq', better yet: deb 'dnsmasq' = removed (not purged) deb 'dnsmasq-base' = installed * better not use '/etc/dnsmasq.d/README' as flag for that as it could be erased by local admin for what ever reason (a README, is a README...) The attached patch has been successfully tested to meet this conditions. Additionally this patch fixes syntax highlighting of the init script in Vim. kind regards, Thilo
--- etc-init.d-dnsmasq.orig 2016-04-30 15:36:51.189052127 +0000 +++ etc-init.d-dnsmasq 2016-04-30 15:35:36.451688365 +0000 @@ -7,9 +7,10 @@ # Default-Stop: 0 1 6 # Description: DHCP and DNS server ### END INIT INFO -set +e # Don't exit on error status +# Don't exit on error status +set +e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/dnsmasq NAME=dnsmasq @@ -28,13 +29,11 @@ . /etc/default/locale export LANG fi -# /etc/dnsmasq.d/README is a non-conffile installed by the dnsmasq package. -# Should the dnsmasq package be removed, the following test ensures that -# the daemon is no longer started, even if the dnsmasq-base package is -# still in place. -test -e /etc/dnsmasq.d/README || exit 0 +# The following test ensures the dnsmasq service is not started, when the +# package 'dnsmasq' is removed but not purged: +test -d /usr/share/doc/dnsmasq || exit 0 test -x $DAEMON || exit 0 # Provide skeleton LSB log functions for backports which don't have LSB functions.