aboutsummaryrefslogtreecommitdiff
path: root/net/cvsup-mirror
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2005-12-09 14:49:43 +0000
committerPav Lucistnik <pav@FreeBSD.org>2005-12-09 14:49:43 +0000
commitda4839ee4b10fdc9deae71b6ea3a6c5290c1f4d3 (patch)
treea932e2cfb5e8272dfb3426572c781e49ea5ab23b /net/cvsup-mirror
parente36f307c94e3d4400319a98fa0ce77268f8954ff (diff)
downloadports-da4839ee4b10fdc9deae71b6ea3a6c5290c1f4d3.tar.gz
ports-da4839ee4b10fdc9deae71b6ea3a6c5290c1f4d3.zip
Notes
Diffstat (limited to 'net/cvsup-mirror')
-rw-r--r--net/cvsup-mirror/Makefile7
-rw-r--r--net/cvsup-mirror/files/cvsupd.sh29
-rw-r--r--net/cvsup-mirror/files/cvsupd.sh.in50
-rw-r--r--net/cvsup-mirror/pkg-plist1
4 files changed, 53 insertions, 34 deletions
diff --git a/net/cvsup-mirror/Makefile b/net/cvsup-mirror/Makefile
index 99095a3ee837..eecd3ee3145b 100644
--- a/net/cvsup-mirror/Makefile
+++ b/net/cvsup-mirror/Makefile
@@ -7,7 +7,7 @@
PORTNAME= cvsup-mirror
PORTVERSION= 1.3
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= net
DISTFILES=
@@ -22,9 +22,10 @@ IS_INTERACTIVE= true
NO_PACKAGE= too interactive
SCRIPTS_ENV= USA_RESIDENT=${USA_RESIDENT}
+USE_RC_SUBR= cvsupd.sh
+
base=${PREFIX}/etc/cvsup
distrib=${base}/sup.client/distrib
-rc=${PREFIX}/etc/rc.d
do-extract:
@test -d ${WRKSRC} || ${MKDIR} ${WRKSRC}
@@ -32,13 +33,11 @@ do-extract:
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:
diff --git a/net/cvsup-mirror/files/cvsupd.sh b/net/cvsup-mirror/files/cvsupd.sh
deleted file mode 100644
index 51bd87cc36f3..000000000000
--- a/net/cvsup-mirror/files/cvsupd.sh
+++ /dev/null
@@ -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 --git a/net/cvsup-mirror/files/cvsupd.sh.in b/net/cvsup-mirror/files/cvsupd.sh.in
new file mode 100644
index 000000000000..78a666879bf7
--- /dev/null
+++ b/net/cvsup-mirror/files/cvsupd.sh.in
@@ -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 --git a/net/cvsup-mirror/pkg-plist b/net/cvsup-mirror/pkg-plist
index af30ff53e792..9b745f477ec4 100644
--- a/net/cvsup-mirror/pkg-plist
+++ b/net/cvsup-mirror/pkg-plist
@@ -3,4 +3,3 @@ etc/cvsup/cvsupd.access
etc/cvsup/sup.client/distrib/refuse.self
etc/cvsup/supfile
etc/cvsup/update.sh
-etc/rc.d/cvsupd.sh