aboutsummaryrefslogtreecommitdiffstats
path: root/community/postsrsd/postsrsd.initd
diff options
context:
space:
mode:
authorKevin Daudt <me@ikke.info>2016-12-19 19:33:14 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2016-12-20 14:30:43 +0100
commitb278832ab0ca264b259b80e724eb22e13076523e (patch)
treee0ec81f60806cdfa84233edbca74e8f6100bddf7 /community/postsrsd/postsrsd.initd
parent6e161a676fd2388808fb2ac211aed9e23e4f7344 (diff)
downloadaports-b278832ab0ca264b259b80e724eb22e13076523e.tar.bz2
aports-b278832ab0ca264b259b80e724eb22e13076523e.tar.xz
community/postsrsd: new aport
Diffstat (limited to 'community/postsrsd/postsrsd.initd')
-rw-r--r--community/postsrsd/postsrsd.initd35
1 files changed, 35 insertions, 0 deletions
diff --git a/community/postsrsd/postsrsd.initd b/community/postsrsd/postsrsd.initd
new file mode 100644
index 0000000000..4256c3942d
--- /dev/null
+++ b/community/postsrsd/postsrsd.initd
@@ -0,0 +1,35 @@
+#!/sbin/openrc-run
+
+description="Postfix SRS Daemon"
+pidfile="/run/postsrsd.pid"
+command="/usr/sbin/postsrsd"
+command_args="-D
+ -d \"${SRS_DOMAIN}\"
+ -s ${SRS_SECRET-/etc/postsrsd/postsrsd.secret}
+ -f ${SRS_FORWARD_PORT-10001}
+ -r ${SRS_REVERSE_PORT-10002}
+ -p \"${pidfile}\"
+ -u \"${RUN_AS-postsrsd}\"
+ -c \"${CHROOT-/usr/lib/postsrsd}\"
+ -a \"${SRS_SEPARATOR-=}\""
+
+stopsig="SIGTERM"
+
+start_pre() {
+ if [ -z "${SRS_DOMAIN}" ]
+ then
+ eerror "SRS_DOMAIN is not set"
+ return 1
+ fi
+
+ if [ ! -s /etc/postsrsd/postsrsd.secret ]
+ then
+ ebegin "Generating secret"
+ dd if=/dev/urandom bs=18 count=1 status=none \
+ | base64 >${SRS_SECRET}
+
+ chmod 0600 ${SRS_SECRET}
+ chown postsrsd ${SRS_SECRET}
+ eend $?
+ fi
+}