ports/devel/cvsd/files/cvsd.in
Doug Barton 83eb2c3700 In the rc.d scripts, change assignments to rcvar to use the
literal name_enable wherever possible, and ${name}_enable
when it's not, to prepare for the demise of set_rcvar().

In cases where I had to hand-edit unusual instances also
modify formatting slightly to be more uniform (and in
some cases, correct). This includes adding some $FreeBSD$
tags, and most importantly moving rcvar= to right after
name= so it's clear that one is derived from the other.
2012-01-14 08:57:23 +00:00

59 lines
1.2 KiB
Bash

#!/bin/sh
# $FreeBSD$
#
# PROVIDE: cvsd
# REQUIRE: LOGIN syslogd
# KEYWORD: nojail shutdown
. /etc/rc.subr
name="cvsd"
rcvar=cvsd_enable
command="%%PREFIX%%/sbin/$name"
command_args='-f $cvsd_config'
required_files=$cvsd_config
start_precmd=${name}_prestart
stop_precmd=cvsd_config
stop_postcmd=${name}_poststop
cvsd_config()
{
osreldate=`sysctl -n kern.osreldate`
chrootjail=`sed -n 's/^ *RootJail *\([^ ]*\) *$/\1/p' < $cvsd_config`
if [ -z "$chrootjail" ]; then
err 1 "RootJail is not specified in $cvsd_config"
fi
pidfile=`sed -n 's/^ *PidFile *\([^ ]*\) *$/\1/p' < $cvsd_config`
if [ -z "$pidfile" ]; then
err 1 "PidFile is not specified in $cvsd_config"
fi
}
cvsd_prestart()
{
cvsd_config
if [ $osreldate -gt 500000 ] && [ "$chrootjail" != "none" ]; then
mount -t devfs devfs $chrootjail/dev
devfs -m $chrootjail/dev rule apply hide
devfs -m $chrootjail/dev rule apply path null unhide
devfs -m $chrootjail/dev rule apply path zero unhide
fi
}
cvsd_poststop()
{
if [ $osreldate -gt 500000 ] && [ "$chrootjail" != "none" ]; then
umount -t devfs $chrootjail/dev
fi
}
load_rc_config $name
: ${cvsd_enable="NO"}
: ${cvsd_config="%%PREFIX%%/etc/$name/$name.conf"}
run_rc_command "$1"