updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / cpufreq-systemd / cpufreq-systemd.sh
blob573ca2b9cdf1e7cf4e59cd9d68ab683db4340eb6
1 #!/bin/bash
3 # source application-specific settings
4 [ -f /etc/conf.d/cpufreq ] && . /etc/conf.d/cpufreq
6 params=""
7 if [ -n "$governor" ]; then
8 mod="cpufreq_$governor"
9 params="-g $governor"
10 grep -qw "$governor" /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors || modprobe -q $mod
11 if [ $? -eq 0 ]; then
12 if [ "$min_freq" != "" ]; then
13 params="$params -d $min_freq"
15 if [ "$max_freq" != "" ]; then
16 params="$params -u $max_freq"
18 else
19 # Cannot load governor module
20 exit -1
24 if [ "$params" != "" ]; then
25 CPUS=$(sed -ne 's/^processor.* \([0-9]\+\)$/\1/p' /proc/cpuinfo)
26 for cpu in $CPUS; do
27 cpufreq-set -c $cpu $params
28 if [ "$freq" != "" ]; then
29 cpufreq-set -c $cpu -f $freq
31 done
32 else
33 # Invalid configuration in /etc/conf.d/cpufreq
34 exit -1
37 exit 0