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.
40 lines
979 B
Bash
40 lines
979 B
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: cpupowerd
|
|
# REQUIRE: DAEMON
|
|
# BEFORE: LOGIN
|
|
# KEYWORD: nojail
|
|
#
|
|
# Add the following line to /etc/rc.conf[.local] to enable cpupowerd
|
|
#
|
|
# cpupowerd_enable (bool): Set to "NO" by default.
|
|
# Set it to "YES" to enable cpupowerd.
|
|
# cpupowerd_config (str): Custom config file for cpupowerd.
|
|
# (default /usr/local/etc/cpupowerd.conf)
|
|
# cpupowerd_flags (str): Custom additional arguments to be passed
|
|
# to cpupowerd (default -d -c cpupowerd.conf).
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="cpupowerd"
|
|
rcvar=cpupowerd_enable
|
|
command=%%PREFIX%%/sbin/${name}
|
|
start_precmd="${name}_precmd"
|
|
|
|
load_rc_config $name
|
|
|
|
# set default
|
|
: ${cpupowerd_enable="NO"}
|
|
: ${cpupowerd_config="%%PREFIX%%/etc/cpupowerd.conf"}
|
|
|
|
command_args="-d -c ${cpupowerd_config} ${cpupowerd_flags}"
|
|
|
|
cpupowerd_precmd()
|
|
{
|
|
if [ ! -c "/dev/%%CPUCTL%%0" ]; then
|
|
kldload %%CPUCTL%%
|
|
fi
|
|
}
|
|
|
|
run_rc_command "$1"
|