diff --git a/debian/changelog b/debian/changelog index 4968b14..acd59b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,8 +4,10 @@ nut (2.7.2-2) UNRELEASED; urgency=medium * debian/rules: Revert the changes made in the previous NMU, I don't think that dropping the .service file that late in the release cycle is a good idea and anyway this was causing left-over files on upgrade. + * Add wrappers that check the MODE in /etc/nut/nut.conf to avoid starting + the daemons if nut is not configured (Closes: #747863). - -- Laurent Bigonville Sun, 25 Jan 2015 12:47:47 +0100 + -- Laurent Bigonville Sun, 25 Jan 2015 12:53:03 +0100 nut (2.7.2-1.1) unstable; urgency=medium diff --git a/debian/local/upsd b/debian/local/upsd new file mode 100755 index 0000000..5e4d2a4 --- /dev/null +++ b/debian/local/upsd @@ -0,0 +1,19 @@ +#!/bin/sh + +# Include NUT nut.conf +[ -r /etc/nut/nut.conf ] && . /etc/nut/nut.conf + +case "$MODE" in + standalone|netserver) + exec /lib/nut/upsd "$@" + ;; + none|netclient) + echo "upsd disabled, please adjust the configuration to your needs" + echo "Then set MODE to a suitable value in /etc/nut/nut.conf to enable it" + # exit success to avoid breaking the install process! + exit 0 + ;; + *) + exit 1 + ;; +esac diff --git a/debian/local/upsmon b/debian/local/upsmon new file mode 100755 index 0000000..a9f6d1b --- /dev/null +++ b/debian/local/upsmon @@ -0,0 +1,19 @@ +#!/bin/sh + +# Include NUT nut.conf +[ -r /etc/nut/nut.conf ] && . /etc/nut/nut.conf + +case "$MODE" in + standalone|netserver|netclient) + exec /lib/nut/upsmon "$@" + ;; + none) + echo "upsmon disabled, please adjust the configuration to your needs" + echo "Then set MODE to a suitable value in /etc/nut/nut.conf to enable it" + # exit success to avoid breaking the install process! + exit 0 + ;; + *) + exit 1 + ;; +esac diff --git a/debian/nut-client.install b/debian/nut-client.install index b899f84..e9e32e4 100644 --- a/debian/nut-client.install +++ b/debian/nut-client.install @@ -3,6 +3,7 @@ debian/tmp/bin/upsc debian/tmp/bin/upsrw debian/tmp/bin/upscmd debian/tmp/sbin/upsmon +debian/tmp/lib/nut/upsmon debian/tmp/sbin/upssched debian/tmp/bin/upssched-cmd debian/tmp/etc/nut/nut.conf diff --git a/debian/nut-server.install b/debian/nut-server.install index 8b67a85..bbc50da 100644 --- a/debian/nut-server.install +++ b/debian/nut-server.install @@ -1,4 +1,5 @@ debian/tmp/sbin/upsd +debian/tmp/lib/nut/upsd debian/tmp/sbin/upsdrvctl debian/tmp/usr/share/nut/cmdvartab debian/tmp/usr/share/nut/driver.list diff --git a/debian/rules b/debian/rules index b169acd..c667da4 100755 --- a/debian/rules +++ b/debian/rules @@ -77,6 +77,12 @@ common-install-arch:: ln -s /lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.4 \ $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so + # Move daemons and install wrappers + mv $(CURDIR)/debian/tmp/sbin/upsmon $(CURDIR)/debian/tmp/lib/nut/upsmon + mv $(CURDIR)/debian/tmp/sbin/upsd $(CURDIR)/debian/tmp/lib/nut/upsd + install -m 0755 debian/local/upsmon $(CURDIR)/debian/tmp/sbin/upsmon + install -m 0755 debian/local/upsd $(CURDIR)/debian/tmp/sbin/upsd + # Install systemd files only on systems where it's supported ifeq (linux,$(DEB_HOST_ARCH_OS)) install -m 644 -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system/nut-monitor.service \