ports/67052: rcNG'fy totd

Hajimu UMEMOTO ume at FreeBSD.org
Sat May 22 17:01:00 UTC 2004


>Number:         67052
>Category:       ports
>Synopsis:       rcNG'fy totd
>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:   Sat May 22 10:00:48 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Hajimu UMEMOTO
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
Internet Mutual Aid Society, YOKOHAMA
>Environment:
System: FreeBSD lyrics.mahoroba.org 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Sat May 22 20:17:55 JST 2004 root at lyrics.mahoroba.org:/ad0s3/usr/obj/usr/src/sys/LYRICS i386
>Description:
The totd port is not rcNG aware yet.
>How-To-Repeat:
invoking /usr/local/etc/rc.d/totd.sh
>Fix:
Please apply following patch to net/totd:

Index: Makefile
diff -u Makefile.orig Makefile
--- Makefile.orig	Sat Sep 27 03:16:51 2003
+++ Makefile	Sun May 23 01:12:29 2004
@@ -6,6 +6,7 @@
 
 PORTNAME=	totd
 PORTVERSION=	1.4
+PORTREVISION=	1
 CATEGORIES=	dns ipv6
 MASTER_SITES=	ftp://ftp.pasta.cs.uit.no/pub/Vermicelli/
 
@@ -14,11 +15,15 @@
 
 MAN8=		totd.8
 
+USE_RC_SUBR=	YES
 GNU_CONFIGURE=	YES
 
+RC_SCRIPTS_SUB=	PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
+
 post-install:
 	${INSTALL_DATA} ${FILESDIR}/totd.conf.sample ${PREFIX}/etc
-	@${SED} 's@%PREFIX%@${LOCALBASE}@g' ${FILESDIR}/totd.sh > ${PREFIX}/etc/rc.d/totd.sh
-	@${CHMOD} +x ${PREFIX}/etc/rc.d/totd.sh
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		${FILESDIR}/totd.sh > ${PREFIX}/etc/rc.d/totd.sh
+	@${CHMOD} ${BINMODE} ${PREFIX}/etc/rc.d/totd.sh
 
 .include <bsd.port.mk>
Index: files/totd.sh
diff -u files/totd.sh.orig files/totd.sh
--- files/totd.sh.orig	Mon Nov  4 00:51:39 2002
+++ files/totd.sh	Sun May 23 01:43:52 2004
@@ -1,18 +1,37 @@
 #!/bin/sh
+#
+# $FreeBSD$
+#
 
-case "$1" in
-	start)
-		if [ -x %PREFIX%/sbin/totd ]; then
-			%PREFIX%/sbin/totd && echo -n ' totd'
-		fi
-	;;
-
-	stop)
-		/usr/bin/killall totd && echo -n ' totd'
-	;;
-	
-	*)
-		echo "Usage: `basename $0` { start | stop }"
-		exit 64
-	;;
-esac
+# PROVIDE: totd
+# REQUIRE: SERVERS
+# BEFORE:  DAEMON
+# KEYWORD: FreeBSD
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts
+# move totd.sh to /etc/rc.d/totd
+
+prefix=%%PREFIX%%
+
+# Define these totd_* variables in one of these files:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/totd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+totd_enable=${totd_enable:-"NO"}		# Enable totd
+#totd_program="${prefix}/sbin/totd"		# Location of totd
+totd_flags=${totd_flags:-""}			# Flags to totd program
+
+. %%RC_SUBR%%
+
+name="totd"
+rcvar=`set_rcvar`
+command="${prefix}/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="${prefix}/etc/${name}.conf"
+
+load_rc_config $name
+run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list