ports/178269: [PATCH] Remove checks for get_pidfile_from_conf function

Chris Rees crees at FreeBSD.org
Tue Apr 30 21:50:00 UTC 2013


>Number:         178269
>Category:       ports
>Synopsis:       [PATCH] Remove checks for get_pidfile_from_conf function
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 30 21:50:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Chris Rees
>Release:        FreeBSD 9.1-STABLE amd64
>Organization:
>Environment:
System: FreeBSD pegasus.bayofrum.net 9.1-STABLE FreeBSD 9.1-STABLE #0 r247189: Sat Feb 23 15:20:18 GMT 2013 root at pegasus.bayofrum.net:/usr/obj/usr/home/crees/workspace/src/stable/9/sys/PEGASUS amd64


	
>Description:
	The function get_pidfile_from_conf was added to base before 8.3-RELEASE, and so it needed wrapping in tests to ensure it was available.

	It is now available on all supported releases, but uptake has been poor.

	I suspect it may be something to do with the if type get_pidfile_from_conf incantation, so I've done a sweep of the ports tree and removed all occurrences.
>How-To-Repeat:
	
>Fix:


	(mostly cosmetic changes to please rclint, hence no revision bump)

--- patch.txt begins here ---
Index: audio/musicpd/files/musicpd.in
===================================================================
--- audio/musicpd/files/musicpd.in	(revision 316967)
+++ audio/musicpd/files/musicpd.in	(working copy)
@@ -27,8 +27,7 @@
 
 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"
Index: net-mgmt/hawk/files/hawk.in
===================================================================
--- net-mgmt/hawk/files/hawk.in	(revision 316967)
+++ net-mgmt/hawk/files/hawk.in	(working copy)
@@ -19,23 +19,21 @@
 
 load_rc_config hawk
 
-: ${hawk_enable:="NO"}
+: ${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'
+		pidfile=/var/run/hawk.pid
 	fi
 }
 
-start_precmd=find_pidfile
-stop_precmd=find_pidfile
-
-run_rc_command "$1"
+run_rc_command $1
Index: net-mgmt/nrpe2/files/nrpe2.in
===================================================================
--- net-mgmt/nrpe2/files/nrpe2.in	(revision 316967)
+++ net-mgmt/nrpe2/files/nrpe2.in	(working copy)
@@ -17,7 +17,7 @@
 name=nrpe2
 rcvar=nrpe2_enable
 
-load_rc_config "${name}"
+load_rc_config nrpe2
 
 : ${nrpe2_enable:=NO}
 : ${nrpe2_configfile:=%%PREFIX%%/etc/nrpe.cfg}
@@ -26,7 +26,7 @@
 
 command="%%PREFIX%%/sbin/nrpe2"
 command_args="-c ${nrpe2_configfile} -d"
-extra_commands="reload"
+extra_commands=reload
 sig_reload=HUP
 
 start_precmd=nrpe2_prestart
@@ -37,8 +37,7 @@
 	[ -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'
@@ -51,4 +50,4 @@
 	install -d -o ${nrpe_user:-nagios} ${pidfile%/*}
 }
 
-run_rc_command "$1"
+run_rc_command $1
Index: sysutils/munin-node/files/munin-node.in
===================================================================
--- sysutils/munin-node/files/munin-node.in	(revision 316967)
+++ sysutils/munin-node/files/munin-node.in	(working copy)
@@ -15,7 +15,7 @@
 
 . /etc/rc.subr
 
-name="munin_node"
+name=munin_node
 rcvar=munin_node_enable
 
 load_rc_config $name
@@ -31,12 +31,8 @@
 
 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: sysutils/munin-node/files/munin-sched.in
===================================================================
--- sysutils/munin-node/files/munin-sched.in	(revision 316967)
+++ sysutils/munin-node/files/munin-sched.in	(working copy)
@@ -15,7 +15,7 @@
 
 . /etc/rc.subr
 
-name="munin_sched"
+name=munin_sched
 rcvar=munin_sched_enable
 
 load_rc_config $name
@@ -30,13 +30,9 @@
 
 find_pidfile()
 {
-	if type get_pidfile_from_conf >/dev/null 2>&1 &&
-		get_pidfile_from_conf pid_file $munin_sched_config; then
+	get_pidfile_from_conf pid_file $munin_sched_config
 	    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
 }
 
 run_rc_command "$1"
Index: x11/slim/files/slim.in
===================================================================
--- x11/slim/files/slim.in	(revision 316967)
+++ x11/slim/files/slim.in	(working copy)
@@ -17,31 +17,29 @@
 
 . /etc/rc.subr
 
-name="slim"
+name=slim
 rcvar=slim_enable
 
+load_rc_config slim
+
+: ${slim_enable:=NO}
+
+command=%%PREFIX%%/bin/slim
+command_args=-d
 start_precmd=${name}_rmfile
 stop_precmd=${name}_prestop
 stop_postcmd=${name}_rmfile
 
-load_rc_config $name
-
-: ${slim_enable="NO"}
-
-command=%%PREFIX%%/bin/slim
-command_args="-d"
-
 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
 
@@ -55,7 +53,7 @@
 	return 0
 }
 
-slim_prestop ()
+slim_prestop()
 {
 	local xpid
 
@@ -65,4 +63,4 @@
 	[ -n "$xpid" ] && kill $xpid
 }
 
-run_rc_command "$1"
+run_rc_command $1
--- patch.txt ends here ---



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-ports-bugs mailing list