From 282172dd79b07ca2183d9538a25b4b845e6eb9e4 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 16 Jun 2010 14:35:43 +0000 Subject: [PATCH] a way to choose between postfwd and postfwd2 --- debian/README.Debian | 6 ++++++ debian/postfwd.default | 2 ++ debian/postfwd.init | 27 +++++++++++++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index 508b7df..375d197 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -58,4 +58,10 @@ In order to avoid the startup of the daemon on an unconfigured machine, automatic startup, on boot, is disabled by default. To enable it just edit the file /etc/default/postfwd and set the "startup" variable to 1. +4. CHOOSING WHICH POSTFWD VERSION TO USE +---------------------------------------- + +Since some time, there is also a prefork version available, called postfwd2. +You can choose in /etc/default/postfwd to use 'postfwd' or postfwd2'. + -- Jan Wagner Mon, 10 Mar 2008 22:37:44 +0100 diff --git a/debian/postfwd.default b/debian/postfwd.default index af87842..b3f4ec5 100644 --- a/debian/postfwd.default +++ b/debian/postfwd.default @@ -3,6 +3,8 @@ # Set to '1' to enable startup (daemon mode) STARTUP=0 +# using 'postfwd' or 'postfwd2'? +BINARY=postfwd # Config file CONF=/etc/postfix/postfwd.cf # IP where listen to diff --git a/debian/postfwd.init b/debian/postfwd.init index dcbd703..0e6e254 100644 --- a/debian/postfwd.init +++ b/debian/postfwd.init @@ -18,11 +18,6 @@ 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 ####" @@ -39,6 +34,13 @@ 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 @@ -58,12 +60,25 @@ then fi # Check whether we have to drop privileges. -if [ -n "$RUNAS" ]; then +if [ -n "$RUNAS" ] +then if ! getent passwd "$RUNAS" >/dev/null; then RUNAS="" 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