aboutsummaryrefslogtreecommitdiff
path: root/sysutils/cpupowerd/files/cpupowerd.in
blob: 81c5daf1c2a98fdd02042f4b5d685e8b6cf66828 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/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).
#

. %%RC_SUBR%%

name="cpupowerd"
rcvar=`set_rcvar`
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"