aboutsummaryrefslogtreecommitdiff
path: root/sysutils/runit
diff options
context:
space:
mode:
authorSergei Kolobov <sergei@FreeBSD.org>2005-02-27 12:06:59 +0000
committerSergei Kolobov <sergei@FreeBSD.org>2005-02-27 12:06:59 +0000
commit6685d318be80f00e4980b58e8eb3b3fe08a54730 (patch)
tree64c1170305d04f301d851c83a96242768ac6440c /sysutils/runit
parentef6238a4429872bed536c31485065572d0f759b9 (diff)
downloadports-6685d318be80f00e4980b58e8eb3b3fe08a54730.tar.gz
ports-6685d318be80f00e4980b58e8eb3b3fe08a54730.zip
Notes
Diffstat (limited to 'sysutils/runit')
-rw-r--r--sysutils/runit/Makefile8
-rw-r--r--sysutils/runit/files/runsvdir.sh.in67
-rw-r--r--sysutils/runit/pkg-plist1
3 files changed, 48 insertions, 28 deletions
diff --git a/sysutils/runit/Makefile b/sysutils/runit/Makefile
index 73b78f24f108..9bea93e4e39a 100644
--- a/sysutils/runit/Makefile
+++ b/sysutils/runit/Makefile
@@ -7,12 +7,14 @@
PORTNAME= runit
PORTVERSION= 1.2.1
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://smarden.org/${PORTNAME}/
MAINTAINER= sergei@FreeBSD.org
-COMMENT= A init scheme with service supervision
+COMMENT= Service supervision tools compatible with DJB daemontools
+USE_RC_SUBR= runsvdir.sh
WRKSRC= ${WRKDIR}/admin/${DISTNAME}
ALL_TARGET= default
@@ -32,9 +34,6 @@ do-configure:
do-build:
cd ${WRKSRC} && package/compile && package/check
@${MKDIR} ${WRKDIR}/etc/getty-ttyv4
- @${SED} -e 's!%%PREFIX%%!${PREFIX}!' \
- -e 's!%%SERVICE_DIR%%!${SERVICE_DIR}!' \
- ${FILESDIR}/runsvdir.sh.in > ${WRKDIR}/runsvdir.sh.sample
.for file in ${CONFIG}
@${SED} -e 's!/etc/runit!${PREFIX}/etc/runit!g' \
-e 's!/service!${SERVICE_DIR}!g' \
@@ -45,7 +44,6 @@ do-build:
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/command/* ${PREFIX}/sbin
${INSTALL_MAN} ${WRKSRC}/man/*.8 ${MANPREFIX}/man/man8
- ${INSTALL_SCRIPT} ${WRKDIR}/runsvdir.sh.sample ${PREFIX}/etc/rc.d
@${MKDIR} ${PREFIX}/etc/runit/getty-ttyv4
${INSTALL_SCRIPT} ${WRKDIR}/etc/[123c]* ${PREFIX}/etc/runit
${INSTALL_SCRIPT} ${WRKDIR}/etc/getty-ttyv4/* \
diff --git a/sysutils/runit/files/runsvdir.sh.in b/sysutils/runit/files/runsvdir.sh.in
index eba2a9e993e7..dad294e4f88f 100644
--- a/sysutils/runit/files/runsvdir.sh.in
+++ b/sysutils/runit/files/runsvdir.sh.in
@@ -1,23 +1,46 @@
#!/bin/sh
-DAEMON=runsvdir
-PREFIX=%%PREFIX%%
-SVDIR=%%SERVICE_DIR%%
-LOG='...........................................................................................................................................................................................................................................................................................................................................................................................................'
-
-PATH=/command:${PREFIX}/sbin:${PREFIX}/bin:/usr/sbin:/usr/bin:/sbin:/bin
-
-case "$1" in
- start)
- echo -n " ${DAEMON}"
- exec env - PATH=${PATH} ${PREFIX}/sbin/${DAEMON} $SVDIR $LOG &
- ;;
-
- stop)
- echo -n " ${DAEMON}"
- /usr/bin/killall -HUP ${DAEMON}
- ;;
-
- *)
- echo "Usage: $0 start | stop"
- ;;
-esac
+#
+# $FreeBSD$
+#
+
+# PROVIDE: /service
+# REQUIRE:
+# BEFORE: SERVERS
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable `runsvdir':
+#
+#runsvdir_enable="YES" (default: NO)
+#runsvdir_path="/service" (default: /var/service)
+#
+
+. "/etc/rc.subr"
+
+name="runsvdir"
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/sbin/runsvdir"
+
+start_cmd=runsvdir_start
+stop_postcmd=runsvdir_post_stop
+
+runsvdir_start()
+{
+ /bin/test -d ${runsvdir_path} || /bin/mkdir -p ${runsvdir_path}
+ /usr/bin/env -i \
+ PATH=/command:%%PREFIX%%/sbin:%%PREFIX%%/bin:/sbin:/bin:/usr/sbin:/usr/bin \
+ /usr/sbin/daemon \
+ ${command} ${runsvdir_path}
+}
+
+runsvdir_post_stop()
+{
+ %%PREFIX%%/sbin/runsvctrl exit ${runsvdir_path}/*
+}
+
+# read configuration and set defaults
+load_rc_config "$name"
+: ${runsvdir_enable="NO"}
+: ${runsvdir_path="/var/service"}
+
+run_rc_command "$1"
diff --git a/sysutils/runit/pkg-plist b/sysutils/runit/pkg-plist
index 3f9e6b8c6529..f15de8ed35e9 100644
--- a/sysutils/runit/pkg-plist
+++ b/sysutils/runit/pkg-plist
@@ -1,5 +1,4 @@
@comment $FreeBSD$
-etc/rc.d/runsvdir.sh.sample
etc/runit/1.sample
etc/runit/2.sample
etc/runit/3.sample