freebsd-ports/sysutils/runit/files/runsvdir.in
Chris Rees 6759731c83 Fix link without gcc
Reported by:	pointyhat

While here, stageify and tidy rc script
2013-10-30 16:25:29 +00:00

38 lines
755 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: /service
# BEFORE: SERVERS
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable `runsvdir':
#
#runsvdir_enable="YES" (default: NO)
#runsvdir_path="/service" (default: %%SERVICE_DIR%%)
#
. /etc/rc.subr
name=runsvdir
rcvar=runsvdir_enable
load_rc_config runsvdir
: ${runsvdir_enable:=NO}
: ${runsvdir_path=%%SERVICE_DIR%%}
command="%%PREFIX%%/sbin/runsvdir"
start_cmd=runsvdir_start
stop_postcmd="%%PREFIX%%/sbin/sv exit ${runsvdir_path}/*"
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}
}
run_rc_command $1