Commit 70fe330c authored by Mathieu Mirmont's avatar Mathieu Mirmont

opendnssec-*.init: use do_restart_prepare from init-d-script

The new init-d-script from sysvinit 2.93-7 supports a
do_restart_prepare handler (see #920847). We need this handler to
prevent the daemons from starting up when the init scripts are invoked
with the "restart" argument, which is the case on package upgrades.

Note that this is safe (no-op) on previous versions of sysvinit that
do not support this handler.
parent 50619381
Pipeline #38043 passed with stages
in 17 minutes and 16 seconds
......@@ -18,9 +18,6 @@ DAEMON=/usr/sbin/ods-enforcerd
DESC="OpenDNSSEC Enforcer"
PIDFILE=/run/opendnssec/enforcerd.pid
# Read configuration variable file if it is present
[ -r /etc/default/opendnssec ] && . /etc/default/opendnssec
do_tmpfiles() {
local type path mode user group
......@@ -35,13 +32,21 @@ do_tmpfiles() {
fi
}
do_start_prepare() {
do_tmpfiles "$(basename "$0")"
DAEMON_ARGS="$DAEMON_ARGS $ODS_ENFORCERD_OPT"
check_service_disabled()
{
# Prevent startup if this file exists
if [ -e /etc/opendnssec/prevent-startup ]; then
log_action_msg "Not starting $DESC (/etc/opendnssec/prevent-startup)"
log_action_msg "Service $DESC is disabled (/etc/opendnssec/prevent-startup)"
exit 0
fi
}
do_start_prepare() {
check_service_disabled
do_tmpfiles "$(basename "$0")"
DAEMON_ARGS="$DAEMON_ARGS $ODS_ENFORCERD_OPT"
}
do_restart_prepare() {
do_start_prepare "$@"
}
......@@ -32,13 +32,21 @@ do_tmpfiles() {
fi
}
do_start_prepare() {
do_tmpfiles "$(basename "$0")"
DAEMON_ARGS="$DAEMON_ARGS $ODS_SIGNERD_OPT"
check_service_disabled()
{
# Prevent startup if this file exists
if [ -e /etc/opendnssec/prevent-startup ]; then
log_action_msg "Not starting $DESC (/etc/opendnssec/prevent-startup)"
log_action_msg "Service $DESC is disabled (/etc/opendnssec/prevent-startup)"
exit 0
fi
}
do_start_prepare() {
check_service_disabled
do_tmpfiles "$(basename "$0")"
DAEMON_ARGS="$DAEMON_ARGS $ODS_SIGNERD_OPT"
}
do_restart_prepare() {
do_start_prepare "$@"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment