From e4fd0f2b90d58b5097e80435d84e1fe07a759ce9 Mon Sep 17 00:00:00 2001 From: Greg Larkin Date: Thu, 15 Apr 2010 15:35:06 +0000 Subject: - Fixed a script name error in pkg-deinstall - Changed syslog facility.level from local5.info to mail.info - Removed /etc/syslog.conf mangling from pkg-install/deinstall - Moved user/group creation from pkg-install to USERS/GROUPS style supported by bsd.port.mk - Updated nullmailer.in rc script to properly daemonize nullmailer-send since the port does not use sysutils/daemontools - Bumped PORTREVISION Reported by: ed --- mail/nullmailer/Makefile | 12 ++++- mail/nullmailer/files/nullmailer.in | 6 +-- mail/nullmailer/files/pkg-deinstall.in | 44 +++++++++++++++ mail/nullmailer/files/pkg-install.in | 97 ---------------------------------- mail/nullmailer/pkg-deinstall | 93 -------------------------------- 5 files changed, 57 insertions(+), 195 deletions(-) create mode 100644 mail/nullmailer/files/pkg-deinstall.in delete mode 100644 mail/nullmailer/pkg-deinstall (limited to 'mail/nullmailer') diff --git a/mail/nullmailer/Makefile b/mail/nullmailer/Makefile index 5c6164d2e5bf..a918f12c931e 100644 --- a/mail/nullmailer/Makefile +++ b/mail/nullmailer/Makefile @@ -7,6 +7,7 @@ PORTNAME= nullmailer PORTVERSION= 1.05 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= mail MASTER_SITES= http://untroubled.org/nullmailer/ \ @@ -18,18 +19,25 @@ COMMENT= MTA for hosts which relay to a fixed set of smart relays LOCALSTATEDIR= /var/spool +.if defined(MAINTAINER_MODE) +UID_FILES+= ../../UIDs +GID_FILES+= ../../GIDs +.endif +USERS= nullmail +GROUPS= nullmail + GNU_CONFIGURE= yes CONFIGURE_ARGS+= --localstatedir=${LOCALSTATEDIR} USE_SUBMAKE= yes USE_RC_SUBR= ${PORTNAME} -SUB_FILES+= pkg-install pkg-message +SUB_FILES+= pkg-install pkg-deinstall pkg-message PKGINSTALL= ${WRKDIR}/pkg-install PKGMESSAGE= ${WRKDIR}/pkg-message PLIST_SUB+= LOCALSTATEDIR=${LOCALSTATEDIR} -SUB_LIST+= LOCALSTATEDIR=${LOCALSTATEDIR} +SUB_LIST+= LOCALSTATEDIR=${LOCALSTATEDIR} NULLMAIL_USER=${USERS} MAN1= nullmailer-inject.1 sendmail.1 MAN7= nullmailer.7 diff --git a/mail/nullmailer/files/nullmailer.in b/mail/nullmailer/files/nullmailer.in index 1d6978dbd305..5f5bb3fe08d0 100644 --- a/mail/nullmailer/files/nullmailer.in +++ b/mail/nullmailer/files/nullmailer.in @@ -13,9 +13,9 @@ name=nullmailer rcvar=`set_rcvar` -nullmailer_user=nullmail -command=%%PREFIX%%/sbin/nullmailer-send -command_args=" 2>&1 | /usr/bin/logger -i -p local5.info -t nullmail &" +command=/usr/sbin/daemon +procname=%%PREFIX%%/sbin/nullmailer-send +command_args=" -cf -u %%NULLMAIL_USER%% /bin/sh -c '$procname | /usr/bin/logger -i -p mail.info -t $name'" load_rc_config $name run_rc_command "$1" diff --git a/mail/nullmailer/files/pkg-deinstall.in b/mail/nullmailer/files/pkg-deinstall.in new file mode 100644 index 000000000000..1f2d7da63f59 --- /dev/null +++ b/mail/nullmailer/files/pkg-deinstall.in @@ -0,0 +1,44 @@ +#!/bin/sh + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ x${answer} = x ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local dflt question answer + + question=$1 + dflt=$2 + while :; do + answer=$(ask "${question}" "${dflt}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +if [ x"$2" = xDEINSTALL ]; then + if [ ! -n "$BATCH" ]; then + if /bin/ps -axc | /usr/bin/grep -q nullmailer-send; then + if yesno "There are some nullmailer processes running. Shall I kill them" y; then + %%PREFIX%%/etc/rc.d/nullmailer stop + sleep 2 + else + echo "OK ... I hope you know what you are doing." + fi + fi + + fi +fi diff --git a/mail/nullmailer/files/pkg-install.in b/mail/nullmailer/files/pkg-install.in index be785915b606..3526a6c4c485 100644 --- a/mail/nullmailer/files/pkg-install.in +++ b/mail/nullmailer/files/pkg-install.in @@ -1,102 +1,5 @@ #!/bin/sh -user=nullmail -group=nullmail - -ask() { - local question default answer - - question=$1 - default=$2 - if [ -z "${PACKAGE_BUILDING}" ]; then - read -p "${question} [${default}]? " answer - fi - if [ x${answer} = x ]; then - answer=${default} - fi - echo ${answer} -} - -yesno() { - local dflt question answer - - question=$1 - dflt=$2 - while :; do - answer=$(ask "${question}" "${dflt}") - case "${answer}" in - [Yy]*) return 0;; - [Nn]*) return 1;; - esac - echo "Please answer yes or no." - done -} - -if [ x"$2" = xPRE-INSTALL ]; then - if /usr/sbin/pw groupshow "${group}" 2>/dev/null; then - echo "You already have a group \"${group}\", so I will use it." - else - echo "You need a group \"${group}\"." - if ([ -n "$BATCH" ] || yesno "Would you like me to create it" y); then - /usr/sbin/pw groupadd ${group} -g 522 -h - || exit - echo "Done." - else - echo "Please create it, and try again." - exit 1 - fi - fi - - if /usr/sbin/pw user show "${user}" 2>/dev/null; then - echo "You already have a user \"${user}\", so I will use it." - pw usermod "${user}" -d %%LOCALSTATEDIR%%/nullmailer - else - echo "You need a user \"${user}\"." - if ([ -n "$BATCH" ] || yesno "Would you like me to create it" y); then - /usr/sbin/pw useradd ${user} -u 522 -g ${group} -h - -d %%LOCALSTATEDIR%%/nullmailer \ - -s /bin/sh -c "Nullmailer Mail System" || exit - echo "Done." - else - echo "Please create it, and try again." - exit 1 - fi - fi - - if [ ! -n "$BATCH" ]; then - if grep -q "^[^#]*local5.*/var/log/nullmail.log" /etc/syslog.conf; then - echo -n "It looks like you already have some logging set up, so I " - echo "will use it." - elif yesno "Would you like me to set up the syslog logging" y; then - echo "Setting up nullmailer logging in \"/etc/syslog.conf\"." - cat <>/etc/newsyslog.conf -/var/log/nullmail.log 644 7 * @T00 Z -EOF - echo "Done." - fi - fi - -fi - if [ x"$2" = xPOST-INSTALL ]; then if [ ! -f %%PREFIX%%/etc/nullmailer/me.sample ]; then echo "Creating \"%%PREFIX%%/etc/nullmailer/me.sample\"." diff --git a/mail/nullmailer/pkg-deinstall b/mail/nullmailer/pkg-deinstall deleted file mode 100644 index 41feaf438d14..000000000000 --- a/mail/nullmailer/pkg-deinstall +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh - -user=nullmail -group=nullmail - -ask() { - local question default answer - - question=$1 - default=$2 - if [ -z "${PACKAGE_BUILDING}" ]; then - read -p "${question} [${default}]? " answer - fi - if [ x${answer} = x ]; then - answer=${default} - fi - echo ${answer} -} - -yesno() { - local dflt question answer - - question=$1 - dflt=$2 - while :; do - answer=$(ask "${question}" "${dflt}") - case "${answer}" in - [Yy]*) return 0;; - [Nn]*) return 1;; - esac - echo "Please answer yes or no." - done -} - -delete_account() { - local u g home - - u=$1 - g=$2 - if yesno "Do you want me to remove group \"${g}\"" y; then - pw groupdel -n ${g} - echo "Done." - fi - if yesno "Do you want me to remove user \"${u}\"" y; then - eval home=~${u} - pw userdel -n ${u} - echo "Done." - if [ -d "${home}" ]; then - echo "Please remember to check if there's any unsent mail left" - echo "in the home directory \"${home}\"" - fi - - fi -} - -if [ x"$2" = xDEINSTALL ]; then - if [ ! -n "$BATCH" ]; then - if /bin/ps -axc | /usr/bin/grep -q nullmailer-send; then - if yesno "There are some nullmailer processes running. Shall I kill them" y; then - ${PREFIX}/etc/rc.d/nullmail.sh stop - sleep 2 - else - echo "OK ... I hope you know what you are doing." - fi - fi - - fi -fi - -if [ x"$2" = xPOST-DEINSTALL ]; then - tmp="/etc/#nullmailer$$" - if [ ! -n "$BATCH" ]; then - if yesno "Do you want me to remove the nullmail logging from \"/etc/syslog.conf\"" y; then - sed "/nullmail\.log\$/d" /etc/syslog.conf >${tmp} || exit - chmod 644 ${tmp} - mv ${tmp} /etc/syslog.conf || exit - - if [ -f /var/run/syslog.pid ]; then - echo "Giving syslogd a kick in the pants." - kill -HUP `cat /var/run/syslog.pid` - fi - fi - - if yesno "Do you want me to remove the nullmail log entry from \"/etc/newsyslog.conf\"" y; then - sed "/nullmail\.log/d" /etc/newsyslog.conf >${tmp} || exit - chmod 644 ${tmp} - mv ${tmp} /etc/newsyslog.conf || exit - echo "Done." - fi - delete_account ${user} ${group} - - fi -fi -- cgit v1.2.3