ports/89316: [patch] add RCng script to net/cvsup-mirror

Petr Rehor prehor at gmail.com
Sun Nov 20 15:30:24 UTC 2005


>Number:         89316
>Category:       ports
>Synopsis:       [patch] add RCng script to net/cvsup-mirror
>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 Nov 20 15:30:23 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Petr Rehor
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD charon.rx.cz 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Tue Nov 8 20:44:39 UTC 2005 root at marvin.rx.cz:/usr/obj/usr/src/sys/GENERIC i386
>Description:
It would be great to use a right rcNG script for this port!
>How-To-Repeat:
>Fix:

This patch remove files/cvsup.sh and add new RCng script files/cvsup.sh.in.

--- cvsup-mirror.diff begins here ---
diff -urN /usr/ports/net/cvsup-mirror/Makefile ./Makefile
--- /usr/ports/net/cvsup-mirror/Makefile	Fri Aug  6 01:37:47 2004
+++ ./Makefile	Sun Nov 20 13:47:03 2005
@@ -7,7 +7,7 @@
 
 PORTNAME=	cvsup-mirror
 PORTVERSION=	1.3
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	net
 DISTFILES=
 
@@ -21,10 +21,17 @@
 IS_INTERACTIVE=	true
 NO_PACKAGE=	too interactive
 SCRIPTS_ENV=	USA_RESIDENT=${USA_RESIDENT}
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_RCORDER) && ${OSVERSION} >= 500038
+USE_RCORDER=	cvsupd.sh
+.else
+USE_RC_SUBR=	cvsupd.sh
+.endif
 
 base=${PREFIX}/etc/cvsup
 distrib=${base}/sup.client/distrib
-rc=${PREFIX}/etc/rc.d
 
 do-extract:
 	@test -d ${WRKSRC} || ${MKDIR} ${WRKSRC}
@@ -32,16 +38,14 @@
 do-install:
 	@${ECHO_MSG} "Installing files"
 	@test -d ${distrib} || ${MKDIR} ${distrib}
-	@test -d ${rc} || ${MKDIR} ${rc}
 	@${INSTALL_DATA} ${WRKSRC}/config.sh ${base}
 	@${INSTALL_DATA} ${WRKSRC}/cvsupd.access ${base}
 	@${INSTALL_SCRIPT} ${FILESDIR}/update.sh ${base}
 	@${INSTALL_DATA} ${FILESDIR}/supfile ${base}
 	@${INSTALL_DATA} ${FILESDIR}/refuse.self ${distrib}
-	@${INSTALL_SCRIPT} ${FILESDIR}/cvsupd.sh ${rc}
 	@${CP} /dev/null ${base}/.start_server
 
 post-install:
 	@PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -urN /usr/ports/net/cvsup-mirror/files/cvsupd.sh ./files/cvsupd.sh
--- /usr/ports/net/cvsup-mirror/files/cvsupd.sh	Mon Nov 11 18:21:29 2002
+++ ./files/cvsupd.sh	Thu Jan  1 01:00:00 1970
@@ -1,29 +0,0 @@
-#! /bin/sh
-
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/cvsupd\.sh\$"); then
-    echo "$0: Cannot determine the PREFIX" >&2
-    exit 1
-fi
-base=${PREFIX}/etc/cvsup
-rundir=/var/run
-out=${rundir}/cvsupd.out
-
-export PATH=/bin:/usr/bin:${PREFIX}/sbin
-umask 2
-
-test -x ${PREFIX}/sbin/cvsupd || exit 1
-echo -n " cvsupd"
-cd ${rundir} || exit
-. ${base}/config.sh || exit
-
-arg=${1:-start}
-case $arg in
-start)
-    (umask 22 && touch ${out}) || exit
-    su -f -m ${user} -c \
-	"cvsupd -e -C 100 -l @${facility} -b ${base} -s sup.client" \
-	>>${out} 2>&1;;
-
-stop)
-    killall cvsupd;;
-esac
diff -urN /usr/ports/net/cvsup-mirror/files/cvsupd.sh.in ./files/cvsupd.sh.in
--- /usr/ports/net/cvsup-mirror/files/cvsupd.sh.in	Thu Jan  1 01:00:00 1970
+++ ./files/cvsupd.sh.in	Sun Nov 20 12:56:29 2005
@@ -0,0 +1,50 @@
+#! /bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: cvsupd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable cvsupd:
+#
+#cvsupd_enable="YES"
+
+. %%RC_SUBR%%
+
+name="cvsupd"
+rcvar=`set_rcvar`
+
+load_rc_config $name
+
+# Load defaults from cvsupd config file
+base="%%PREFIX%%/etc/cvsup"
+if [ ! -r "${base}/config.sh" ]; then
+	err 1 "${base}/config.sh is not readable."
+fi
+. ${base}/config.sh
+
+# Set defaults
+: ${cvsupd_enable:=NO}
+: ${cvsupd_outfile=/var/run/${name}.out}
+: ${cvsupd_user:=${user:-cvsup}}
+
+command="%%PREFIX%%/sbin/cvsupd"
+command_args="-e -C ${maxclients:-8} -l @${facility:-daemon} \
+	-b ${base:-/home/ncvs} -s sup.client"
+stop_cmd="cvsupd_stop"
+
+cvsupd_stop() {
+	if [ -z "$rc_pid" ]; then
+		echo "${name} not running?"
+		exit 1
+	fi
+	echo "Stopping ${name}."
+	killall $name
+	_return=$?
+	[ "$_return" -ne 0 ] && [ -z "$rc_force" ] && return 1
+}
+
+run_rc_command "$1"
diff -urN /usr/ports/net/cvsup-mirror/pkg-plist ./pkg-plist
--- /usr/ports/net/cvsup-mirror/pkg-plist	Sun Jul  9 19:57:32 2000
+++ ./pkg-plist	Sun Nov 20 13:09:32 2005
@@ -3,4 +3,3 @@
 etc/cvsup/sup.client/distrib/refuse.self
 etc/cvsup/supfile
 etc/cvsup/update.sh
-etc/rc.d/cvsupd.sh
--- cvsup-mirror.diff ends here ---


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



More information about the freebsd-ports-bugs mailing list