Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Apr 2004 18:04:03 +0400 (MSD)
From:      Alex Kapranoff <kappa@vvs01.agava.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        clement@FreeBSD.org
Subject:   ports/65624: rc.subrify dns/maradns port
Message-ID:  <20040416140403.0BEF6146BC@vvs01.agava.net>
Resent-Message-ID: <200404161410.i3GEAVqX075469@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         65624
>Category:       ports
>Synopsis:       rc.subrify dns/maradns port
>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:   Fri Apr 16 07:10:30 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Alex Kapranoff
>Release:        FreeBSD 4.8-RELEASE-p13 i386
>Organization:
Inner Mongolia
>Environment:
System: FreeBSD vvs01.agava.net 4.8-RELEASE-p13 FreeBSD 4.8-RELEASE-p13 #0: Wed Mar 10 11:50:47 MSK 2004 ivan@savior.agava.net:/opt2/usr/obj/opt2/usr/src/sys/SAVIOR i386


	
>Description:
	
This patch does:
1. Make dns/maradns startup script use rc.subr(8).
2. Provide additional startup script for zoneserver(8) program
needed to run an authorative primary nameserver.
3. Both these scripts pipe programs' output into logger(1) so
that maradns logs into syslog.
4. Installs an example zonefile in maradns (csv1) format.
5. Replaces several ${MKDIR}s with one ${MKDIR} -p.

I don't think that a repocopy of maradns.sh.sample is needed as
the new script is a complete rewrite from scratch.

>How-To-Repeat:
	
>Fix:

	


diff -ruN /usr/ports/dns/maradns/Makefile maradns/Makefile
--- /usr/ports/dns/maradns/Makefile	Thu Apr 15 12:12:38 2004
+++ maradns/Makefile	Sat Apr 17 00:43:58 2004
@@ -20,6 +20,10 @@
 USE_BZIP2=	yes
 MAKE_ENV=	FLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
 
+USE_RC_SUBR=	yes
+RC_SCRIPTS_SUB=	PREFIX=${PREFIX} \
+		RC_SUBR=${RC_SUBR}
+
 MAN1=	askmara.1 getzone.1
 MAN5=	mararc.5
 MAN8=	maradns.8 zoneserver.8
@@ -44,35 +48,41 @@
 	${INSTALL_MAN} ${WRKSRC}/doc/en/man/mararc.5 ${MANPREFIX}/man/man5
 	${INSTALL_MAN} ${WRKSRC}/doc/en/man/maradns.8 ${MANPREFIX}/man/man8
 	${INSTALL_MAN} ${WRKSRC}/doc/en/man/zoneserver.8 ${MANPREFIX}/man/man8
-	${INSTALL_SCRIPT} ${FILESDIR}/maradns.sh.sample ${PREFIX}/etc/rc.d
+	${MKDIR} ${PREFIX}/etc/maradns
+	${INSTALL_DATA} ${WRKSRC}/doc/en/examples/example_csv1 \
+		${PREFIX}/etc/maradns/example_csv1
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		'-e s!%%SERVICE%%!maradns!g' \
+		${FILESDIR}/rc_d.sh > ${PREFIX}/etc/rc.d/maradns.sh
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		'-e s!%%SERVICE%%!zoneserver!g' \
+		${FILESDIR}/rc_d.sh > ${PREFIX}/etc/rc.d/zoneserver.sh
+	@${CHMOD} 755 ${PREFIX}/etc/rc.d/maradns.sh
+	@${CHMOD} 755 ${PREFIX}/etc/rc.d/zoneserver.sh
+
 .ifndef(NOPORTDOCS)
-	@${MKDIR} ${DOCSDIR}
+	@${MKDIR} -p ${DOCSDIR}/en/misc/spammers/hiddenonline
 	${INSTALL_DATA} ${WRKSRC}/00README.FIRST ${DOCSDIR}
 	${INSTALL_DATA} ${WRKSRC}/TODO.* ${DOCSDIR}
-	@${MKDIR} ${DOCSDIR}/en
 	${INSTALL_DATA} ${WRKSRC}/doc/en/QuickStart ${DOCSDIR}/en
 	${INSTALL_DATA} ${WRKSRC}/doc/en/README ${DOCSDIR}/en
 	${INSTALL_DATA} ${WRKSRC}/doc/en/faq.* ${DOCSDIR}/en
 	@${MKDIR} ${DOCSDIR}/en/examples
 	${INSTALL_DATA} ${WRKSRC}/doc/en/examples/example_* \
 		${DOCSDIR}/en/examples
-	@${MKDIR} ${DOCSDIR}/en/misc
 	${INSTALL_DATA} ${WRKSRC}/doc/en/misc/0README ${DOCSDIR}/en/misc
 	${INSTALL_DATA} ${WRKSRC}/doc/en/misc/recursive-case-insensitive \
 		${DOCSDIR}/en/misc
 	${INSTALL_DATA} ${WRKSRC}/doc/en/*.* ${DOCSDIR}/en/misc
-	@${MKDIR} ${DOCSDIR}/en/misc/spammers
 	${INSTALL_DATA} ${WRKSRC}/doc/en/misc/spammers/*.* \
 		${DOCSDIR}/en/misc/spammers
-	@${MKDIR} ${DOCSDIR}/en/misc/spammers/hiddenonline
 	${INSTALL_DATA} ${WRKSRC}/doc/en/misc/spammers/hiddenonline/*.* \
 		${DOCSDIR}/en/misc/spammers/hiddenonline
 	@${MKDIR} ${DOCSDIR}/en/tutorial
 	${INSTALL_DATA} ${WRKSRC}/doc/en/tutorial/*.* ${DOCSDIR}/en/tutorial
-	@${MKDIR} ${DOCSDIR}/fr
+	@${MKDIR} -p ${DOCSDIR}/fr/tutorial
 	${INSTALL_DATA} ${WRKSRC}/doc/fr/QuickStart ${DOCSDIR}/fr
 	${INSTALL_DATA} ${WRKSRC}/doc/fr/faq.* ${DOCSDIR}/fr
-	@${MKDIR} ${DOCSDIR}/fr/tutorial
 	${INSTALL_DATA} ${WRKSRC}/doc/fr/tutorial/*.* ${DOCSDIR}/fr/tutorial
 .endif
 
diff -ruN /usr/ports/dns/maradns/files/maradns.sh.sample maradns/files/maradns.sh.sample
--- /usr/ports/dns/maradns/files/maradns.sh.sample	Sat Apr 10 00:11:17 2004
+++ maradns/files/maradns.sh.sample	Thu Jan  1 03:00:00 1970
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
-    echo "$0: Cannot determine the PREFIX" >&2
-    exit 1
-fi
-
-case "$1" in
-start)
-	if [ -x ${PREFIX}/sbin/maradns ]; then
-		${PREFIX}/sbin/maradns > /var/log/maradns.log &
-		echo -n ' maradns'
-	fi;
-	;;
-stop)
-	killall maradns && echo -n ' maradns'
-	;;
-*)
-	echo "Usage: `basename $0` {start|stop}" >&2
-	;;
-esac
-
-exit 0
diff -ruN /usr/ports/dns/maradns/files/rc_d.sh maradns/files/rc_d.sh
--- /usr/ports/dns/maradns/files/rc_d.sh	Thu Jan  1 03:00:00 1970
+++ maradns/files/rc_d.sh	Sat Apr 17 00:43:58 2004
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: %%SERVICE%%
+# REQUIRE: SERVERS
+# BEFORE: DAEMON
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts
+# move %%SERVICE%%.sh to /etc/rc.d/%%SERVICE%%
+
+prefix=%%PREFIX%%
+
+# Define these %%SERVICE%%_* variables in one of these files:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/%%SERVICE%%
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+%%SERVICE%%_enable=${%%SERVICE%%_enable:-"NO"}
+%%SERVICE%%_flags=${%%SERVICE%%_flags:-""}	# Can be "-f /path/alternate_rc"
+
+. %%RC_SUBR%%
+
+name="%%SERVICE%%"
+rcvar=`set_rcvar`
+command="${prefix}/sbin/${name}"
+command_args="| /usr/bin/logger -p daemon.notice -t %%SERVICE%% &"
+
+load_rc_config $name
+
+flags="${%%SERVICE%%_flags}"
+
+run_rc_command "$1"
diff -ruN /usr/ports/dns/maradns/pkg-plist maradns/pkg-plist
--- /usr/ports/dns/maradns/pkg-plist	Sat Apr 10 00:11:17 2004
+++ maradns/pkg-plist	Sat Apr 17 00:43:58 2004
@@ -1,7 +1,10 @@
 @comment $FreeBSD: ports/dns/maradns/pkg-plist,v 1.14 2003/11/11 16:49:01 sergei Exp $
 bin/askmara
 etc/mararc.sample
-etc/rc.d/maradns.sh.sample
+etc/rc.d/maradns.sh
+etc/rc.d/zoneserver.sh
+etc/maradns/example_csv1
+@dirrm etc/maradns
 sbin/getzone
 sbin/maradns
 sbin/zoneserver
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040416140403.0BEF6146BC>