Re: systemd service fails by default and causes package install failure
Le Tue, 10 Feb 2015 23:05:01 +0100,
Julien Cristau <[email protected]> a écrit :
> On Tue, Feb 10, 2015 at 00:21:53 +0100, Laurent Bigonville wrote:
[...]
> >
> > What would be the opinion of the RT about this change?
> >
> We (or at least I) prefer to see proposed changes in the mail to
> having to look them up.
Sure, I've attached the diff between the version currently in the
archive and my proposed change.
Cheers,
Laurent Bigonville
diff --git a/debian/changelog b/debian/changelog
index f8ba3fa..acd59b2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+nut (2.7.2-2) UNRELEASED; urgency=medium
+
+ * debian/gbp.conf: Switch to debian-jessie branch
+ * 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 <[email protected]> Sun, 25 Jan 2015 12:53:03 +0100
+
nut (2.7.2-1.1) unstable; urgency=medium
* Non-maintainer upload.
diff --git a/debian/gbp.conf b/debian/gbp.conf
index 6837223..2e63610 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -1,5 +1,5 @@
[DEFAULT]
-debian-branch = debian
+debian-branch = debian-jessie
upstream-branch = upstream
pristine-tar = True
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 084af15..c667da4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -77,10 +77,14 @@ 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
- # disabled in Ubuntu until the unit gets fixed to check nut.conf
- # disabled in Debian Jessie to retain sysvinit support until fix is available
-ifeq (linux-disabled,$(DEB_HOST_ARCH_OS))
+ifeq (linux,$(DEB_HOST_ARCH_OS))
install -m 644 -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system/nut-monitor.service \
$(CURDIR)/debian/nut-client/lib/systemd/system/nut-monitor.service
install -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system-shutdown/nutshutdown \
Reply to: