Subject: pkg/20940: rc.d stuff for audio/icecast
To: None <gnats-bugs@gnats.netbsd.org>
From: David Ferlier <david@netbsd-fr.org>
List: netbsd-bugs
Date: 03/30/2003 14:49:46
>Number:         20940
>Category:       pkg
>Synopsis:       rc.d stuff for audio/icecast
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 30 04:52:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     David Ferlier
>Release:        NetBSD 1.6
>Organization:
>Environment:
System: NetBSD hell 1.6 NetBSD 1.6 (CATAPULT) #0: Sat Dec 14 20:38:30 CET 2002 root@hell:/usr/src/sys/arch/i386/compile/CATAPULT i386
>Description:

audio/icecast has no rc.d system, while it is very easy to add one.

Basically, icecast has console_mode = 0 in its configuration file, and it
makes it behave interactively (you get a console). I add -b to the list of
flags so it goes into the background, overriding console_mode (before i had
patched icecast.conf.dist.in to put console_mode 3, but as jmmv said, that
was far to be perfect).

Attached is the rc.d script + the patch to make it use it (with RCD_SCRIPTS
+ USE_PKGINSTALL)

>How-To-Repeat:

>Fix:

Here is the patch:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/audio/icecast/Makefile,v
retrieving revision 1.9
diff -b -u -r1.9 Makefile
--- Makefile	2002/10/09 11:41:31	1.9
+++ Makefile	2003/03/30 12:22:15
@@ -10,6 +10,7 @@
 COMMENT=	Internet broadcasting system using Mpeg Layer III streaming
 
 USE_BUILDLINK2=		# defined
+USE_PKGINSTALL=		YES
 GNU_CONFIGURE=		# defined
 CONFIGURE_ARGS+=	--with-readline \
 			--with-libwrap \
@@ -19,6 +20,7 @@
 LDFLAGS+=		${BUILDLINK_LDFLAGS.${PYPACKAGE}}
 LIBS+=			-lutil
 PTHREAD_OPTS+=		native
+RCD_SCRIPTS=		icecast
 
 .include "../../devel/readline/buildlink2.mk"
 .include "../../lang/python/application.mk"
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/audio/icecast/PLIST,v
retrieving revision 1.3
diff -b -u -r1.3 PLIST
--- PLIST	2002/06/26 10:29:33	1.3
+++ PLIST	2003/03/30 12:22:16
@@ -1,9 +1,10 @@
-@comment $NetBSD: PLIST,v 1.3 2002/06/26 10:29:33 seb Exp $
+@comment $NetBSD$
 bin/icecast
 etc/icecast/groups.aut.dist
 etc/icecast/icecast.conf.dist
 etc/icecast/mounts.aut.dist
 etc/icecast/users.aut.dist
+etc/rc.d/icecast
 share/doc/icecast/manual.html
 share/icecast/templates/306.html
 share/icecast/templates/400.html
@@ -24,8 +25,5 @@
 share/icecast/templates/mountlist.html
 share/icecast/templates/statistics.html
 @dirrm share/icecast/templates
-@exec ${MKDIR} %D/share/icecast/static
-@dirrm share/icecast/static
-@dirrm share/icecast
 @dirrm share/doc/icecast
 @dirrm etc/icecast

And the rc.d script:

#!/bin/sh
#
# PROVIDE: icecast
# REQUIRE: DAEMON LOGIN network

name="icecast"
command="@PREFIX@/bin/${name}"
mainconfigfile="@PREFIX@/etc/${name}/${name}.conf"
icecast_flags="-c ${mainconfigfile} -d @PREFIX@/etc/${name} -b"
sig_stop="KILL"

. /etc/rc.subr

pidfile="/var/run/${name}.pid"
required_files="${mainconfigfile}"

load_rc_config $name
run_rc_command "$1"

if [ "$1" != "stop" ]; then
	echo $(check_process $command) > $pidfile
fi

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