Really fix package initial installation when PID1 is systemd (Closes: #747863)

This commit is contained in:
Laurent Bigonville 2015-03-15 11:14:01 +01:00
parent 64e656ba48
commit 5dc71af109
6 changed files with 53 additions and 2 deletions

7
debian/changelog vendored
View file

@ -1,3 +1,10 @@
nut (2.7.2-4) UNRELEASED; urgency=medium
* Really fix package initial installation when PID1 is systemd (Closes:
#747863)
-- Laurent Bigonville <bigon@debian.org> Fri, 20 Mar 2015 00:44:01 +0100
nut (2.7.2-3) unstable; urgency=medium nut (2.7.2-3) unstable; urgency=medium
* debian/NEWS: Fix NEWS file syntax * debian/NEWS: Fix NEWS file syntax

View file

@ -1,5 +1,16 @@
#!/bin/sh -e #!/bin/sh -e
handle_start_failure () {
# The nut client part (upsmon) must run in all cases except when MODE in
# /etc/nut/nut.conf is set to "none" or not set at all.
[ -r /etc/nut/nut.conf ] && . /etc/nut/nut.conf
if [ -d /run/systemd/system ] && [ "$MODE" = "none" -o -z "$MODE" ]; then
return 0
else
return 1
fi
}
case "$1" in case "$1" in
configure) configure)

13
debian/nut-client.prerm vendored Normal file
View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e
handle_start_failure () {
# The MODE defined in /etc/nut/nut.conf shouldn't affect the exit code when the
# daemon is stopped. If it fails to stop, the maintainer script should fail
# too.
return 1
}
#DEBHELPER#
exit 0

View file

@ -1,5 +1,18 @@
#!/bin/sh -e #!/bin/sh -e
handle_start_failure () {
# The nut server part (upsd) must run in all cases except when MODE in
# /etc/nut/nut.conf is set to "none", not set at all or if the machine is a
# client.
[ -r /etc/nut/nut.conf ] && . /etc/nut/nut.conf
if [ -d /run/systemd/system ] \
&& [ "$MODE" = "none" -o "$MODE" = "netclient" -o -z "$MODE" ]; then
return 0
else
return 1
fi
}
case "$1" in case "$1" in
configure) configure)

View file

@ -4,6 +4,13 @@
# because we don't want the daemon to be # because we don't want the daemon to be
# stopped during an upgrade # stopped during an upgrade
handle_start_failure () {
# The MODE defined in /etc/nut/nut.conf shouldn't affect the exit code when the
# daemon is stopped. If it fails to stop, the maintainer script should fail
# too.
return 1
}
case "$1" in case "$1" in
remove) remove)

4
debian/rules vendored
View file

@ -119,8 +119,8 @@ common-install-indep::
binary-install/nut-monitor:: binary-install/nut-monitor::
dh_python2 -pnut-monitor dh_python2 -pnut-monitor
DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server --restart-after-upgrade DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server --restart-after-upgrade --error-handler=handle_start_failure
DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client --restart-after-upgrade DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client --restart-after-upgrade --error-handler=handle_start_failure
DEB_DH_SYSTEMD_START_ARGS_nut-server := --restart-after-upgrade DEB_DH_SYSTEMD_START_ARGS_nut-server := --restart-after-upgrade
DEB_DH_SYSTEMD_START_ARGS_nut-client := --restart-after-upgrade DEB_DH_SYSTEMD_START_ARGS_nut-client := --restart-after-upgrade
DEB_DH_COMPRESS_ARGS_nut-doc := -X.pdf DEB_DH_COMPRESS_ARGS_nut-doc := -X.pdf