USE_RC_SUBR.
Submitted by: nork
This commit is contained in:
parent
97e77bbe74
commit
722d36ed3b
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=112506
3 changed files with 58 additions and 45 deletions
|
@ -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
|
||||
|
|
|
@ -1,22 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
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.
|
||||
# These are only examples.
|
||||
# Furthermore, you should think about additional
|
||||
# limits you might need.
|
||||
# Or, check login.conf(5) for a suitable
|
||||
# alternative
|
||||
#
|
||||
# I really do suggest you use /var/service as your
|
||||
# service spool directory. Check hier(7) for
|
||||
# reasons.
|
||||
# $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
|
||||
#
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
# 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
|
||||
. %%RC_SUBR%%
|
||||
|
||||
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
|
||||
;;
|
||||
name="svscan"
|
||||
rcvar=`set_rcvar`
|
||||
command="%%PREFIX%%/bin/svscan"
|
||||
svscan_enable="NO"
|
||||
svscan_servicedir="%%SERVICEDIR%%"
|
||||
|
||||
stop)
|
||||
echo -n " svscan: "
|
||||
$KILLALL $SVPROC
|
||||
$SVC -dx $SVDIR/* $SVDIR/*/log
|
||||
;;
|
||||
start_cmd="svscan_start"
|
||||
stop_postcmd="svscan_stop_post"
|
||||
|
||||
*)
|
||||
echo "Usage: $0 start | stop"
|
||||
;;
|
||||
esac
|
||||
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"
|
||||
|
|
|
@ -15,4 +15,4 @@ bin/envuidgid
|
|||
bin/envdir
|
||||
bin/setlock
|
||||
bin/readproctitle
|
||||
etc/rc.d/svscan.sh.sample
|
||||
etc/rc.d/svscan.sh
|
||||
|
|
Loading…
Reference in a new issue