migrate over to update-alternatives

This commit is contained in:
Jan Wagner 2010-10-17 13:15:15 +00:00
parent b56c74420d
commit a2f877c4f1
5 changed files with 18 additions and 22 deletions

View file

@ -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. 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@cyconet.org> Mon, 10 Mar 2008 22:37:44 +0100 -- Jan Wagner <waja@cyconet.org> Mon, 10 Mar 2008 22:37:44 +0100

24
debian/postfwd.init vendored
View file

@ -18,6 +18,11 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=postfwd NAME=postfwd
DAEMON=/usr/sbin/${NAME}
PIDFILE=/var/run/$NAME.pid
DESC=postfwd
test -x $DAEMON || exit 0
not_configured () { not_configured () {
echo "#### WARNING ####" echo "#### WARNING ####"
@ -34,13 +39,6 @@ no_configfile () {
exit 0 exit 0
} }
wrong_binary () {
echo "#### ERROR ####"
echo "${BINARY} is not a valid binary"
echo "###############"
exit 0
}
# check if postfwd is configured or not # check if postfwd is configured or not
if [ -f "/etc/default/$NAME" ] if [ -f "/etc/default/$NAME" ]
then then
@ -67,18 +65,6 @@ then
fi fi
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 set -e
case "$1" in case "$1" in

View file

@ -54,4 +54,6 @@ case "$1" in
;; ;;
esac esac
update-alternatives --install /usr/sbin/postfwd postfwd /usr/sbin/postfwd1
update-alternatives --install /usr/sbin/postfwd postfwd /usr/sbin/postfwd2
#DEBHELPER# #DEBHELPER#

8
debian/postfwd.prerm vendored Normal file
View file

@ -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#

4
debian/rules vendored
View file

@ -18,7 +18,7 @@ install: build
dh_testroot dh_testroot
dh_clean -k 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 install -D -m 644 sbin/postfwd2 debian/postfwd/usr/sbin/postfwd2
# Build architecture-independent files here. # Build architecture-independent files here.
@ -30,7 +30,7 @@ binary-indep: build install
dh_installexamples etc/postfwd.cf.sample debian/example-cfg* dh_installexamples etc/postfwd.cf.sample debian/example-cfg*
dh_installinit -- defaults 19 21 dh_installinit -- defaults 19 21
dh_installman man/man8/postfwd.8 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_compress
dh_fixperms dh_fixperms
dh_perl dh_perl