blob: 92685fb7a3000c2290fe6cb07a69260f5b062ebd (
plain)
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
41
42
43
|
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-init.d,v 1.1 2007/05/17 09:02:01 phreak Exp $
checkconfig() {
if [ -z "${GOVERNOR}" ]; then
eerror "No governor set in /etc/conf.d/cpufrequtils"
return 1
fi
if [ -z "${RESTORED_GOVERNOR}" ]; then
RESTORED_GOVERNOR=performance
fi
}
affect_change() {
if [ "$#" != "2" ]; then
eerror "affect_change called in correctly, need two args, action, and governor"
return 1
fi
local cpu n
for cpu in /sys/devices/system/cpu/cpu[0-9]*; do
n=${cpu##*/}
n=${n/cpu/}
ebegin "${1} ${2} cpufreq governor on CPU${n}"
cpufreq-set -c ${n} -g "${2}"
eend ${?}
done
}
start() {
checkconfig || return 1
affect_change "Enabling" "${GOVERNOR}"
}
stop() {
checkconfig || return 1
affect_change "Disabling" "${GOVERNOR}"
}
|