[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#684732: unblock: nut/2.6.4-2



On Mon, Nov 26, 2012 at 21:50:17 +0100, Sébastien Villemot wrote:

> Control: retitle -1 unblock: nut/2.6.4-2.1
> 
> Upon request of Arnaud Quette, I have uploaded a NMU of nut versioned
> 2.6.4-2.1, which fixes RC bug #677054. The change relative to the
> previous version in unstable (2.6.4-2) is that I have added a preinst
> script in nut-client.
> 
> For completeness, I attach the debdiff of the new version (2.6.4-2.1)
> against the version currently in Wheezy (2.6.4-1).
> 

> diff -Nru nut-2.6.4/debian/control nut-2.6.4/debian/control
> --- nut-2.6.4/debian/control	2012-06-06 21:06:03.000000000 +0200
> +++ nut-2.6.4/debian/control	2012-08-12 20:39:01.000000000 +0200
> @@ -24,6 +24,7 @@
>  
>  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 @@
>   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 install both nut-server and nut-client,
> + in most cases it is sufficient for a basic UPS monitoring system.
>  
s/install/&s/

>  Package: nut-server
>  Architecture: any
> @@ -50,12 +52,11 @@
>   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 -Nru nut-2.6.4/debian/nut-cgi.postrm nut-2.6.4/debian/nut-cgi.postrm
> --- nut-2.6.4/debian/nut-cgi.postrm	2012-06-06 21:06:03.000000000 +0200
> +++ nut-2.6.4/debian/nut-cgi.postrm	2012-08-12 20:39:01.000000000 +0200
> @@ -44,3 +44,4 @@
>  
>  #DEBHELPER#
>  
> +exit 0

Why?  Changelog doesn't seem to mention it.

> diff -Nru nut-2.6.4/debian/nut-client.lintian-overrides nut-2.6.4/debian/nut-client.lintian-overrides
> --- nut-2.6.4/debian/nut-client.lintian-overrides	1970-01-01 01:00:00.000000000 +0100
> +++ nut-2.6.4/debian/nut-client.lintian-overrides	2012-08-12 20:39:01.000000000 +0200
> @@ -0,0 +1 @@
> +nut-client: script-in-etc-init.d-not-registered-via-update-rc.d

What is that about?

> diff -Nru nut-2.6.4/debian/nut-client.postinst nut-2.6.4/debian/nut-client.postinst
> --- nut-2.6.4/debian/nut-client.postinst	1970-01-01 01:00:00.000000000 +0100
> +++ nut-2.6.4/debian/nut-client.postinst	2012-08-12 20:39:01.000000000 +0200
> @@ -0,0 +1,63 @@
> +#!/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
> +    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
> +

I still think the chowns/chmods shouldn't be done on upgrades, if for
whatever reason the local admin changed those that's their choice.

> +    # 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
> +    ;;
> +
> +  abort-upgrade)
> +    # do nothing
> +    ;;
> +
> +  abort-remove)
> +    # do nothing
> +    ;;
> +
> +  abort-deconfigure)
> +    # do nothing
> +    ;;
> +
> +  *)
> +    echo "$0: incorrect arguments: $*" >&2
> +    exit 1
> +    ;;
> +
> +esac
> +
> +#DEBHELPER#
> +
> +exit 0
> diff -Nru nut-2.6.4/debian/nut-server.postinst nut-2.6.4/debian/nut-server.postinst
> --- nut-2.6.4/debian/nut-server.postinst	2012-06-06 21:06:03.000000000 +0200
> +++ nut-2.6.4/debian/nut-server.postinst	2012-08-12 20:39:01.000000000 +0200
> @@ -22,7 +22,7 @@
>      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
> +    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
> @@ -50,67 +50,9 @@
>  
>      # 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
> -        else
> -          if [ "x$START_UPSMON" = "xyes" ] ; then
> -            NUT_MODE=netclient
> -          else
> -            NUT_MODE=none
> -          fi
> -        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
> +    if dpkg --compare-versions "$2" le "2.6.4-2~" ; then
> +        rm -f /etc/init.d/nut
> +        update-rc.d nut remove >/dev/null

If /etc/init.d/nut was a conffile, I don't think you get to rm -f it on
upgrade, at least if it was modified.

>      fi
>      ;;
>  
> @@ -134,3 +76,5 @@
>  esac
>  
>  #DEBHELPER#
> +
> +exit 0

Cheers,
Julien

Attachment: signature.asc
Description: Digital signature


Reply to: