aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroam <roam@FreeBSD.org>2004-06-29 07:07:40 +0800
committerroam <roam@FreeBSD.org>2004-06-29 07:07:40 +0800
commite4a82b477c1c9c2192f4905673b0b09ce1586f8c (patch)
tree7a82b7d6a659b019eeec9fe631e4aed52fd244bf
parent3f8106edb13c473a616cee3804199573430189f8 (diff)
downloadfreebsd-ports-gnome-e4a82b477c1c9c2192f4905673b0b09ce1586f8c.tar.gz
freebsd-ports-gnome-e4a82b477c1c9c2192f4905673b0b09ce1586f8c.tar.zst
freebsd-ports-gnome-e4a82b477c1c9c2192f4905673b0b09ce1586f8c.zip
USE_RC_SUBR.
Submitted by: nork
-rw-r--r--sysutils/daemontools/Makefile17
-rw-r--r--sysutils/daemontools/files/svscan.sh.sample84
-rw-r--r--sysutils/daemontools/pkg-plist2
3 files changed, 58 insertions, 45 deletions
diff --git a/sysutils/daemontools/Makefile b/sysutils/daemontools/Makefile
index 626914bd9402..5d667f5caaea 100644
--- a/sysutils/daemontools/Makefile
+++ b/sysutils/daemontools/Makefile
@@ -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 @@ MANCOMPRESSED= no
MAINTAINER= roam@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,19 +38,19 @@ ALL_TARGET= it
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
+ @${ECHO_CMD} "${CC} ${CFLAGS}" > ${WRKSRC}/conf-cc
+ @${ECHO_CMD} "${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:
(while read cmd; do \
- if file ${WRKSRC}/$$cmd | ${GREP} -q "shell script"; then \
+ if ${FILE} ${WRKSRC}/$$cmd | ${GREP} -q "shell script"; then \
${INSTALL_SCRIPT} ${WRKSRC}/$$cmd ${PREFIX}/bin; \
else \
${INSTALL_PROGRAM} ${WRKSRC}/$$cmd ${PREFIX}/bin; \
@@ -55,7 +58,7 @@ do-install:
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
diff --git a/sysutils/daemontools/files/svscan.sh.sample b/sysutils/daemontools/files/svscan.sh.sample
index 71fad0fed167..143423ca4b0e 100644
--- a/sysutils/daemontools/files/svscan.sh.sample
+++ b/sysutils/daemontools/files/svscan.sh.sample
@@ -1,22 +1,29 @@
#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: svscan
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
- echo "$0: Cannot determine the PREFIX" >&2
- exit 1
-fi
+# 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
+#
-# 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 /var/service as your service spool directory.
+# Check hier(7) for reasons.
# 10 Mb
#MINSEGMENT=10240
@@ -37,26 +44,29 @@ fi
#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"
diff --git a/sysutils/daemontools/pkg-plist b/sysutils/daemontools/pkg-plist
index dd5e640decb6..e32ff19da141 100644
--- a/sysutils/daemontools/pkg-plist
+++ b/sysutils/daemontools/pkg-plist
@@ -15,4 +15,4 @@ bin/envuidgid
bin/envdir
bin/setlock
bin/readproctitle
-etc/rc.d/svscan.sh.sample
+etc/rc.d/svscan.sh