aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorcrees <crees@FreeBSD.org>2012-01-16 04:35:29 +0800
committercrees <crees@FreeBSD.org>2012-01-16 04:35:29 +0800
commit5a0c3d54399870197a650d056ddf5364e9e77467 (patch)
tree76fc70e7f23813b0e795e59897700df38e38fdcb /mail
parent8b4f2e7956ac4a69a0ec1a5cdc869f614b5081d7 (diff)
downloadfreebsd-ports-gnome-5a0c3d54399870197a650d056ddf5364e9e77467.tar.gz
freebsd-ports-gnome-5a0c3d54399870197a650d056ddf5364e9e77467.tar.zst
freebsd-ports-gnome-5a0c3d54399870197a650d056ddf5364e9e77467.zip
Modernise rc scripts
Submitted by: dougb (based on patch)
Diffstat (limited to 'mail')
-rw-r--r--mail/mailscanner/files/mailscanner.in32
-rw-r--r--mail/mailscanner/files/mta.in8
2 files changed, 14 insertions, 26 deletions
diff --git a/mail/mailscanner/files/mailscanner.in b/mail/mailscanner/files/mailscanner.in
index f4832a0ab7c7..5b930a11e217 100644
--- a/mail/mailscanner/files/mailscanner.in
+++ b/mail/mailscanner/files/mailscanner.in
@@ -7,10 +7,13 @@
#
# Add the following lines to /etc/rc.conf to enable mailscanner:
# mailscanner_enable (bool): Set to "NO" by default.
-# Set it to "YES" to enable mailscanner
+# Set it to "YES" to enable MailScanner
# mailscanner_configfile (path): Set to "%%PREFIX%%/etc/MailScanner/MailScanner.conf" by default.
# mailscanner_pidfile (path): Set to "/var/run/MailScanner.pid" by default.
-# mailscanner_user (str): Set to "root" by default. If you changed the "Run As User" variable in MailScanner.conf and wish to disable taint mode, you MUST also set the same value here.
+# mailscanner_user (str): Set to "root" by default. If you changed the
+# "Run As User" variable in MailScanner.conf and
+# wish to disable taint mode, you MUST also set
+# the same value here.
#
. /etc/rc.subr
@@ -21,31 +24,16 @@ rcvar=mailscanner_enable
load_rc_config $name
: ${mailscanner_enable="NO"}
-: ${mailscanner_configfile="%%PREFIX%%/etc/MailScanner/MailScanner.conf"}
-: ${mailscanner_pidfile="/var/run/MailScanner.pid"}
+
+required_files=${mailscanner_configfile:-"%%PREFIX%%/etc/MailScanner/MailScanner.conf"}
+pidfile=${mailscanner_pidfile:-"/var/run/MailScanner.pid"}
command="%%PREFIX%%/sbin/mailscanner"
-pidfile=${mailscanner_pidfile}
-command_args="${mailscanner_configfile}"
+command_args="${required_files}"
procname="MailScanner"
extra_commands=reload
required_files="${mailscanner_configfile}"
-
-pid_touch ()
-{
- touch $mailscanner_pidfile
- chown $mailscanner_user $mailscanner_pidfile
-}
-
-mailscanner_start() {
- su -m ${mailscanner_user} -c "exec ${command} ${command_args}"
-}
-
-if [ -n "${mailscanner_user}" ]; then
- start_cmd="mailscanner_start"
- start_precmd="pid_touch"
-fi
+start_precmd="install -o ${mailscanner_user:-root} /dev/null $pidfile"
run_rc_command "$1"
-
diff --git a/mail/mailscanner/files/mta.in b/mail/mailscanner/files/mta.in
index d1de08b42189..3e49935f72e8 100644
--- a/mail/mailscanner/files/mta.in
+++ b/mail/mailscanner/files/mta.in
@@ -16,9 +16,9 @@
# mta_flags (str): Set to "" by default.
# Extra flags passed to start command.
# mta_program (str): Path to program, defaults depending on $mta_type
-# either to "/usr/sbin/sendmail" or "/usr/local/sbin/exim"
+# either to "/usr/sbin/sendmail" or "%%LOCALBASE%%/sbin/exim"
# mta_configfile (str): Config file, defaults depending on $mta_type either
-# to "/etc/mail/sendmail.cf" or "/usr/local/etc/exim/configure"
+# to "/etc/mail/sendmail.cf" or "%%LOCALBASE%%/etc/exim/configure"
# mta_pidfile (str): PID file, defaults depending on $mta_type either
# to "/var/run/sendmail.pid" or "/var/run/exim.pid"
#
@@ -79,8 +79,8 @@ case "${mta_type}" in
;;
exim)
- _mta_program="/usr/local/sbin/exim"
- _mta_configfile="/usr/local/etc/exim/configure"
+ _mta_program="%%LOCALBASE%%/sbin/exim"
+ _mta_configfile="%%LOCALBASE%%/etc/exim/configure"
_mta_pidfile="/var/run/exim.pid"
;;
esac