description "Postfix Sender Rewriting Scheme daemon"
author "Timo Röhling <timo.roehling@gmx.de>"

start on (filesystem and net-device-up)
stop on runlevel [!2345]
respawn

env DEFAULTFILE=/etc/default/@PROJECT_NAME@

script
	SRS_DOMAIN=`postconf -h mydomain || true`
	SRS_FORWARD_PORT=10001
	SRS_REVERSE_PORT=10002
	SRS_SECRET=/etc/@PROJECT_NAME@.secret
	RUN_AS=nobody
	if [ -r "$DEFAULTFILE" ]; then
		. "$DEFAULTFILE"
	fi
	exec @CMAKE_INSTALL_PREFIX@/sbin/@POSTSRSD@ -4 -f$SRS_FORWARD_PORT -r$SRS_REVERSE_PORT -d$SRS_DOMAIN -s$SRS_SECRET -u$RUN_AS
end script