Really fix package initial installation when PID1 is systemd (Closes: #747863)
This commit is contained in:
parent
64e656ba48
commit
5dc71af109
6 changed files with 53 additions and 2 deletions
7
debian/changelog
vendored
7
debian/changelog
vendored
|
@ -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
|
||||
|
||||
* debian/NEWS: Fix NEWS file syntax
|
||||
|
|
11
debian/nut-client.postinst
vendored
11
debian/nut-client.postinst
vendored
|
@ -1,5 +1,16 @@
|
|||
#!/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
|
||||
|
||||
configure)
|
||||
|
|
13
debian/nut-client.prerm
vendored
Normal file
13
debian/nut-client.prerm
vendored
Normal 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
|
13
debian/nut-server.postinst
vendored
13
debian/nut-server.postinst
vendored
|
@ -1,5 +1,18 @@
|
|||
#!/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
|
||||
|
||||
configure)
|
||||
|
|
7
debian/nut-server.prerm
vendored
7
debian/nut-server.prerm
vendored
|
@ -4,6 +4,13 @@
|
|||
# because we don't want the daemon to be
|
||||
# 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
|
||||
|
||||
remove)
|
||||
|
|
4
debian/rules
vendored
4
debian/rules
vendored
|
@ -119,8 +119,8 @@ common-install-indep::
|
|||
binary-install/nut-monitor::
|
||||
dh_python2 -pnut-monitor
|
||||
|
||||
DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server --restart-after-upgrade
|
||||
DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client --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 --error-handler=handle_start_failure
|
||||
DEB_DH_SYSTEMD_START_ARGS_nut-server := --restart-after-upgrade
|
||||
DEB_DH_SYSTEMD_START_ARGS_nut-client := --restart-after-upgrade
|
||||
DEB_DH_COMPRESS_ARGS_nut-doc := -X.pdf
|
||||
|
|
Loading…
Reference in a new issue