diff options
author | Rong-En Fan <rafan@FreeBSD.org> | 2006-07-27 16:26:39 +0000 |
---|---|---|
committer | Rong-En Fan <rafan@FreeBSD.org> | 2006-07-27 16:26:39 +0000 |
commit | 338e2198a3a979bb99404832ecb26c1687476c1a (patch) | |
tree | dfd3bf2fee6860f8f5503b34306f288fe77bcd52 /mail/dkimproxy/files | |
parent | c6df86859dce1a7aceaafe2a7b09e19eefe7fb9b (diff) | |
download | ports-338e2198a3a979bb99404832ecb26c1687476c1a.tar.gz ports-338e2198a3a979bb99404832ecb26c1687476c1a.zip |
Notes
Diffstat (limited to 'mail/dkimproxy/files')
-rw-r--r-- | mail/dkimproxy/files/dkimproxy_in.in | 56 | ||||
-rw-r--r-- | mail/dkimproxy/files/dkimproxy_out.in | 61 | ||||
-rw-r--r-- | mail/dkimproxy/files/pkg-deinstall.in | 13 | ||||
-rw-r--r-- | mail/dkimproxy/files/pkg-install.in | 36 |
4 files changed, 166 insertions, 0 deletions
diff --git a/mail/dkimproxy/files/dkimproxy_in.in b/mail/dkimproxy/files/dkimproxy_in.in new file mode 100644 index 000000000000..6a4e54ca16d4 --- /dev/null +++ b/mail/dkimproxy/files/dkimproxy_in.in @@ -0,0 +1,56 @@ +#!/bin/sh +# $FreeBSD$ +# + +# PROVIDE: dkimproxy_in +# REQUIRE: LOGIN +# BEFORE: mail +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable dkimproxy.in: +# +# dkimproxy_in_enable="YES" +# + +. %%RC_SUBR%% + +name=dkimproxy_in +rcvar=`set_rcvar` + +# set defaults + +: ${dkimproxy_in_enable="NO"} +: ${dkimproxy_in_flags="127.0.0.1:10025 127.0.0.1:10026"} +: ${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 + touch ${dkimproxy_in_pidfile} + chown ${dkimproxy_in_user} ${dkimproxy_in_pidfile} + su -m ${dkimproxy_in_user} -c "daemon -cf -p ${dkimproxy_in_pidfile} \ + %%PREFIX%%/bin/dkimproxy.in ${dkimproxy_in_flags}" + echo "Starting ${name}" +} + +dkimproxy_in_stop() +{ + if [ ! -f ${dkimproxy_in_pidfile} ]; then + echo "${name} not running?" + exit 1 + fi + kill `cat ${dkimproxy_in_pidfile}` + rm -f ${dkimproxy_in_pidfile} + echo "Stopping ${name}" +} + +load_rc_config $name +run_rc_command "$1" diff --git a/mail/dkimproxy/files/dkimproxy_out.in b/mail/dkimproxy/files/dkimproxy_out.in new file mode 100644 index 000000000000..239039bd5277 --- /dev/null +++ b/mail/dkimproxy/files/dkimproxy_out.in @@ -0,0 +1,61 @@ +#!/bin/sh +# $FreeBSD$ +# + +# PROVIDE: dkimproxy_out +# REQUIRE: LOGIN +# BEFORE: mail +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable dkimproxy.out: +# +# dkimproxy_out_enable="YES" +# +# Before you enable dkimproxy.out, you also need to make your domainkey to +# set it to DNS and configurate dkimproxy_flags. +# + +. %%RC_SUBR%% + +name="dkimproxy_out" +rcvar=`set_rcvar` + +# set defaults + +: ${dkimproxy_out_enable="NO"} +: ${dkimproxy_out_flags="--keyfile=%%PREFIX%%/etc/dkimproxy/private.key \ + --selector=selector1 --domain=example.org --method=relaxed \ + 127.0.0.1:10027 127.0.0.1:10028"} +: ${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 + touch ${dkimproxy_out_pidfile} + chown ${dkimproxy_out_user} ${dkimproxy_out_pidfile} + su -m ${dkimproxy_out_user} -c "daemon -cf -p ${dkimproxy_out_pidfile} \ + %%PREFIX%%/bin/dkimproxy.out ${dkimproxy_out_flags}" + echo "Starting ${name}." +} + +dkimproxy_out_stop() +{ + if [ ! -f ${dkimproxy_out_pidfile} ]; then + echo "${name} not running?" + exit 1 + fi + kill `cat ${dkimproxy_out_pidfile}` + rm -f ${dkimproxy_out_pidfile} + echo "Stopping ${name}" +} + +load_rc_config $name +run_rc_command "$1" diff --git a/mail/dkimproxy/files/pkg-deinstall.in b/mail/dkimproxy/files/pkg-deinstall.in new file mode 100644 index 000000000000..65b9aec55e4c --- /dev/null +++ b/mail/dkimproxy/files/pkg-deinstall.in @@ -0,0 +1,13 @@ +#!/bin/sh +# $FreeBSD$ + +if [ "$2" != "POST-DEINSTALL" ]; then + exit 0 +fi + +USERNAME=%%USER%% + +if pw usershow "${USERNAME}" 2>/dev/null 1>&2; then + echo "To delete ${USERNAME} user permanently, use 'pw userdel \"${USERNAME}\"'" +fi +exit 0 diff --git a/mail/dkimproxy/files/pkg-install.in b/mail/dkimproxy/files/pkg-install.in new file mode 100644 index 000000000000..999ccc8fff42 --- /dev/null +++ b/mail/dkimproxy/files/pkg-install.in @@ -0,0 +1,36 @@ +#! /bin/sh +# +# $FreeBSD$ + +PATH=/bin:/usr/bin:/usr/sbin + +case $2 in + +PRE-INSTALL) + echo "---> Starting install script:" + + if [ -z "%%USER%%" -o -z "%%GROUP%%" -o \ + -z "%%UID%%" -o -z "%%GID%%" ]; then + echo "ERROR: A required pragma was empty" + exit 1 + fi + + # Create group if required + if pw group show "%%GROUP%%" >/dev/null 2>&1; then + echo "---> Using existing group \"%%GROUP%%\"" + else + echo "---> Adding group \"%%GROUP%%\" (%%GID%%)" + /usr/sbin/pw groupadd %%GROUP%% -g %%GID%% || exit 1 + fi + + # Create user if required + if pw user show "%%USER%%" >/dev/null 2>&1; then + echo "---> Using existing user \"%%USER%%\"" + else + echo "---> Adding user \"%%USER%%\" (%%UID%%)" + pw useradd "%%USER%%" -u "%%UID%%" -g "%%GROUP%%" -h - \ + -d "/nonexistent" -s "/sbin/nologin" -c "DKIM Proxy Owner" || exit 1 + fi + ;; + +esac |