aboutsummaryrefslogblamecommitdiffstats
path: root/community/postsrsd/postsrsd.initd
blob: 7abaa640843c100156957dc424dc4a68ef732b2b (plain) (tree)


























                                                            
                                                            


                                                              


                       
#!/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"
                checkpath -Fm 0600 -o postsrsd ${SRS_SECRET}
                dd if=/dev/urandom bs=18 count=1 status=none \
                    | base64 >${SRS_SECRET}

                eend $?
        fi
}