ports/157173: audio/musicpd: wait --kill to finish (FreeBSD-only)
Doug Barton
dougb at FreeBSD.org
Sat May 21 18:20:09 UTC 2011
The following reply was made to PR ports/157173; it has been noted by GNATS.
From: Doug Barton <dougb at FreeBSD.org>
To: utisoft at gmail.com
Cc: bug-followup at freebsd.org
Subject: Re: ports/157173: audio/musicpd: wait --kill to finish (FreeBSD-only)
Date: Sat, 21 May 2011 11:17:48 -0700
This is a multi-part message in MIME format.
--------------000801040306000102040602
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
On 05/21/2011 00:43, Chris Rees wrote:
> OK, patch attached:
>
> I've taken advice from freebsd-rc and used the get_pidfile_from_conf
> function, with a default of whatever is default in %%MPDCONF%%. I've
> also removed the $FreeBSD$ line from musicpd.in -- it's no longer
> necessary or desirable according to dougb.
Umm, I never said that. :) In fact I've said the opposite. What you may
be thinking of is my dislike for default-empty variable assignments.
I took a look at the script and the patch looks fine. I made one
micro-optimization in the attached patch. Since there is no
user-variable for the conf file there is no point in having it as a
variable in the script.
> Many thanks to dougb@ for the advice.
My pleasure. :)
Doug
> - Fix stop function in rc script
>
> PR: ports/157173
> Noticed by: Zhihao Yuan<lichray at gmail.com>
>
> Chris
--
Nothin' ever doesn't change, but nothin' changes much.
-- OK Go
Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price. :) http://SupersetSolutions.com/
--------------000801040306000102040602
Content-Type: text/plain;
name="musicpd.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="musicpd.diff"
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/audio/musicpd/Makefile,v
retrieving revision 1.63
diff -u -r1.63 Makefile
--- Makefile 16 May 2011 13:32:35 -0000 1.63
+++ Makefile 21 May 2011 18:13:21 -0000
@@ -7,7 +7,7 @@
PORTNAME= musicpd
PORTVERSION= 0.16.2
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= audio ipv6
MASTER_SITES= SF/${PORTNAME}/mpd/${PORTVERSION}
DISTNAME= mpd-${PORTVERSION}
Index: files/musicpd.in
===================================================================
RCS file: /home/pcvs/ports/audio/musicpd/files/musicpd.in,v
retrieving revision 1.7
diff -u -r1.7 musicpd.in
--- files/musicpd.in 16 May 2011 13:32:35 -0000 1.7
+++ files/musicpd.in 21 May 2011 18:13:21 -0000
@@ -1,6 +1,6 @@
#!/bin/sh
-#
-# $FreeBSD: ports/audio/musicpd/files/musicpd.in,v 1.7 2011/05/16 13:32:35 nivit Exp $
+
+# $FreeBSD$
#
# PROVIDE: musicpd
# REQUIRE: mixer LOGIN avahi_daemon
@@ -8,28 +8,31 @@
# Add the following line to /etc/rc.conf to enable mpd:
#
-#musicpd_enable="YES"
+# musicpd_enable="YES"
. /etc/rc.subr
name=musicpd
rcvar=`set_rcvar`
-stop_cmd="${name}_stop"
+start_precmd="${name}_getpidfile"
+stop_precmd="${name}_getpidfile"
-config=%%PREFIX%%/etc/%%MPDCONF%%
command=%%PREFIX%%/bin/musicpd
-required_files=$config
+command_args=%%PREFIX%%/etc/%%MPDCONF%%
+required_files=%%PREFIX%%/etc/%%MPDCONF%%
-musicpd_stop()
+musicpd_getpidfile()
{
- echo -n "Stopping musicpd: ";
- ${command} --kill ${config} && echo "stopped.";
+ if type get_pidfile_from_conf >/dev/null 2>&1 &&
+ get_pidfile_from_conf pid_file %%PREFIX%%/etc/%%MPDCONF%% ; then
+ pidfile="$_pidfile_from_conf"
+ else
+ pidfile="%%MPDDIR%%/.mpd/pid"
+ fi
}
load_rc_config $name
: ${musicpd_enable="NO"}
-command_args="$config"
-
run_rc_command "$1"
--------------000801040306000102040602--
More information about the freebsd-ports-bugs
mailing list