diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/nullmailer/Makefile | 13 | ||||
-rw-r--r-- | mail/nullmailer/files/nullmail.sh | 62 |
2 files changed, 26 insertions, 49 deletions
diff --git a/mail/nullmailer/Makefile b/mail/nullmailer/Makefile index 46007142a38b..8aa02d4d44a7 100644 --- a/mail/nullmailer/Makefile +++ b/mail/nullmailer/Makefile @@ -8,7 +8,7 @@ PORTNAME= nullmailer # PORTVERSION= 1.00RC7 PORTVERSION= 1.00r7 -PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= mail MASTER_SITES= http://untroubled.org/nullmailer/ \ ftp://mirrors.dataloss.nl/mirrors/bgware/nullmailer/%SUBDIR%/ @@ -27,6 +27,8 @@ MAN1= nullmailer-inject.1 sendmail.1 MAN7= nullmailer.7 MAN8= nullmailer-queue.8 nullmailer-send.8 +USE_RC_SUBR= yes + PKGMESSAGE= ${WRKDIR}/pkg-message LOCALSTATEDIR= /var/spool @@ -35,6 +37,8 @@ CONFIGURE_ARGS+= --localstatedir=${LOCALSTATEDIR} PLIST_SUB= LOCALSTATEDIR=${LOCALSTATEDIR} PKGINSTALL= ${WRKDIR}/pkg-install +RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} + post-extract: @${CAT} ${FILESDIR}/pkg-install.proto | ${SED} -e 's,%%LOCALSTATEDIR%%,${LOCALSTATEDIR},g' > ${WRKDIR}/pkg-install @${CAT} ${FILESDIR}/pkg-message.proto | ${SED} -e 's,%%PREFIX%%,${PREFIX},' > ${PKGMESSAGE} @@ -44,11 +48,10 @@ post-extract: pre-install: @BATCH="${BATCH}" LOCALSTATEDIR="${LOCALSTATEDIR}" PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL -do-install: - @cd ${WRKSRC} && make install && make install-root - post-install: - @${INSTALL_SCRIPT} -c ${FILESDIR}/nullmail.sh ${PREFIX}/etc/rc.d/ + @cd ${WRKSRC} && make install-root + @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${FILESDIR}/nullmail.sh > ${WRKDIR}/nullmail.sh + @${INSTALL_SCRIPT} -c ${WRKDIR}/nullmail.sh ${PREFIX}/etc/rc.d/ @${INSTALL_DATA} -c ${FILESDIR}/remotes.sample ${PREFIX}/etc/nullmailer/ @BATCH="${BATCH}" NMH_PREFIX="${NMH_PREFIX}" PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL @${CAT} ${PKGMESSAGE} diff --git a/mail/nullmailer/files/nullmail.sh b/mail/nullmailer/files/nullmail.sh index d32df5c064f3..86aabf40baf2 100644 --- a/mail/nullmailer/files/nullmail.sh +++ b/mail/nullmailer/files/nullmail.sh @@ -1,48 +1,22 @@ #!/bin/sh +# $FreeBSD$ +# +# PROVIDE: nullmailer +# REQUIRE: DAEMON +# KEYWORD: FreeBSD +# +# Add the following line to /etc/rc.conf to enable nullmailer: +# +# nullmailer_enable="YES" +# -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi +. %%RC_SUBR%% -NULLMAILUSER=nullmail +name=nullmailer +rcvar=`set_rcvar` +nullmailer_user=nullmail +command=%%PREFIX%%/sbin/nullmailer-send +command_args=" | /usr/bin/logger -i -p local5.info -t nullmail &" +load_rc_config $name +run_rc_command "$1" -PIDFILE=/var/run/nullmailer.pid -AWK=/usr/bin/awk -CAT=/bin/cat -GREP=/usr/bin/grep -PS=/bin/ps -RM=/bin/rm -LOGGER=/usr/bin/logger -KILL=/bin/kill -KILLALL=/usr/bin/killall -HEAD=/usr/bin/head - -PRIORITY=local5.info -TAG=${NULLMAILUSER} - -case "$1" in -start) - echo -n ' nullmailer' - if [ ! -r ${PIDFILE} ] ; then - [ -x ${PREFIX}/sbin/nullmailer-send ] && su -l ${NULLMAILUSER} -c "${PREFIX}/sbin/nullmailer-send 2>&1 | ${LOGGER} -i -p ${PRIORITY} -t ${TAG} &" - JUNK=`${PS} -ax` - PID=`${PS} awx | ${GREP} -v awk | ${AWK} '/nullmailer-send/ {print $1}' | ${HEAD} -1` - echo $PID > ${PIDFILE} - else - echo ' already running' - fi - ;; -stop) - echo -n ' nullmailer' - if [ -r ${PIDFILE} ] ; then - ${KILL} `${CAT} ${PIDFILE}` > /dev/null - ${RM} -f ${PIDFILE} - fi - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; -esac - -exit 0 |