mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-27 00:57:50 +00:00
83eb2c3700
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.
56 lines
1.3 KiB
Bash
56 lines
1.3 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# PROVIDE: ucc
|
|
# REQUIRE: DAEMON
|
|
#
|
|
# Add the following line to /etc/rc.conf[.local] to enable ucc
|
|
#
|
|
# ucc_enable (bool): Set to "NO" by default.
|
|
# Set it to "YES" to enable ucc.
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="ucc"
|
|
rcvar=ucc_enable
|
|
|
|
load_rc_config $name
|
|
|
|
: ${ucc_enable="NO"}
|
|
: ${ucc_config="server.ini"}
|
|
: ${ucc_logfile="/dev/null"}
|
|
: ${ucc_map="dm-Hyperblast"}
|
|
: ${ucc_pidfile="/var/run/ucc.pid"}
|
|
|
|
pidfile=${ucc_pidfile}
|
|
command="%%UTDIR%%/System/ucc-bin"
|
|
command_args="server \"${ucc_map}\" ini=${ucc_config}"
|
|
start_cmd="ucc_startcmd"
|
|
|
|
ucc_startcmd()
|
|
{
|
|
if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
|
|
echo "${name} already running? (pid=$rc_pid)."
|
|
return 1
|
|
fi
|
|
echo Starting ${name}.
|
|
if [ ! -x /usr/sbin/daemon ]; then
|
|
err 1 "/usr/sbin/daemon required"
|
|
fi
|
|
if ! /usr/sbin/daemon 2>&1 | grep pidfile > /dev/null; then
|
|
err 1 "/usr/sbin/daemon with -p option required"
|
|
fi
|
|
if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then
|
|
err 1 "Linux support required"
|
|
fi
|
|
cd %%UTDIR%%/System/
|
|
cmd="/usr/sbin/daemon -p ${ucc_pidfile} ${command} ${command_args}"
|
|
if [ -n "$ucc_user" ]; then
|
|
cmd="su -m $ucc_user -c '$cmd'"
|
|
fi
|
|
eval "$cmd 2>&1 >> ${ucc_logfile}"
|
|
}
|
|
|
|
run_rc_command "$1"
|