Lines 1-30
Link Here
|
1 |
#!/sbin/runscript |
1 |
#!/sbin/runscript |
2 |
# Copyright 1999-2013 Gentoo Foundation |
2 |
# Copyright 1999-2013 Gentoo Foundation |
3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# $Header: /var/cvsroot/gentoo-x86/sys-power/cpupower/files/init.d,v 1.1 2013/04/23 01:48:26 ssuominen Exp $ |
4 |
# $Header: $ |
5 |
|
5 |
|
6 |
change() { |
6 |
change() { |
7 |
local c ret=0 opts="$1" |
7 |
local c ret=0 opts="$1" |
8 |
shift |
8 |
shift |
9 |
ebegin "Running cpupower -c all frequency-set ${opts}" |
9 |
if [ -n "$opts" ] ; then |
10 |
cpupower -c all frequency-set ${opts} >/dev/null 2>&1 |
10 |
ebegin "Running cpupower -c all frequency-set ${opts}" |
11 |
: $(( ret += $? )) |
11 |
cpupower -c all frequency-set ${opts} >/dev/null 2>&1 |
12 |
eend ${ret} |
12 |
: $(( ret += $? )) |
|
|
13 |
eend ${ret} |
13 |
|
14 |
|
14 |
if [ $# -gt 0 ] ; then |
15 |
if [ $# -gt 0 ] ; then |
15 |
c=1 |
16 |
c=1 |
16 |
einfo "Setting extra options: $*" |
17 |
einfo "Setting extra options: $*" |
17 |
if cd /sys/devices/system/cpu/cpufreq ; then |
18 |
if cd /sys/devices/system/cpu/cpufreq ; then |
18 |
local o v |
19 |
local o v |
19 |
for o in "$@" ; do |
20 |
for o in "$@" ; do |
20 |
v=${o#*=} |
21 |
v=${o#*=} |
21 |
o=${o%%=*} |
22 |
o=${o%%=*} |
22 |
echo ${v} > ${o} || break |
23 |
echo ${v} > ${o} || break |
23 |
done |
24 |
done |
24 |
c=0 |
25 |
c=0 |
|
|
26 |
fi |
27 |
eend ${c} |
28 |
: $(( ret += c )) |
25 |
fi |
29 |
fi |
26 |
eend ${c} |
|
|
27 |
: $(( ret += c )) |
28 |
fi |
30 |
fi |
29 |
|
31 |
|
30 |
return ${ret} |
32 |
return ${ret} |