Index: head/audio/musicpd/files/musicpd.in =================================================================== --- head/audio/musicpd/files/musicpd.in (revision 319486) +++ head/audio/musicpd/files/musicpd.in (revision 319487) @@ -1,38 +1,37 @@ #!/bin/sh # $FreeBSD$ # # PROVIDE: musicpd # REQUIRE: mixer LOGIN avahi_daemon oss # KEYWORD: shutdown # Add the following line to /etc/rc.conf to enable mpd: # # musicpd_enable=YES . /etc/rc.subr name=musicpd rcvar=musicpd_enable load_rc_config $name : ${musicpd_enable:=NO} command=%%PREFIX%%/bin/musicpd command_args=%%PREFIX%%/etc/musicpd.conf required_files=%%PREFIX%%/etc/musicpd.conf start_precmd=${name}_getpidfile stop_precmd=${name}_getpidfile musicpd_getpidfile() { - if type get_pidfile_from_conf >/dev/null 2>&1 && - get_pidfile_from_conf pid_file %%PREFIX%%/etc/musicpd.conf ; then + if get_pidfile_from_conf pid_file %%PREFIX%%/etc/musicpd.conf ; then pidfile="$_pidfile_from_conf" else pidfile="%%MPDDIR%%/.mpd/pid" fi } run_rc_command $1 Index: head/net-mgmt/hawk/files/hawk.in =================================================================== --- head/net-mgmt/hawk/files/hawk.in (revision 319486) +++ head/net-mgmt/hawk/files/hawk.in (revision 319487) @@ -1,41 +1,39 @@ #!/bin/sh # $FreeBSD$ # # PROVIDE: hawk # REQUIRE: LOGIN mysql # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # hawk_enable (bool): Set to NO by default. # Set it to YES to enable hawk. . /etc/rc.subr name=hawk rcvar=hawk_enable load_rc_config hawk : ${hawk_enable:="NO"} command=%%PREFIX%%/sbin/hawk command_interpreter=%%PERL%% command_args='&' +start_precmd=find_pidfile +stop_precmd=find_pidfile find_pidfile() { - if type get_pidfile_from_conf >/dev/null 2>&1 && - get_pidfile_from_conf pidfile %%PREFIX%%/etc/hawk/daemon.conf; then + if get_pidfile_from_conf pidfile %%PREFIX%%/etc/hawk/daemon.conf; then pidfile="$_pidfile_from_conf" else pidfile='/var/run/hawk.pid' fi } - -start_precmd=find_pidfile -stop_precmd=find_pidfile run_rc_command "$1" Index: head/net-mgmt/nrpe2/files/nrpe2.in =================================================================== --- head/net-mgmt/nrpe2/files/nrpe2.in (revision 319486) +++ head/net-mgmt/nrpe2/files/nrpe2.in (revision 319487) @@ -1,54 +1,53 @@ #!/bin/sh # $FreeBSD$ # # PROVIDE: nrpe2 # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable nrpe2: # nrpe2_enable (bool): Set to "NO" by default. # Set it to "YES" to enable nrpe2. # nrpe2_flags (str): Not set by default. # nrpe2_configfile (str): Set to "%%PREFIX%%/etc/nrpe.cfg" by default. . /etc/rc.subr name=nrpe2 rcvar=nrpe2_enable load_rc_config "${name}" : ${nrpe2_enable:=NO} : ${nrpe2_configfile:=%%PREFIX%%/etc/nrpe.cfg} required_files="${nrpe2_configfile}" command="%%PREFIX%%/sbin/nrpe2" command_args="-c ${nrpe2_configfile} -d" extra_commands="reload" sig_reload=HUP start_precmd=nrpe2_prestart stop_precmd=find_pidfile find_pidfile() { [ -n "$nrpe2_pidfile" ] && warn "No longer necessary to set nrpe2_pidfile in rc.conf[.local]" - if type get_pidfile_from_conf >/dev/null 2>&1 && - get_pidfile_from_conf pid_file %%PREFIX%%/etc/nrpe.cfg; then + if get_pidfile_from_conf pid_file %%PREFIX%%/etc/nrpe.cfg; then pidfile="$_pidfile_from_conf" else pidfile='/var/run/nrpe2/nrpe2.pid' fi } nrpe2_prestart() { find_pidfile install -d -o ${nrpe_user:-nagios} ${pidfile%/*} } run_rc_command "$1" Index: head/sysutils/munin-node/files/munin-node.in =================================================================== --- head/sysutils/munin-node/files/munin-node.in (revision 319486) +++ head/sysutils/munin-node/files/munin-node.in (revision 319487) @@ -1,42 +1,38 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: munin-node # REQUIRE: DAEMON # BEFORE: cron # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable munin-node: # munin_node_enable (bool): Set to "NO" by default. # Set it to "YES" to enable munin-node # munin_node_config (path): Set to "%%PREFIX%%/etc/munin/munin-node.conf" by default. # . /etc/rc.subr -name="munin_node" +name=munin_node rcvar=munin_node_enable load_rc_config $name : ${munin_node_enable:=NO} : ${munin_node_config="%%PREFIX%%/etc/munin/munin-node.conf"} command="%%PREFIX%%/sbin/munin-node" command_interpreter="%%PREFIX%%/bin/perl" start_precmd=find_pidfile status_precmd=find_pidfile stop_precmd=find_pidfile find_pidfile() { - if type get_pidfile_from_conf >/dev/null 2>&1 && - get_pidfile_from_conf pid_file $munin_node_config; then - pidfile="$_pidfile_from_conf" - else - pidfile=`awk '$1 == "pid_file" { print $2 }' $munin_node_config` - fi + get_pidfile_from_conf pid_file $munin_node_config + pidfile="$_pidfile_from_conf" } -run_rc_command "$1" +run_rc_command $1 Index: head/sysutils/munin-node/files/munin-sched.in =================================================================== --- head/sysutils/munin-node/files/munin-sched.in (revision 319486) +++ head/sysutils/munin-node/files/munin-sched.in (revision 319487) @@ -1,42 +1,38 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: munin-sched # REQUIRE: DAEMON # BEFORE: cron # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable munin-sched: # munin_sched_enable (bool): Set to "NO" by default. # Set it to "YES" to enable munin-sched # munin_sched_config (path): Set to "%%PREFIX%%/etc/munin/munin-node.conf" by default. # . /etc/rc.subr -name="munin_sched" +name=munin_sched rcvar=munin_sched_enable load_rc_config $name : ${munin_sched_enable:=NO} : ${munin_sched_config="%%PREFIX%%/etc/munin/munin-node.conf"} command="%%PREFIX%%/sbin/munin-sched" start_precmd=find_pidfile status_precmd=find_pidfile stop_precmd=find_pidfile find_pidfile() { - if type get_pidfile_from_conf >/dev/null 2>&1 && - get_pidfile_from_conf pid_file $munin_sched_config; then - pidfile="${_pidfile_from_conf%node*}sched" - pidfile="${pidfile}${_pidfile_from_conf#*node}" - else - pidfile=`awk '$1 == "pid_file" { gsub("node","sched",$2); print $2; }' $munin_sched_config` - fi + get_pidfile_from_conf pid_file $munin_sched_config + pidfile="${_pidfile_from_conf%node*}sched" + pidfile="${pidfile}${_pidfile_from_conf#*node}" } run_rc_command "$1" Index: head/x11/slim/files/slim.in =================================================================== --- head/x11/slim/files/slim.in (revision 319486) +++ head/x11/slim/files/slim.in (revision 319487) @@ -1,67 +1,65 @@ #!/bin/sh # $FreeBSD$ # # PROVIDE: slim # REQUIRE: LOGIN dbus hald # KEYWORD: shutdown # # Add the following line to /etc/rc.conf to enable slim: # slim_enable="YES" # # Alternatively, edit /etc/ttys and change the line below # ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure # to this: # ttyv8 "%%PREFIX%%/bin/slim" xterm on secure . /etc/rc.subr name="slim" rcvar=slim_enable -start_precmd=${name}_rmfile -stop_precmd=${name}_prestop -stop_postcmd=${name}_rmfile +load_rc_config slim -load_rc_config $name +: ${slim_enable:="NO"} -: ${slim_enable="NO"} - command=%%PREFIX%%/bin/slim command_args="-d" +start_precmd=${name}_rmfile +stop_precmd=${name}_prestop +stop_postcmd=${name}_rmfile find_pidfile() { - if type get_pidfile_from_conf >/dev/null 2>&1 && - get_pidfile_from_conf lockfile %%PREFIX%%/etc/${name}.conf; then + if get_pidfile_from_conf lockfile %%PREFIX%%/etc/${name}.conf; then pidfile="$_pidfile_from_conf" else pidfile="/var/run/${name}.pid" fi } -slim_rmfile () +slim_rmfile() { local file [ -z "$pidfile" ] && find_pidfile for file in $pidfile /var/run/slim.auth; do [ -e "$file" ] && unlink $file done # Needed if neither file exists return 0 } -slim_prestop () +slim_prestop() { local xpid find_pidfile xpid=`ps -axww | grep '/bin/[X] .* -auth /var/run/slim.auth' | grep -v grep | awk '{print $1};'` [ -n "$xpid" ] && kill $xpid } run_rc_command "$1"