mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2025-01-17 23:34:07 +00:00
38 lines
698 B
Text
38 lines
698 B
Text
|
#!/bin/bash
|
||
|
|
||
|
[[ -x /usr/bin/cpupower ]] || exit $NA
|
||
|
|
||
|
CPUPOWER_GOVERNOR_AC=${CPUPOWER_GOVERNOR_AC:-ondemand}
|
||
|
CPUPOWER_GOVERNOR_BAT=${CPUPOWER_GOVERNOR_BAT:-conservative}
|
||
|
|
||
|
help() {
|
||
|
cat <<EOF
|
||
|
--------
|
||
|
$0: Select cpupower frequency governor.
|
||
|
|
||
|
Parameters:
|
||
|
CPUPOWER_GOVERNOR_AC = Governor to use on AC.
|
||
|
Defaults to ondemand.
|
||
|
|
||
|
CPUPOWER_GOVERNOR_BAT = Governor to use on battery.
|
||
|
Defaults to conservative.
|
||
|
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
cpupow() {
|
||
|
printf 'Setting cpupower frequency governor to %s...' "$1"
|
||
|
cpupower -c all frequency-set -g "$1"
|
||
|
}
|
||
|
|
||
|
case $1 in
|
||
|
true) cpupow "$CPUPOWER_GOVERNOR_BAT" ;;
|
||
|
false) cpupow "$CPUPOWER_GOVERNOR_AC" ;;
|
||
|
help) help;;
|
||
|
*) exit $NA ;;
|
||
|
esac
|
||
|
|
||
|
exit 0
|
||
|
|
||
|
# vim:set ts=2 sw=2 ft=sh et:
|