1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-29 01:13:08 +00:00

Modernise rc scripts

Submitted by:	dougb (based on patch)
This commit is contained in:
Chris Rees 2012-01-15 20:35:29 +00:00
parent 6f78b2dbb4
commit 368fd8a051
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=289278
2 changed files with 14 additions and 26 deletions

View File

@ -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"

View File

@ -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