diff --git a/debian/changelog b/debian/changelog index a66b5f5..e7b612b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,61 @@ +nut (2.6.4-2.3) unstable; urgency=low + + * Non-maintainer upload with fixes for wheezy. + * debian/nut-client.preinst: also revert /etc/nut/nut.conf mangling done + by postinst during upgrade from lenny to squeeze (Really closes: #677054) + Thanks to Andreas Beckmann for the review. + + -- Ivo De Decker Sat, 26 Jan 2013 20:09:48 +0100 + +nut (2.6.4-2.2) unstable; urgency=low + + * Non-maintainer upload with fixes for wheezy. + * Only remove /etc/init.d/nut from previous versions of nut in nut-server + postinst if there are no local changes. + * Also remove /etc/init.d/nut in nut-client postinst. Thanks to + Laurent Bigonville for the hint. + * Only fix permissions of configfiles on first install. + * debian/control: Fix typo in package description. Thanks to Julien Cristau + for spotting this. + + -- Ivo De Decker Thu, 20 Dec 2012 20:40:01 +0100 + +nut (2.6.4-2.1) unstable; urgency=low + + * Non-maintainer upload. + * debian/nut-client.preinst: revert /etc/nut/nut.conf mangling done by older + versions of the postinst (Closes: #677054) + + -- Sébastien Villemot Mon, 26 Nov 2012 21:09:33 +0100 + +nut (2.6.4-2) unstable; urgency=low + + * debian/rules: Stop the nut-client before nut-server on systems using static + boot ordering (Closes: #679451) + * debian/nut-server.postinst: Remove /etc/init.d/nut on upgrade + (Closes: #677822) + * Rename nut-server.lintian-overrides to nut-client.lintian-overrides and + adjust overrides now that ups-monitor is shipped in nut-client package + (Closes: #677947) + * Add debian/patches/0001-fix-upsmon-regression.patch: Fix upsmon/upssched + regression (Taken from upstream) (Closes: #679513) + * Move nut metapackage to Section: metapackages + * Also create nut user when installing nut-client package and do not delete + it on purge anymore (Closes: #682000) + * Drop /etc/default/nut → /etc/nut/nut.conf migration code, migration + happends before squeeze release and this was against policy to have a + maintainer script modifying a conffile in the first place (Closes: #684392) + * Add dependency against adduser and lsb-base on nut-client package + * Be sure that client is stopped before the server also when using + dependencies based boot + * Fix package descriptions (Closes: #678068) + * Also install /bin/upssched-cmd in nut-client package as this script is + referenced in default upssched.conf config file + * debian/watch: Update watch file + * Be sure that all maintainer scripts are returning 0 at their end + + -- Laurent Bigonville Sun, 12 Aug 2012 20:38:52 +0200 + nut (2.6.4-1) unstable; urgency=high * New upstream release (Closes: #671444) diff --git a/debian/control b/debian/control index dbf99d7..63e772e 100644 --- a/debian/control +++ b/debian/control @@ -24,6 +24,7 @@ X-Python-Version: >= 2.5 Package: nut Architecture: all +Section: metapackages Depends: ${misc:Depends}, nut-server, nut-client Description: network UPS tools - metapackage Network UPS Tools (NUT) is a client/server monitoring system that @@ -32,7 +33,8 @@ Description: network UPS tools - metapackage through the server, and are notified whenever the power status changes. . - This package is a metapackage that install both nut-server and nut-client + This package is a metapackage that installs both nut-server and nut-client, + in most cases it is sufficient for a basic UPS monitoring system. Package: nut-server Architecture: any @@ -50,12 +52,11 @@ Description: network UPS tools - core system changes. . This package provides NUT's core system, and the serial and USB UPS - drivers. In most cases it is sufficient for a basic UPS monitoring - system. + drivers. Package: nut-client Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6) Provides: ups-monitor Conflicts: ups-monitor, nut-server (<< 2.6.3-1) Recommends: bash-completion diff --git a/debian/gbp.conf b/debian/gbp.conf index 6837223..d91ad90 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -1,6 +1,6 @@ [DEFAULT] -debian-branch = debian -upstream-branch = upstream +debian-branch = debian-wheezy +upstream-branch = upstream-wheezy pristine-tar = True [git-buildpackage] diff --git a/debian/nut-cgi.postrm b/debian/nut-cgi.postrm index bdfecf0..91be66d 100644 --- a/debian/nut-cgi.postrm +++ b/debian/nut-cgi.postrm @@ -44,3 +44,4 @@ esac #DEBHELPER# +exit 0 diff --git a/debian/nut-client.install b/debian/nut-client.install index cde4bd7..b4b7d7f 100644 --- a/debian/nut-client.install +++ b/debian/nut-client.install @@ -4,6 +4,7 @@ debian/tmp/bin/upsrw debian/tmp/bin/upscmd debian/tmp/sbin/upsmon debian/tmp/sbin/upssched +debian/tmp/bin/upssched-cmd debian/tmp/etc/bash_completion.d/nut debian/tmp/etc/nut/nut.conf debian/tmp/etc/nut/upsmon.conf diff --git a/debian/nut-client.lintian-overrides b/debian/nut-client.lintian-overrides new file mode 100644 index 0000000..4651289 --- /dev/null +++ b/debian/nut-client.lintian-overrides @@ -0,0 +1 @@ +nut-client: script-in-etc-init.d-not-registered-via-update-rc.d diff --git a/debian/nut-client.postinst b/debian/nut-client.postinst new file mode 100644 index 0000000..869752e --- /dev/null +++ b/debian/nut-client.postinst @@ -0,0 +1,76 @@ +#!/bin/sh -e + +case "$1" in + + configure) + + # make sure the nut user exists and has correct memberships + if ! getent group nut >/dev/null; then + addgroup --quiet --system nut + fi + if ! getent passwd nut >/dev/null; then + adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut + elif ! groups nut | grep -qw nut; then + adduser nut nut + fi +# for Ubuntu, while waiting for a proper debconf +# if ! groups nut | grep -qw dialout; then +# adduser nut dialout +# fi + + # make sure that conffiles are secured and have the correct ownerships + # on first install + if [ -z "$2" ] ; then + if [ -d /etc/nut/ ] ; then + chown root:nut /etc/nut/ + fi + for file in nut.conf upsmon.conf upssched.conf ; do + if [ -f /etc/nut/$file ] ; then + chown root:nut /etc/nut/$file + chmod 640 /etc/nut/$file + fi + done + fi + + # make sure that /var/run/nut exists and has the correct ownerships + if [ ! -d /var/run/nut ] ; then + mkdir -p /var/run/nut + fi + if [ -d /var/run/nut ] ; then + chown root:nut /var/run/nut + chmod 770 /var/run/nut + fi + + if dpkg --compare-versions "$2" le "2.6.4-2~" && + [ -f /etc/init.d/nut ] ; then + if [ "`md5sum /etc/init.d/nut | cut -d ' ' -f 1`" = 72f1dbc6b92cb4407f26605d05b12681 ]; then + rm -f /etc/init.d/nut + else + mv /etc/init.d/nut /etc/init.d/nut.dpkg-old + fi + update-rc.d nut remove >/dev/null + fi + ;; + + abort-upgrade) + # do nothing + ;; + + abort-remove) + # do nothing + ;; + + abort-deconfigure) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/nut-client.preinst b/debian/nut-client.preinst new file mode 100644 index 0000000..53134e3 --- /dev/null +++ b/debian/nut-client.preinst @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +# Revert /etc/nut/nut.conf mangling done by older versions of the postinst +# See #677054 +# changed configfile created by a fresh install in lenny, upgraded to squeeze +if [ "$1" = "install" -o "$1" = "upgrade" ] \ + && dpkg --compare-versions "$2" lt "2.6.4-2" \ + && [ -f /etc/nut/nut.conf ] \ + && [ "`md5sum /etc/nut/nut.conf | cut -d ' ' -f 1`" = 331cca39153f451c2968f4b734c1cf3f ]; then + sed -i '29,$ d' /etc/nut/nut.conf +fi + +# changed configfile created by a fresh install in squeeze +if [ "$1" = "install" -o "$1" = "upgrade" ] \ + && dpkg --compare-versions "$2" lt "2.6.4-2" \ + && [ -f /etc/nut/nut.conf ] \ + && [ "`md5sum /etc/nut/nut.conf | cut -d ' ' -f 1`" = f9b571ae65952e3a761fac2202633478 ]; then + sed -i 's/^MODE=none$/MODE = none/' /etc/nut/nut.conf +fi + +#DEBHELPER# diff --git a/debian/nut-server.init b/debian/nut-server.init index 5505be4..a606b72 100644 --- a/debian/nut-server.init +++ b/debian/nut-server.init @@ -2,7 +2,7 @@ ### BEGIN INIT INFO # Provides: nut-server upsd # Required-Start: $local_fs $syslog $network $remote_fs udev -# Required-Stop: $local_fs $syslog $network $remote_fs udev nut-client +# Required-Stop: $local_fs $syslog $network $remote_fs udev # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Network UPS Tools initscript diff --git a/debian/nut-server.lintian-overrides b/debian/nut-server.lintian-overrides deleted file mode 100644 index 9618794..0000000 --- a/debian/nut-server.lintian-overrides +++ /dev/null @@ -1,2 +0,0 @@ -nut-server: script-in-etc-init.d-not-registered-via-update-rc.d -nut-server: init.d-script-does-not-provide-itself etc/init.d/ups-monitor diff --git a/debian/nut-server.postinst b/debian/nut-server.postinst index a91caab..45a3a44 100644 --- a/debian/nut-server.postinst +++ b/debian/nut-server.postinst @@ -19,15 +19,18 @@ case "$1" in # fi # make sure that conffiles are secured and have the correct ownerships - if [ -d /etc/nut/ ] ; then - chown root:nut /etc/nut/ - fi - for file in nut.conf ups.conf upsd.conf upsmon.conf upsd.users upssched.conf ; do - if [ -f /etc/nut/$file ] ; then - chown root:nut /etc/nut/$file - chmod 640 /etc/nut/$file + # on first install + if [ -z "$2" ] ; then + if [ -d /etc/nut/ ] ; then + chown root:nut /etc/nut/ fi - done + for file in ups.conf upsd.conf upsd.users ; do + if [ -f /etc/nut/$file ] ; then + chown root:nut /etc/nut/$file + chmod 640 /etc/nut/$file + fi + done + fi # make sure that /var/run/nut exists and has the correct ownerships if [ ! -d /var/run/nut ] ; then @@ -50,67 +53,14 @@ case "$1" in # 557178 udevadm trigger --subsystem-match=usb - # migrate /etc/default/nut to /etc/nut/nut.conf (part #2) - if dpkg --compare-versions "$2" lt-nl "2.4.1-2" ; then - # source the temporary /etc/default/nut.bak file - if [ -f /etc/default/nut.bak ] ; then - . /etc/default/nut.bak - - # FIXME: use a template (and debconf to output?) - echo "migrating /etc/default/nut to /etc/nut/nut.conf" - - # pre process the config - case "$START_UPSD" in - y|Y|yes|YES|Yes) - START_UPSD=yes - ;; - *) - START_UPSD=no - ;; - esac - case "$START_UPSMON" in - y|Y|yes|YES|Yes) - START_UPSMON=yes - ;; - *) - START_UPSMON=no - ;; - esac - - # now process the result - if [ "x$START_UPSD" = "xyes" ] ; then - if [ "x$START_UPSMON" = "xyes" ] ; then - # can also be netserver - NUT_MODE=standalone - #else not processed since it should be an error! - fi + if dpkg --compare-versions "$2" le "2.6.4-2~" && + [ -f /etc/init.d/nut ] ; then + if [ "`md5sum /etc/init.d/nut | cut -d ' ' -f 1`" = 72f1dbc6b92cb4407f26605d05b12681 ]; then + rm -f /etc/init.d/nut else - if [ "x$START_UPSMON" = "xyes" ] ; then - NUT_MODE=netclient - else - NUT_MODE=none - fi + mv /etc/init.d/nut /etc/init.d/nut.dpkg-old fi - - # output back the MODE to nut.conf - sed "s/^MODE\(.*\)/MODE=$NUT_MODE/" /etc/nut/nut.conf > /etc/nut/nut.conf.new - - # append the content of default, removing START_* / start... - grep -iv 'START' /etc/default/nut.bak >> /etc/nut/nut.conf.new - # move back to nut.conf - mv /etc/nut/nut.conf.new /etc/nut/nut.conf - # and to init.d/nut - #if [ -f /etc/init.d/nut ] ; then - # sed "s/^UPSD_OPTIONS\(.*\)/UPSD_OPTIONS=\"$UPSD_OPTIONS\"/" /etc/init.d/nut > /etc/init.d/nut.new - # sed "s/^UPSMON_OPTIONS\(.*\)/UPSMON_OPTIONS=\"$UPSMON_OPTIONS\"/" /etc/init.d/nut.new > /etc/init.d/nut - #fi - rm -f /etc/default/nut.bak /etc/default/nut - fi - else - # re process nut.conf MODE so that it can be sourced - NUT_MODE=`grep -e '^ *MODE' /etc/nut/nut.conf | tr -d " "` - sed "s/^ *MODE.*/$NUT_MODE/" /etc/nut/nut.conf > /etc/nut/nut.conf.new - mv /etc/nut/nut.conf.new /etc/nut/nut.conf + update-rc.d nut remove >/dev/null fi ;; @@ -134,3 +84,5 @@ case "$1" in esac #DEBHELPER# + +exit 0 diff --git a/debian/nut-server.postrm b/debian/nut-server.postrm index 38b8d52..b95b26f 100644 --- a/debian/nut-server.postrm +++ b/debian/nut-server.postrm @@ -14,12 +14,6 @@ case "$1" in rm -f /etc/udev/rules.d/025_nut-usbups.rules rm -f /etc/udev/rules.d/52_nut-usbups.rules rm -f /etc/udev/rules.d/52-nut-usbups.rules - # remove the nut user - if [ -x "$(command -v deluser)" ]; then - deluser --quiet --system nut > /dev/null || true - else - echo >&2 "not removing nut system account because deluser command was not found" - fi # handle a dpkg bug [ -d /etc/nut ] && rmdir --ignore-fail-on-non-empty /etc/nut >/dev/null 2>&1 ;; @@ -53,3 +47,4 @@ esac #DEBHELPER# +exit 0 diff --git a/debian/nut-server.preinst b/debian/nut-server.preinst index 587c150..f3e949f 100644 --- a/debian/nut-server.preinst +++ b/debian/nut-server.preinst @@ -5,13 +5,8 @@ if [ "$1" = upgrade ]; then [ -f /etc/udev/rules.d/025_nut-usbups.rules ] && rm -f /etc/udev/rules.d/025_nut-usbups.rules [ -f /etc/udev/rules.d/52_nut-usbups.rules ] && rm -f /etc/udev/rules.d/52_nut-usbups.rules [ -f /etc/udev/rules.d/52-nut-usbups.rules ] && rm -f /etc/udev/rules.d/52-nut-usbups.rules - - # migrate /etc/default/nut to /etc/nut/nut.conf (part #1) - # we need to do this before default gets trashed - if [ -f /etc/default/nut ] ; then - # backup /etc/default/nut - cp /etc/default/nut /etc/default/nut.bak - fi fi #DEBHELPER# + +exit 0 diff --git a/debian/patches/0001-fix-upsmon-regression.patch b/debian/patches/0001-fix-upsmon-regression.patch new file mode 100644 index 0000000..aa8c13e --- /dev/null +++ b/debian/patches/0001-fix-upsmon-regression.patch @@ -0,0 +1,15 @@ +Description: Fix upsmon/upssched regression +Origin: upstream, http://trac.networkupstools.org/projects/nut/changeset/3670 +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679513 + +Index: /trunk/clients/upssched.c +=================================================================== +--- a/clients/upssched.c (revision 3555) ++++ b/clients/upssched.c (revision 3670) +@@ -695,5 +695,5 @@ + pconf_encode(arg2, enc, sizeof(enc))); + +- snprintfcat(enc, sizeof(enc), "%s\n", buf); ++ snprintf(enc, sizeof(enc), "%s\n", buf); + + /* see if the parent needs to be started (and maybe start it) */ diff --git a/debian/patches/series b/debian/patches/series index 2024d93..f80396c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ +0001-fix-upsmon-regression.patch 0002-nut-monitor-paths.patch diff --git a/debian/rules b/debian/rules index b9eef15..b0745bb 100755 --- a/debian/rules +++ b/debian/rules @@ -76,8 +76,8 @@ common-install-indep:: binary-install/nut-monitor:: dh_python2 -pnut-monitor -DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server -- start 50 2 3 4 5 . stop 50 0 1 6 . -DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client -- start 51 2 3 4 5 . stop 51 0 1 6 . +DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server -- start 50 2 3 4 5 . stop 51 0 1 6 . +DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client -- start 51 2 3 4 5 . stop 50 0 1 6 . DEB_DH_COMPRESS_ARGS_nut-doc := -X.pdf ifeq (linux,$(DEB_HOST_ARCH_OS)) diff --git a/debian/watch b/debian/watch index cfb143e..fd44637 100644 --- a/debian/watch +++ b/debian/watch @@ -1,2 +1,2 @@ version=3 -http://www.networkupstools.org/source/2.4/nut-(.*)\.tar\.gz debian uupdate +http://www.networkupstools.org/source/([0-9.]+)/nut-(.*)\.tar\.gz