[postfwd] 46/96: prepare postfwd2 package

Jan Wagner waja at alioth.debian.org
Tue Nov 5 20:09:39 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 c615938d8a2883d8d4638a26a4ea3e6b9a9ad72d
Author: Jan Wagner <waja at cyconet.org>
Date:   Wed Jun 16 12:40:05 2010 +0000

    prepare postfwd2 package
---
 debian/postfwd.default  |   15 +++++++
 debian/postfwd.docs     |    2 +
 debian/postfwd.init     |  100 +++++++++++++++++++++++++++++++++++++++++++++++
 debian/postfwd.postinst |   57 +++++++++++++++++++++++++++
 debian/postfwd.postrm   |   53 +++++++++++++++++++++++++
 5 files changed, 227 insertions(+)

diff --git a/debian/postfwd.default b/debian/postfwd.default
new file mode 100644
index 0000000..af87842
--- /dev/null
+++ b/debian/postfwd.default
@@ -0,0 +1,15 @@
+# Global options for postfwd(8).
+
+# Set to '1' to enable startup (daemon mode)
+STARTUP=0
+
+# Config file
+CONF=/etc/postfix/postfwd.cf
+# IP where listen to
+INET=127.0.0.1
+# Port where listen to
+PORT=10040
+# run as user postfwd
+RUNAS="postfw"
+# Arguments passed on start (--daemon implied)
+ARGS="--summary=600 --cache=600 --cache-rdomain-only --cache-no-size"
diff --git a/debian/postfwd.docs b/debian/postfwd.docs
new file mode 100644
index 0000000..0646e19
--- /dev/null
+++ b/debian/postfwd.docs
@@ -0,0 +1,2 @@
+doc/postfwd.html
+doc/postfwd.txt
diff --git a/debian/postfwd.init b/debian/postfwd.init
new file mode 100644
index 0000000..dcbd703
--- /dev/null
+++ b/debian/postfwd.init
@@ -0,0 +1,100 @@
+#! /bin/sh
+#		Written by Miquel van Smoorenburg <miquels at cistron.nl>.
+#		Modified for Debian
+#		by Ian Murdock <imurdock at gnu.ai.mit.edu>.
+#
+# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels at cistron.nl
+# /etc/init.d/postfwd: v1 2008/03/12 Jan Wagner <waja at cyconet.org>
+
+### BEGIN INIT INFO
+# Provides: postfwd
+# Required-Start: $local_fs $network $remote_fs $syslog
+# Required-Stop: $local_fs $network $remote_fs $syslog
+# Default-Start:  2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop the postfw daemon
+# Description: a Perl policy daemon for the Postfix MTA
+### END INIT INFO
+
+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 ####"
+        echo "${NAME} won't be started/stopped unless it is configured."
+        echo "If you want to start ${NAME} as daemon, see /etc/default/${NAME}."
+        echo "#################"
+        exit 0
+}
+
+no_configfile () {
+	echo "#### WARNING ####"
+	echo "${NAME} won't be started/stopped unless a rules file is provided at $CONF."
+	echo "#################"
+	exit 0
+}
+
+# check if postfwd is configured or not
+if [ -f "/etc/default/$NAME" ]
+then
+        . /etc/default/$NAME
+        if [ "$STARTUP" != "1" ]
+        then
+                not_configured
+        fi
+else
+        not_configured
+fi
+
+# check if rules file is there
+if [ ! -f $CONF ]
+then
+	no_configfile
+fi
+
+# Check whether we have to drop privileges.
+if [ -n "$RUNAS" ]; then
+        if ! getent passwd "$RUNAS" >/dev/null; then
+                RUNAS=""
+        fi
+fi
+
+set -e
+
+case "$1" in
+  start)
+	echo -n "Starting $DESC: "
+        start-stop-daemon --start --quiet \
+                --name ${RUNAS} \
+                --exec $DAEMON -- ${ARGS} --daemon --file=${CONF} --interface=${INET} --port=${PORT} --user=${RUNAS} --group=${RUNAS} --pidfile=$PIDFILE
+	echo "$NAME."
+	;;
+  stop)
+	echo -n "Stopping $DESC: "
+	start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE && rm -rf $PIDFILE
+        echo "$NAME."
+	;;
+  reload)
+	echo "Reloading $DESC configuration files."
+		kill -HUP $(cat $PIDFILE)
+	;;
+  restart|force-reload)
+	echo -n "Restarting $DESC (incl. cache): "
+	        $0 stop
+        	sleep 1
+	        $0 start
+	echo "$NAME."
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+	exit 1
+	;;
+esac
+
+exit 0
diff --git a/debian/postfwd.postinst b/debian/postfwd.postinst
new file mode 100644
index 0000000..8d4160d
--- /dev/null
+++ b/debian/postfwd.postinst
@@ -0,0 +1,57 @@
+#!/bin/sh
+# based on arpwatch.postinst: v11 2004/09/15 KELEMEN Peter <fuji at debian.org>
+# postinst: v1 2006/01/12 Jan Wagner <waja at cyconet.org>
+
+set -e
+
+NUSER="postfw"
+NGROUP="postfw"
+NHOME="/var/lib/$NUSER"
+NGECOS="postfwd user"
+
+case "$1" in
+	configure)
+		# Take care of group.
+		if NGROUP_ENTRY=`getent group $NGROUP`; then
+			# group exists
+			:
+		else
+			# group does not exist yet
+			addgroup --quiet --system $NGROUP
+		fi
+
+		# Take care of user.
+		if NUSER_ENTRY=`getent passwd $NUSER`; then
+			# user exists
+			adduser --quiet $NUSER $NGROUP
+			# 
+		else
+			# user does not exist yet
+			adduser --quiet --system	\
+				--ingroup $NGROUP	\
+				--gecos "$NGECOS"	\
+				--home $NHOME		\
+				--no-create-home	\
+				--shell /bin/sh		\
+				--disabled-login	\
+				--disabled-password	\
+				--shell /bin/false	\
+				$NUSER
+		fi
+
+		# Set up home directory.
+		if [ -d $NHOME ]; then
+			chown -R ${NUSER}:${NGROUP} $NHOME
+			chmod -R o-rwX $NHOME
+		fi
+		;;
+
+	abort-upgrade|abort-remove|abort-deconfigure)
+		;;
+	*)
+		echo "postinst called with unknown argument \`$1'" >&2
+		exit 1
+		;;
+esac
+
+#DEBHELPER#
diff --git a/debian/postfwd.postrm b/debian/postfwd.postrm
new file mode 100644
index 0000000..eb50815
--- /dev/null
+++ b/debian/postfwd.postrm
@@ -0,0 +1,53 @@
+#!/bin/sh
+# based on arpwatch.postrm: v2 2004/09/15 KELEMEN Peter <fuji at debian.org>
+# postrm: v1 2006/10/12 Jan Wagner <waja at cyconet.org>
+
+NUSER="postfw"
+NGROUP="postfw"
+
+set -e
+
+case "$1" in
+	purge)
+		# find first and last SYSTEM_UID numbers
+		for LINE in `grep SYSTEM_UID /etc/adduser.conf | grep -v "^#"`; do
+			case $LINE in
+				FIRST_SYSTEM_UID*)
+					FIST_SYSTEM_UID=`echo $LINE | cut -f2 -d '='`
+					;;
+				LAST_SYSTEM_UID*)
+					LAST_SYSTEM_UID=`echo $LINE | cut -f2 -d '='`
+					;;
+				*)
+					;;
+			esac
+		done
+		# remove system account if necessary
+		if [ -n "$FIST_SYSTEM_UID" ] && [ -n "$LAST_SYSTEM_UID" ]; then
+			if USERID=`getent passwd $NUSER | cut -f 3 -d ':'`; then
+				if [ -n "$USERID" ]; then
+					if [ "$FIST_SYSTEM_UID" -le "$USERID" ] && \
+						[ "$USERID" -le "$LAST_SYSTEM_UID" ] && \
+							[ -x /usr/sbin/deluser ]; then
+								deluser --quiet $NUSER || true
+								# And then remove the group
+								GROUPID=`getent group $NGROUP | cut -f 3 -d ':'`
+								if [ -n "$GROUPID" ] && [ -x /usr/sbin/delgroup ] ;  then
+									delgroup --quiet $NGROUP || true
+								fi
+					fi
+				fi
+			fi
+		fi
+		;;
+
+	remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+		;;
+
+	*)
+		echo "postrm called with unknown argument \`$1'" >&2
+		exit 1
+		;;
+esac
+
+#DEBHELPER#

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