From owner-freebsd-ports-bugs@FreeBSD.ORG Sat May 21 18:20:09 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF2A21065670 for ; Sat, 21 May 2011 18:20:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id BF39F8FC0C for ; Sat, 21 May 2011 18:20:08 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p4LIK8hm088160 for ; Sat, 21 May 2011 18:20:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p4LIK85U088159; Sat, 21 May 2011 18:20:08 GMT (envelope-from gnats) Date: Sat, 21 May 2011 18:20:08 GMT Message-Id: <201105211820.p4LIK85U088159@freefall.freebsd.org> To: freebsd-ports-bugs@FreeBSD.org From: Doug Barton Cc: Subject: Re: ports/157173: audio/musicpd: wait --kill to finish (FreeBSD-only) X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Doug Barton List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 May 2011 18:20:09 -0000 The following reply was made to PR ports/157173; it has been noted by GNATS. From: Doug Barton To: utisoft@gmail.com Cc: bug-followup@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 > > 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--