[postfwd] 54/96: migrate over to update-alternatives

Jan Wagner waja at alioth.debian.org
Tue Nov 5 20:09:41 UTC 2013


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository postfwd.

commit a2f877c4f1efee1ac532e38595360045fc2ca8c4
Author: Jan Wagner <waja at cyconet.org>
Date:   Sun Oct 17 13:15:15 2010 +0000

    migrate over to update-alternatives
---
 debian/README.Debian    |    2 +-
 debian/postfwd.init     |   24 +++++-------------------
 debian/postfwd.postinst |    2 ++
 debian/postfwd.prerm    |    8 ++++++++
 debian/rules            |    4 ++--
 5 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index 375d197..cd97363 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -62,6 +62,6 @@ file /etc/default/postfwd and set the "startup" variable to 1.
 ----------------------------------------
 
 Since some time, there is also a prefork version available, called postfwd2.
-You can choose in /etc/default/postfwd to use 'postfwd' or postfwd2'.
+You can use update-alternatives to choose between 'postfwd1' and 'postfwd2'.
 
  -- Jan Wagner <waja at cyconet.org>  Mon, 10 Mar 2008 22:37:44 +0100
diff --git a/debian/postfwd.init b/debian/postfwd.init
index 0e6e254..285c293 100644
--- a/debian/postfwd.init
+++ b/debian/postfwd.init
@@ -18,6 +18,11 @@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 NAME=postfwd
+DAEMON=/usr/sbin/${NAME}
+PIDFILE=/var/run/$NAME.pid
+DESC=postfwd
+
+test -x $DAEMON || exit 0
 
 not_configured () {
         echo "#### WARNING ####"
@@ -34,13 +39,6 @@ no_configfile () {
 	exit 0
 }
 
-wrong_binary () {
-	echo "#### ERROR ####"
-	echo "${BINARY} is not a valid binary"
-	echo "###############"
-	exit 0
-}
-
 # check if postfwd is configured or not
 if [ -f "/etc/default/$NAME" ]
 then
@@ -67,18 +65,6 @@ then
         fi
 fi
 
-if ! [ ${BINARY} == "postfwd" -o ${BINARY} == "postfwd2" ]
-then
-        wrong_binary
-fi
-
-NAME=${BINARY}
-DAEMON=/usr/sbin/${NAME}
-PIDFILE=/var/run/$NAME.pid
-DESC=postfwd
-
-test -x $DAEMON || exit 0
-
 set -e
 
 case "$1" in
diff --git a/debian/postfwd.postinst b/debian/postfwd.postinst
index 8d4160d..3279cff 100644
--- a/debian/postfwd.postinst
+++ b/debian/postfwd.postinst
@@ -54,4 +54,6 @@ case "$1" in
 		;;
 esac
 
+update-alternatives --install /usr/sbin/postfwd postfwd /usr/sbin/postfwd1
+update-alternatives --install /usr/sbin/postfwd postfwd /usr/sbin/postfwd2
 #DEBHELPER#
diff --git a/debian/postfwd.prerm b/debian/postfwd.prerm
new file mode 100644
index 0000000..8dcb8a2
--- /dev/null
+++ b/debian/postfwd.prerm
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ "$1" = remove ] || [ "$1" = deconfigure ]; then
+	update-alternatives --remove postfwd /usr/sbin/postfwd1
+	update-alternatives --remove postfwd /usr/sbin/postfwd2
+fi
+
+#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index 4868f2b..a9b4b3d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,7 +18,7 @@ install: build
 	dh_testroot
 	dh_clean -k
 
-	install -D -m 644 sbin/postfwd debian/postfwd/usr/sbin/postfwd
+	install -D -m 644 sbin/postfwd debian/postfwd/usr/sbin/postfwd1
 	install -D -m 644 sbin/postfwd2 debian/postfwd/usr/sbin/postfwd2
 
 # Build architecture-independent files here.
@@ -30,7 +30,7 @@ binary-indep: build install
 	dh_installexamples etc/postfwd.cf.sample debian/example-cfg*
 	dh_installinit -- defaults 19 21
 	dh_installman man/man8/postfwd.8
-	dh_link usr/share/man/man1/postfwd.1.gz usr/share/man/man1/postfwd2.1.gz
+	# dh_link usr/share/man/man1/postfwd.1.gz usr/share/man/man1/postfwd2.1.gz
 	dh_compress
 	dh_fixperms
 	dh_perl

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/postfwd.git



More information about the Pkg-perl-cvs-commits mailing list