diff options
author | Olli Hauer <ohauer@FreeBSD.org> | 2010-11-27 19:09:40 +0000 |
---|---|---|
committer | Olli Hauer <ohauer@FreeBSD.org> | 2010-11-27 19:09:40 +0000 |
commit | 4c345740f4e41c0bfdf8b701d86212c669abe46f (patch) | |
tree | 7a77ddd2570482dbca34f4998cc869c26ed1d8b0 /mail/dkimproxy | |
parent | 6589404cbeec8134de5505a3bcc6bd0150e6ff8b (diff) | |
download | ports-4c345740f4e41c0bfdf8b701d86212c669abe46f.tar.gz ports-4c345740f4e41c0bfdf8b701d86212c669abe46f.zip |
- 's|/usr/bin/perl|${PERL}|' (now "command_interpreter" can be used in rc scripts)
- rewrite rc scripts
- update to version 1.3
PR: 150574
Submitted by: Erik Steigler <erik _at_ okcupid.com>
Approved by: Yoshisato YANAGISAWA <yanagisawa _at_ csg.is.titech.ac.jp>
Notes
Notes:
svn path=/head/; revision=265292
Diffstat (limited to 'mail/dkimproxy')
-rw-r--r-- | mail/dkimproxy/Makefile | 16 | ||||
-rw-r--r-- | mail/dkimproxy/distinfo | 5 | ||||
-rw-r--r-- | mail/dkimproxy/files/dkimproxy_in.in | 72 | ||||
-rw-r--r-- | mail/dkimproxy/files/dkimproxy_out.in | 81 | ||||
-rw-r--r-- | mail/dkimproxy/pkg-plist | 4 |
5 files changed, 60 insertions, 118 deletions
diff --git a/mail/dkimproxy/Makefile b/mail/dkimproxy/Makefile index ce880c615cb3..600cb2dc3b0c 100644 --- a/mail/dkimproxy/Makefile +++ b/mail/dkimproxy/Makefile @@ -6,7 +6,7 @@ # PORTNAME= dkimproxy -PORTVERSION= 1.2 +PORTVERSION= 1.3 CATEGORIES= mail MASTER_SITES= SF @@ -18,13 +18,23 @@ BUILD_DEPENDS= ${SITE_PERL}/Mail/DKIM.pm:${PORTSDIR}/mail/p5-Mail-DKIM \ ${SITE_PERL}/Error.pm:${PORTSDIR}/lang/p5-Error RUN_DEPENDS= ${BUILD_DEPENDS} +LICENSE= GPLv2 + GNU_CONFIGURE= yes USE_PERL5= yes USE_RC_SUBR= dkimproxy_in dkimproxy_out -USERS= dkimproxy -GROUPS= dkimproxy +DKIMPROXYUSER= dkimproxy +USERS= ${DKIMPROXYUSER} +GROUPS= ${DKIMPROXYUSER} MAN8= dkimproxy_in.8 dkimproxy_out.8 +SUB_LIST+= PERL=${PERL} \ + DKIMPROXYUSER=${DKIMPROXYUSER} + +post-patch: + @${GREP} -Ril 'perl' ${WRKDIR} | ${XARGS} ${REINPLACE_CMD} -i '' \ + -e 's|/usr/bin/perl|${PERL}|' -e 's|@PERL@|${PERL}|' + .include <bsd.port.mk> diff --git a/mail/dkimproxy/distinfo b/mail/dkimproxy/distinfo index 54ad295a024b..5f9da788df7c 100644 --- a/mail/dkimproxy/distinfo +++ b/mail/dkimproxy/distinfo @@ -1,3 +1,2 @@ -MD5 (dkimproxy-1.2.tar.gz) = db32f81c33636a9cf0b1e22d4eb6d959 -SHA256 (dkimproxy-1.2.tar.gz) = 4ae76367e2cecc85c3bce15513bf110b96251acd3d5e4278fbf6c9c5f9d3b7be -SIZE (dkimproxy-1.2.tar.gz) = 96971 +SHA256 (dkimproxy-1.3.tar.gz) = 514fa862b320b999a6ba4165305bacbca187d4e80e798c1160ce7b947d42e8f4 +SIZE (dkimproxy-1.3.tar.gz) = 103209 diff --git a/mail/dkimproxy/files/dkimproxy_in.in b/mail/dkimproxy/files/dkimproxy_in.in index f1abd7774ec1..4d78fd1f7642 100644 --- a/mail/dkimproxy/files/dkimproxy_in.in +++ b/mail/dkimproxy/files/dkimproxy_in.in @@ -19,65 +19,31 @@ name=dkimproxy_in rcvar=`set_rcvar` # set defaults - : ${dkimproxy_in_enable="NO"} -: ${dkimproxy_in_flags="--conf_file=/usr/local/etc/dkimproxy_in.conf"} -: ${dkimproxy_in_pidfile="/var/run/dkimproxy_in.pid"} -: ${dkimproxy_in_user="dkimproxy"} - -start_cmd="dkimproxy_in_start" -stop_cmd="dkimproxy_in_stop" - -dkimproxy_in_start() -{ - if [ -f ${dkimproxy_in_pidfile} ]; then - echo "${name} already running?" - exit 1 - fi - if pw user show "${dkimproxy_in_user}" > /dev/null 2>&1; then else - echo "dkimproxy_in_user: ${dkimproxy_in_user} not found" - exit 1 - fi - echo "Starting ${name}" - logger -t ${name} "Starting ${name}" - touch ${dkimproxy_in_pidfile} - chown ${dkimproxy_in_user} ${dkimproxy_in_pidfile} - tmpfile=`mktemp /tmp/${name}.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX` - su -m ${dkimproxy_in_user} -c "daemon -c -p ${dkimproxy_in_pidfile} \ - %%PREFIX%%/bin/dkimproxy.in ${dkimproxy_in_flags}" \ - > /dev/null 2> ${tmpfile} - # wait until dkimproxy start. - while true - do - filesize=`ls -l ${tmpfile}|awk '{print $5}'` - if [ ${filesize} -gt 0 ]; then - break - fi - done - logger -t ${name} "`cat ${tmpfile}`" - err=`grep Error ${tmpfile}` - if [ "${err}" ]; then - echo "Failed to start ${name}." - echo "${err}" - rm -f ${dkimproxy_in_pidfile} +command_interpreter=%%PERL%% +command=%%PREFIX%%/bin/dkimproxy.in +required_files=%%PREFIX%%/etc/${name}.conf +dkimproxy_in_user=%%DKIMPROXYUSER%% +command_args="--conf_file=${required_files} --user=${dkimproxy_in_user} --daemonize" + +start_postcmd=start_postcmd +stop_postcmd=stop_postcmd + +# dkimproxy_in/out return 0 even if startup failed +start_postcmd(){ + pid=$( check_process ${command} ${command_interpreter} ) + if [ -n "${pid}" ]; then + echo "Starting ${name} done." + logger -t ${name} "Starting ${name}" else - # To prevent DoS attack by dkimproxy_in_user. - chown root:wheel ${dkimproxy_in_pidfile} + echo "Starting ${name} failed." + logger -t ${name} "Starting ${name} failed" fi - rm -f ${tmpfile} } -dkimproxy_in_stop() -{ - if [ ! -f ${dkimproxy_in_pidfile} ]; then - echo "${name} not running?" - exit 1 - fi - echo "Stopping ${name}" - logger -t ${name} "Stopping ${name}" - kill `cat ${dkimproxy_in_pidfile}` - rm -f ${dkimproxy_in_pidfile} +stop_postcmd(){ + logger -t ${name} "Stopped ${name}" } load_rc_config $name diff --git a/mail/dkimproxy/files/dkimproxy_out.in b/mail/dkimproxy/files/dkimproxy_out.in index b49a7a2dba2a..cd8a0410e379 100644 --- a/mail/dkimproxy/files/dkimproxy_out.in +++ b/mail/dkimproxy/files/dkimproxy_out.in @@ -12,75 +12,42 @@ # # dkimproxy_out_enable="YES" # -# Before you enable dkimproxy.out, you also need to make your domainkey to -# set it to DNS and configurate dkimproxy_out_flags. -# +# Before you enable dkimproxy.out you also have to +# - create your domainkey +# - create domainkey records in DNS +# - configure %%PREFIX%%/etc/dkimproxy_out.conf . /etc/rc.subr -name="dkimproxy_out" +name=dkimproxy_out rcvar=`set_rcvar` # set defaults - : ${dkimproxy_out_enable="NO"} -: ${dkimproxy_out_flags="--conf_file=/usr/local/etc/dkimproxy_out.conf"} -: ${dkimproxy_out_pidfile="/var/run/dkimproxy_out.pid"} -: ${dkimproxy_out_user="dkimproxy"} - -start_cmd="dkimproxy_out_start" -stop_cmd="dkimproxy_out_stop" -dkimproxy_out_start() -{ - if [ -f ${dkimproxy_out_pidfile} ]; then - echo "${name} already running?" - exit 1 - fi - if pw user show "${dkimproxy_out_user}" > /dev/null 2>&1; then else - echo "dkimproxy_out_user: ${dkimproxy_out_user} not found" - exit 1 - fi - echo "Starting ${name}" - logger -t ${name} "Starting ${name}" - touch ${dkimproxy_out_pidfile} - chown ${dkimproxy_out_user} ${dkimproxy_out_pidfile} - tmpfile=`mktemp /tmp/${name}.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX` - su -m ${dkimproxy_out_user} -c "daemon -c -p ${dkimproxy_out_pidfile} \ - %%PREFIX%%/bin/dkimproxy.out ${dkimproxy_out_flags}" \ - > /dev/null 2> ${tmpfile} - # wait until dkimproxy start. - while true - do - filesize=`ls -l ${tmpfile}|awk '{print $5}'` - if [ ${filesize} -gt 0 ]; then - break - fi - done - - logger -t ${name} "`cat ${tmpfile}`" - err=`grep Error ${tmpfile}` - if [ "${err}" ]; then - echo "Failed to start ${name}." - echo "${err}" - rm -f ${dkimproxy_out_pidfile} +command_interpreter=%%PERL%% +command=%%PREFIX%%/bin/dkimproxy.out +required_files=%%PREFIX%%/etc/${name}.conf +dkimproxy_out_user=%%DKIMPROXYUSER%% +command_args="--conf_file=${required_files} --user=${dkimproxy_out_user} --daemonize" + +start_postcmd=start_postcmd +stop_postcmd=stop_postcmd + +# dkimproxy_in/out return 0 even if startup failed +start_postcmd(){ + pid=$( check_process ${command} ${command_interpreter} ) + if [ -n "${pid}" ]; then + echo "Starting ${name} done." + logger -t ${name} "Starting ${name}" else - # To prevent DoS attack by dkimproxy_out_user. - chown root:wheel ${dkimproxy_out_pidfile} + echo "Starting ${name} failed." + logger -t ${name} "Starting ${name} failed" fi - rm -f ${tmpfile} } -dkimproxy_out_stop() -{ - if [ ! -f ${dkimproxy_out_pidfile} ]; then - echo "${name} not running?" - exit 1 - fi - echo "Stopping ${name}" - logger -t ${name} "Stopping ${name}" - kill `cat ${dkimproxy_out_pidfile}` - rm -f ${dkimproxy_out_pidfile} +stop_postcmd(){ + logger -t ${name} "Stopped ${name}" } load_rc_config $name diff --git a/mail/dkimproxy/pkg-plist b/mail/dkimproxy/pkg-plist index 225685074120..a17f5acfbc07 100644 --- a/mail/dkimproxy/pkg-plist +++ b/mail/dkimproxy/pkg-plist @@ -1,8 +1,8 @@ -etc/dkimproxy_in.conf.example -etc/dkimproxy_out.conf.example bin/dkim_responder.pl bin/dkimproxy.in bin/dkimproxy.out +etc/dkimproxy_in.conf.example +etc/dkimproxy_out.conf.example lib/LookupMap.pm lib/MSDW/SMTP/Client.pm lib/MSDW/SMTP/Server.pm |