diff options
author | Michael Biebl <biebl@debian.org> | 2007-04-24 21:00:59 +0000 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2007-04-24 21:00:59 +0000 |
commit | 4310bb5e2f9d9e56a0c1e544adf87d7c91d74c76 (patch) | |
tree | f8d228983d5e8a82e00ddbd8e21f90d58d1e9d42 | |
parent | 4494997d2b5638e5af02b960a8901fc58486ec7a (diff) |
Switch to regular SysV init scriptsdebian/0.6.4-8
- Rename the start script properly so they are picked up by dh_installinit
- Start them at S26, stop them at K14
- preinst,postinst,postrm:
Make sure, the old conffiles for NetworkManager(Dispatcher) are removed/renamed properly.
git-svn-id: svn+ssh://svn.debian.org/svn/pkg-utopia/packages/unstable/networkmanager@1434 ceb527fc-18e6-0310-9fe2-813c157c29e7
-rw-r--r-- | debian/changelog | 17 | ||||
-rw-r--r-- | debian/network-manager.init (renamed from debian/network-manager.dbus-event) | 27 | ||||
-rw-r--r-- | debian/network-manager.network-manager-dispatcher.init (renamed from debian/network-manager-dispatcher.dbus-event) | 26 | ||||
-rw-r--r-- | debian/network-manager.postinst | 68 | ||||
-rw-r--r-- | debian/network-manager.postrm | 85 | ||||
-rw-r--r-- | debian/network-manager.preinst | 64 | ||||
-rw-r--r-- | debian/network-manager.prerm | 14 | ||||
-rwxr-xr-x | debian/rules | 7 |
8 files changed, 245 insertions, 63 deletions
diff --git a/debian/changelog b/debian/changelog index c2867ad0e..38b9921a2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,20 @@ +network-manager (0.6.4-8) unstable; urgency=low + + * Install the NetworkManager and NetworkManagerDispatcher start scripts as + regular SysV init scripts + - Rename debian/network-manager.dbus-event to debian/network-manager.init + and debian/network-manager-dispatcher.dbus-event to + debian/network-manager.network-manager-dispatcher.init. + - Add proper LSB headers to the init scripts. + - debian/rules + Call dh_installinit for network-manager and network-manager-dispatcher. + - debian/network-manager.{preinst,postinst,postrm} + Remove the old conffiles /etc/dbus-1/event.d/25NetworkManager and + /etc/dbus-1/event.d/26NetworkManagerDispatcher or rename them to + *.dpkg-bak if they were changed locally. + + -- Michael Biebl <biebl@debian.org> Tue, 24 Apr 2007 22:30:22 +0200 + network-manager (0.6.4-7) unstable; urgency=low * debian/control diff --git a/debian/network-manager.dbus-event b/debian/network-manager.init index f69d7fd45..d096e9500 100644 --- a/debian/network-manager.dbus-event +++ b/debian/network-manager.init @@ -1,17 +1,16 @@ #! /bin/sh -# -# NetworkManager NetworkManager daemon -# Daemon for automatically switching network -# connections to the best available connection. -# This file should be placed in /etc/init.d. -# -# Authors: Christian Bjälevik <nafallo@magicalforest.se> -# Jan Gerber <j@bootlab.org> -# Mark Roach <mrroach@okmaybe.com> -# Thom May <thom@debian.org> -# -# Version: @(#)skeleton 2.85-23 28-Jul-2004 miquels@cistron.nl -# +### BEGIN INIT INFO +# Provides: NetworkManager +# Required-Start: $local_fs dbus dhcdbd hal +# Required-Stop: $local_fs dbus dhcdbd hal +# Should-Start: $syslog +# Should-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: S 0 1 6 +# Short-Description: network connection manager +# Description: Daemon for automatically switching network +# connections to the best available connection. +### END INIT INFO set -e @@ -24,7 +23,7 @@ DAEMON=/usr/sbin/$NAME PIDDIR=/var/run/NetworkManager PIDFILE=$PIDDIR/$NAME.pid -SCRIPTNAME=/etc/dbus-1/event.d/25$NAME +SCRIPTNAME=/etc/init.d/network-manager USER=root # Gracefully exit if the package has been removed. diff --git a/debian/network-manager-dispatcher.dbus-event b/debian/network-manager.network-manager-dispatcher.init index 53dbf24ba..2f386b2b3 100644 --- a/debian/network-manager-dispatcher.dbus-event +++ b/debian/network-manager.network-manager-dispatcher.init @@ -1,16 +1,16 @@ #! /bin/sh -# -# NetworkManager NetworkManagerDispatcher daemon -# Daemon for automatically switching network -# connections to the best available connection. -# This file should be placed in /etc/init.d. -# -# Authors: Christian Bjälevik <nafallo@magicalforest.se> -# Jan Gerber <j@bootlab.org> -# Mark Roach <mrroach@okmaybe.com> -# Thom May <thom@debian.org> -# -# +### BEGIN INIT INFO +# Provides: NetworkManagerDispatcher +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Should-Start: $syslog +# Should-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: S 0 1 6 +# Short-Description: network events dispatcher +# Description: This daemon automatically runs scripts when +# NetworkManager changes the network state. +### END INIT INFO set -e @@ -20,7 +20,7 @@ NAME="NetworkManagerDispatcher" DAEMON=/usr/sbin/$NAME PIDDIR=/var/run/NetworkManager PIDFILE=$PIDDIR/$NAME.pid -SCRIPTNAME=/etc/dbus-1/event.d/26$NAME +SCRIPTNAME=/etc/init.d/network-manager-dispatcher USER=root # Gracefully exit if the package has been removed. diff --git a/debian/network-manager.postinst b/debian/network-manager.postinst index 1e73dfa25..c2a445c70 100644 --- a/debian/network-manager.postinst +++ b/debian/network-manager.postinst @@ -1,27 +1,59 @@ -#!/bin/sh +#!/bin/sh -e +# This script can be called in the following ways: +# +# After the package was installed: +# <postinst> configure <old-version> +# +# +# If prerm fails during upgrade or fails on failed upgrade: +# <old-postinst> abort-upgrade <new-version> +# +# If prerm fails during deconfiguration of a package: +# <postinst> abort-deconfigure in-favour <new-package> <version> +# removing <old-package> <version> +# +# If prerm fails during replacement due to conflict: +# <postinst> abort-remove in-favour <new-package> <version> -set -e -case "$1" in - configure) - if ! getent group netdev > /dev/null; then - addgroup --quiet --system netdev - fi +# Remove a no-longer used conffile +rm_conffile() +{ + CONFFILE="$1" + + if [ -e "$CONFFILE".dpkg-remove ]; then + echo "Removing obsolete conffile $CONFFILE" + rm -f "$CONFFILE".dpkg-remove + fi +} + - if [ -x "/etc/init.d/dbus" ]; then - invoke-rc.d dbus force-reload || true - fi +case "$1" in + configure) + # Upgrade from previous versions + if dpkg --compare-versions "$2" lt "0.6.4-8"; then + rm_conffile /etc/dbus-1/event.d/25NetworkManager + rm_conffile /etc/dbus-1/event.d/26NetworkManagerDispatcher + fi - if [ -x "/etc/dbus-1/event.d/25NetworkManager" ]; then - /etc/dbus-1/event.d/25NetworkManager restart - fi + if ! getent group netdev > /dev/null; then + addgroup --quiet --system netdev + fi - if [ -x "/etc/dbus-1/event.d/26NetworkManagerDispatcher" ]; then - /etc/dbus-1/event.d/26NetworkManagerDispatcher restart - fi - ;; + if [ -x "/etc/init.d/dbus" ]; then + invoke-rc.d dbus force-reload || true + fi + ;; + + abort-upgrade|abort-deconfigure|abort-remove) + ;; + + *) + echo "$0 called with unknown argument \`$1'" 1>&2 + exit 1 + ;; esac #DEBHELPER# - exit 0 + diff --git a/debian/network-manager.postrm b/debian/network-manager.postrm new file mode 100644 index 000000000..812369bd7 --- /dev/null +++ b/debian/network-manager.postrm @@ -0,0 +1,85 @@ +#!/bin/sh -e +# This script can be called in the following ways: +# +# After the package was removed: +# <postrm> remove +# +# After the package was purged: +# <postrm> purge +# +# After the package was upgraded: +# <old-postrm> upgrade <new-version> +# if that fails: +# <new-postrm> failed-upgrade <old-version> +# +# +# After all of the packages files have been replaced: +# <postrm> disappear <overwriting-package> <version> +# +# +# If preinst fails during install: +# <new-postrm> abort-install +# +# If preinst fails during upgrade of removed package: +# <new-postrm> abort-install <old-version> +# +# If preinst fails during upgrade: +# <new-postrm> abort-upgrade <old-version> + + +# Undo removal of a no-longer used conffile +undo_rm_conffile() +{ + CONFFILE="$1" + + if [ ! -e "$CONFFILE" ]; then + if [ -e "$CONFFILE".dpkg-bak ]; then + echo "Restoring modified conffile $CONFFILE" + mv -f "$CONFFILE".dpkg-bak "$CONFFILE" + elif [ -e "$CONFFILE".dpkg-remove ]; then + echo "Restoring conffile $CONFFILE" + mv -f "$CONFFILE".dpkg-remove "$CONFFILE" + fi + fi +} + + +# Purge backup conffile +rm_backup_conffile() +{ + CONFFILE="$1" + if [ -e "$CONFFILE".dpkg-bak ]; then + echo "Purging backup of conffile $CONFFILE" + rm -f "$CONFFILE".dpkg-bak + fi +} + + +case "$1" in + remove) + ;; + + purge) + rm_backup_conffile /etc/dbus-1/event.d/25NetworkManager + rm_backup_conffile /etc/dbus-1/event.d/26NetworkManagerDispatcher + ;; + + upgrade|failed-upgrade|disappear) + ;; + + abort-install|abort-upgrade) + # Abort upgrade from previous versions + if dpkg --compare-versions "$2" lt "0.6.4-8"; then + undo_rm_conffile /etc/dbus-1/event.d/25NetworkManager + undo_rm_conffile /etc/dbus-1/event.d/26NetworkManagerDispatcher + fi + ;; + + *) + echo "$0 called with unknown argument \`$1'" 1>&2 + exit 1 + ;; +esac + +#DEBHELPER# +exit 0 diff --git a/debian/network-manager.preinst b/debian/network-manager.preinst new file mode 100644 index 000000000..60db6ae05 --- /dev/null +++ b/debian/network-manager.preinst @@ -0,0 +1,64 @@ +#!/bin/sh -e +# This script can be called in the following ways: +# +# Before the package is installed: +# <new-preinst> install +# +# Before removed package is upgraded: +# <new-preinst> install <old-version> +# +# Before the package is upgraded: +# <new-preinst> upgrade <old-version> +# +# +# If postrm fails during upgrade or fails on failed upgrade: +# <old-preinst> abort-upgrade <new-version> + + +# Prepare to remove a no-longer used conffile +prep_rm_conffile() +{ + CONFFILE="$1" + + if [ -e "$CONFFILE" ]; then + md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" + old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE '{s/ obsolete$//;s/.* //;p}}\" /var/lib/dpkg/status`" + if [ "$md5sum" != "$old_md5sum" ]; then + echo "Obsolete conffile $CONFFILE has been modified by you, renaming to .dpkg-bak" + mv -f "$CONFFILE" "$CONFFILE".dpkg-bak + else + mv -f "$CONFFILE" "$CONFFILE".dpkg-remove + fi + fi +} + + +case "$1" in + install) + ;; + + upgrade) + # Upgrade from previous versions + if dpkg --compare-versions "$2" lt "0.6.4-8"; then + if [ -x "/etc/dbus-1/event.d/25NetworkManager" ]; then + /etc/dbus-1/event.d/25NetworkManager stop + fi + if [ -x "/etc/dbus-1/event.d/26NetworkManagerDispatcher" ]; then + /etc/dbus-1/event.d/26NetworkManagerDispatcher stop + fi + prep_rm_conffile /etc/dbus-1/event.d/25NetworkManager + prep_rm_conffile /etc/dbus-1/event.d/26NetworkManagerDispatcher + fi + ;; + + abort-upgrade) + ;; + + *) + echo "$0 called with unknown argument \`$1'" 1>&2 + exit 1 + ;; +esac + +#DEBHELPER# +exit 0 diff --git a/debian/network-manager.prerm b/debian/network-manager.prerm deleted file mode 100644 index 8a0101108..000000000 --- a/debian/network-manager.prerm +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -set -e - -case "$1" in - remove) - /etc/dbus-1/event.d/25NetworkManager stop - /etc/dbus-1/event.d/26NetworkManagerDispatcher stop - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/rules b/debian/rules index 57cbedb3d..55dd9d1dd 100755 --- a/debian/rules +++ b/debian/rules @@ -12,6 +12,8 @@ DEB_CONFIGURE_EXTRA_FLAGS += \ --with-dhcdbd=/usr/sbin/dhcdbd \ --with-distro=debian +DEB_DH_INSTALLINIT_ARGS := -- start 26 2 3 4 5 . stop 14 0 1 6 . + clean:: rm -f po/*.gmo rm -f debian/*.1 @@ -22,10 +24,7 @@ build/network-manager:: /usr/bin/docbook-to-man debian/nm-applet.sgml > debian/nm-applet.1 binary-install/network-manager:: - install -m 755 debian/network-manager.dbus-event \ - debian/network-manager/etc/dbus-1/event.d/25NetworkManager - install -m 755 debian/network-manager-dispatcher.dbus-event \ - debian/network-manager/etc/dbus-1/event.d/26NetworkManagerDispatcher + dh_installinit --name network-manager-dispatcher $(DEB_DH_INSTALLINIT_ARGS) install -m 755 debian/network-manager-dispatcher.script \ debian/network-manager/etc/NetworkManager/dispatcher.d/01ifupdown |