ports/112246: www/www6to4 use USE_RC_SUBR

NAKAJI Hiroyuki nakaji at jp.freebsd.org
Sun Apr 29 19:00:14 UTC 2007


>Number:         112246
>Category:       ports
>Synopsis:       www/www6to4 use USE_RC_SUBR
>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:   Sun Apr 29 19:00:12 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     NAKAJI Hiroyuki
>Release:        FreeBSD 7.0-CURRENT pc98
>Organization:
>Environment:
System: FreeBSD ra333.heimat.gr.jp 7.0-CURRENT FreeBSD 7.0-CURRENT #51: Sun Mar 4 23:13:34 JST 2007 root at ra333.heimat.gr.jp:/usr/obj/usr/src/sys/RA333 pc98


	
>Description:
	I modified the startup script to rc.subr style.
	
>How-To-Repeat:
	
>Fix:

diff -urN -x CVS /usr/ports/www/www6to4/Makefile ./Makefile
--- /usr/ports/www/www6to4/Makefile	Sat Oct  7 23:51:11 2006
+++ ./Makefile	Mon Apr 30 02:31:23 2007
@@ -6,6 +6,7 @@
 
 PORTNAME=	www6to4
 PORTVERSION=	1.6
+PORTREVISION=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	ftp://ftp.pasta.cs.uit.no/pub/Vermicelli/
 
@@ -14,6 +15,8 @@
 
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION:S/./-/}
 
+USE_RC_SUBR=	www6to4
+
 post-patch:
 	@${REINPLACE_CMD} -e 's,/etc,${PREFIX}/etc,' \
 		${WRKSRC}/www6to4.c
@@ -31,9 +34,5 @@
 	${INSTALL_DATA} ${WRKSRC}/README \
 		${DOCSDIR}
 .endif
-	@if [ ! -f ${PREFIX}/etc/rc.d/www6to4.sh ]; then \
-		${ECHO} "Installing ${PREFIX}/etc/rc.d/www6to4.sh startup file."; \
-		${INSTALL_SCRIPT} -m 751 ${FILESDIR}/www6to4.sh ${PREFIX}/etc/rc.d/www6to4.sh; \
-	fi
 
 .include <bsd.port.mk>
diff -urN -x CVS /usr/ports/www/www6to4/files/www6to4.in ./files/www6to4.in
--- /usr/ports/www/www6to4/files/www6to4.in	Thu Jan  1 09:00:00 1970
+++ ./files/www6to4.in	Mon Apr 30 03:16:00 2007
@@ -0,0 +1,37 @@
+#!/bin/sh
+# $FreeBSD$
+#
+# PROVIDE: www6to4
+# REQUIRE: DAEMON
+#
+# Add the following to /etc/rc.conf[.local] to enable this service
+#
+# www6to4_enable="YES"
+#
+
+. %%RC_SUBR%%
+
+name=www6to4
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/www6to4
+WWW6TO4DIR=%%PREFIX%%/etc/www6to4
+
+www6to4_enable=${www6to4_enable:-"NO"}
+www6to4_config=${www6to4_config:-"${WWW6TO4DIR}/www6to4.conf"}
+www6to4_flags=${www6to4_flags:-"-c ${www6to4_config}"}
+www6to4_user=${www6to4_user:-"nobody"}
+www6to4_chdir=${WWW6TO4DIR}
+
+required_files=${www6to4_config}
+required_dirs=${WWW6TO4DIR}
+
+start_cmd=www6to4_start
+
+www6to4_start() {
+    checkyesno www6to4_enable && echo "Starting ${name}." && \
+    chdir ${www6to4_chdir} && su -m ${www6to4_user} -c "$command ${www6to4_flags} &"
+}
+
+load_rc_config ${name}
+run_rc_command "$1"
diff -urN -x CVS /usr/ports/www/www6to4/files/www6to4.sh ./files/www6to4.sh
--- /usr/ports/www/www6to4/files/www6to4.sh	Wed Sep 11 06:36:05 2002
+++ ./files/www6to4.sh	Thu Jan  1 09:00:00 1970
@@ -1,41 +0,0 @@
-#!/bin/sh
-# $FreeBSD: ports/www/www6to4/files/www6to4.sh,v 1.1 2002/09/10 21:36:05 obraun Exp $
-
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
-	echo "$0: Cannot determine the PREFIX" >&2
-	exit 1
-fi
-
-WWW6TO4DIR=${PREFIX}/etc/www6to4
-
-
-case $1 in
-start)
-	if [ -d ${WWW6TO4DIR} \
-	     -a -x ${PREFIX}/sbin/www6to4 \
-	     -a -f ${WWW6TO4DIR}/www6to4.conf ]; then
-		: seems OK
-	else
-		echo >&2 "$0: missing files!"
-		exit 1
-	fi
-	cd ${WWW6TO4DIR}
-	su -m nobody -c "${PREFIX}/sbin/www6to4 &" \
-	    >/dev/null \
-	&& echo -n " www6to4" \
-	|| echo " www6to4 FAILED TO START"
-	;;
-stop)
-	killall www6to4 && echo -n " www6to4"
-	;;
-restart)
-	$0 stop
-	$0 start
-	;;
-*)
-	echo "Usage: `basename $0` {start|stop}" >&2
-	exit 64
-	;;
-esac
-
-exit 0
diff -urN -x CVS /usr/ports/www/www6to4/pkg-plist ./pkg-plist
--- /usr/ports/www/www6to4/pkg-plist	Sat Oct  7 23:51:11 2006
+++ ./pkg-plist	Mon Apr 30 03:06:42 2007
@@ -1,7 +1,6 @@
 sbin/www6to4
 etc/www6to4/www6to4.conf.sample
 etc/www6to4/www6to4_forward.conf.sample
-etc/rc.d/www6to4.sh
 %%PORTDOCS%%%%DOCSDIR%%/README
 @dirrm etc/www6to4
 %%PORTDOCS%%@dirrm %%DOCSDIR%%



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



More information about the freebsd-ports-bugs mailing list