rcNG-fy sysutils/daemontools
Norikatsu Shigemura
nork at FreeBSD.org
Sat Jun 19 22:05:21 GMT 2004
I made a patch for sysutils/daemontools. Please commit.
Execuse me, I'm too sleepy. I made and tested through
the night and into the morning. Good night(morning?)! :-)
# in JST(GMT+09) :-).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/sysutils/daemontools/Makefile,v
retrieving revision 1.14
diff -u -r1.14 Makefile
--- Makefile 19 Feb 2003 16:07:29 -0000 1.14
+++ Makefile 19 Jun 2004 21:56:26 -0000
@@ -7,7 +7,7 @@
PORTNAME= daemontools
PORTVERSION= 0.76
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= sysutils
MASTER_SITES= http://cr.yp.to/daemontools/ \
ftp://cr.yp.to/daemontools/
@@ -28,6 +28,9 @@
MAINTAINER= roam at FreeBSD.org
COMMENT= "Service monitoring and logging utilities by djb"
+USE_RC_SUBR= yes
+RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} SERVICEDIR=${SERVICEDIR}
+
WRKSRC= ${WRKDIR}/admin/${DISTNAME}/src
NO_PACKAGE= "Unsure of djb\'s license"
@@ -35,14 +38,14 @@
INSTALL_TARGET= setup check
SAMPLERC= svscan.sh.sample
-SERVICEDIR?= /var/service/
+SERVICEDIR?= /var/service
post-patch:
@echo "${CC} ${CFLAGS}" > ${WRKSRC}/conf-cc
@echo "${CC} ${STRIP}" > ${WRKSRC}/conf-ld
post-build:
- @${SED} "s!/usr/local/!${PREFIX}/!;s!/var/service!${SERVICEDIR}!g" \
+ @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${FILESDIR}/${SAMPLERC} > ${WRKDIR}/${SAMPLERC}
do-install:
@@ -55,7 +58,7 @@
done) < ${WRKSRC}/../package/commands
post-install:
- @${INSTALL_SCRIPT} ${WRKDIR}/${SAMPLERC} ${PREFIX}/etc/rc.d/
+ @${INSTALL_SCRIPT} ${WRKDIR}/${SAMPLERC} ${PREFIX}/etc/rc.d/${SAMPLERC:S/.sample//}
.if !defined(WITHOUT_MAN)
@${INSTALL_MAN} ${WRKDIR}/daemontools-man/*.8 ${PREFIX}/man/man8/
.endif
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/sysutils/daemontools/pkg-plist,v
retrieving revision 1.6
diff -u -r1.6 pkg-plist
--- pkg-plist 17 Jan 2003 15:06:24 -0000 1.6
+++ pkg-plist 19 Jun 2004 21:51:44 -0000
@@ -15,4 +15,4 @@
bin/envdir
bin/setlock
bin/readproctitle
-etc/rc.d/svscan.sh.sample
+etc/rc.d/svscan.sh
Index: files/svscan.sh.sample
===================================================================
RCS file: /home/ncvs/ports/sysutils/daemontools/files/svscan.sh.sample,v
retrieving revision 1.3
diff -u -r1.3 svscan.sh.sample
--- files/svscan.sh.sample 28 Jan 2002 19:37:14 -0000 1.3
+++ files/svscan.sh.sample 19 Jun 2004 21:56:10 -0000
@@ -1,22 +1,29 @@
#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: svscan
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD
+
+# Define these svscan_* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/svscan
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
- echo "$0: Cannot determine the PREFIX" >&2
- exit 1
-fi
-
-# It would really, really be a Good Thing(tm)
-# for you to enable some of the below
-# control variables and the apropriate ulimit.
+# It would really, really be a Good Thing(tm) for you to enable some
+# of the below control variables and the apropriate ulimit.
# These are only examples.
-# Furthermore, you should think about additional
-# limits you might need.
-# Or, check login.conf(5) for a suitable
-# alternative
+# Furthermore, you should think about additional limits you might need.
+# Or, check login.conf(5) for a suitable alternative.
+# If you want to use these examples, please place into /etc/rc.conf.d/svscan.
#
-# I really do suggest you use /var/service as your
-# service spool directory. Check hier(7) for
-# reasons.
+# I really do suggest you use %%SERVICEDIR%% as your service spool directory.
+# Check hier(7) for reasons.
# 10 Mb
#MINSEGMENT=10240
@@ -37,26 +44,29 @@
#ulimit -s ${MINSEGMENT}
#ulimit -u ${MAXCHILD}
-KILLALL=/usr/bin/killall
-SVC=${PREFIX}/bin/svc
-SVPROC=svscan
-SVSCAN=$PREFIX/bin/svscan
-READPROCTITLE=$PREFIX/bin/readproctitle
-SVDIR=/var/service
-
-case "$1" in
- start)
- echo -n " svscan"
- exec env PATH=$PREFIX/sbin:$PREFIX/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH /bin/csh -cf "$SVSCAN $SVDIR |& $READPROCTITLE service errors: ................................................................................................................................................................................................................................................................................................................................................................................................................ &" > /dev/null
- ;;
-
- stop)
- echo -n " svscan: "
- $KILLALL $SVPROC
- $SVC -dx $SVDIR/* $SVDIR/*/log
- ;;
-
- *)
- echo "Usage: $0 start | stop"
- ;;
-esac
+. %%RC_SUBR%%
+
+name="svscan"
+rcvar=`set_rcvar`
+command="%%PREFIX%%/bin/svscan"
+svscan_enable="NO"
+svscan_servicedir="%%SERVICEDIR%%"
+
+start_cmd="svscan_start"
+stop_postcmd="svscan_stop_post"
+
+load_rc_config $name
+
+required_dirs="${svscan_servicedir}"
+
+svscan_start () {
+ /usr/bin/env \
+ PATH=%%PREFIX%%/sbin:%%PREFIX%%/bin:/usr/sbin:/usr/bin:/sbin:/bin \
+ /bin/csh -cf "$command $svscan_servicedir |& %%PREFIX%%/bin/readproctitle service errors: ................................................................................................................................................................................................................................................................................................................................................................................................................ &" > /dev/null
+}
+
+svscan_stop_post () {
+ %%PREFIX%%/bin/svc -dx `/bin/ls -d $svscan_servicedir/* $svscan_servicedir/*/log 2>/dev/null`
+}
+
+run_rc_command "$1"
More information about the freebsd-ports
mailing list