From c8a3d32800497a63ae21033c263c8346177878d0 Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Mon, 17 Jan 2011 10:21:24 +0100 Subject: [PATCH] op_cpuspeed.sh: Made Max CPU, Safe Value, Min CPU and Warning configurable --- .../pandora-scripts/op_cpuspeed.sh | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) mode change 100644 => 100755 recipes/pandora-system/pandora-scripts/op_cpuspeed.sh diff --git a/recipes/pandora-system/pandora-scripts/op_cpuspeed.sh b/recipes/pandora-system/pandora-scripts/op_cpuspeed.sh old mode 100644 new mode 100755 index 72d0d87..45bddee --- a/recipes/pandora-system/pandora-scripts/op_cpuspeed.sh +++ b/recipes/pandora-system/pandora-scripts/op_cpuspeed.sh @@ -1,8 +1,9 @@ #!/bin/bash #get value range -minmhz=14 -safemhz=600 -maxmhz=900 +minmhz="$(cat /etc/pandora/conf/cpu.conf | grep min | awk -F\: '{print $2}')" +safemhz="$(cat /etc/pandora/conf/cpu.conf | grep safe | awk -F\: '{print $2}')" +maxmhz="$(cat /etc/pandora/conf/cpu.conf | grep max | awk -F\: '{print $2}')" +warn="$(cat /etc/pandora/conf/cpu.conf | grep warn | awk -F\: '{print $2}')" curmhz="$(cat /proc/pandora/cpu_mhz_max)" newmhz="$(cat /proc/pandora/cpu_mhz_max)" device=/proc/pandora/cpu_mhz_max @@ -17,15 +18,17 @@ newmhz=$1 fi if [ $newmhz ]; then if [ $newmhz -gt $safemhz ]; then - if [ $DISPLAY ]; then - answer=$(zenity --question --title "Alert" --text "You are trying to set the CPU clock to $newmhz which is above its specification of $safemhz, doing so may burn down your house, sour milk, or just blow up (OK, not that likely)! Proceed?";echo $?) - echo $answer - if [ $answer = 1 ]; then exit 1; fi - else - answer="n";read -p "You are trying to set the CPU clock to $newmhz which is above its specification of $safemhz, doing so may burn down your house, sour milk, or just blow up (OK, not that likely)! Proceed? [y/n]" -t 10 answer - echo $answer - if [ $answer = n ]; then exit 1; fi - fi + if [ $warn != no ]; then + if [ $DISPLAY ]; then + answer=$(zenity --question --title "Alert" --text "You are trying to set the CPU clock to $newmhz which is above its specification of $safemhz, doing so may burn down your house, sour milk, or just blow up (OK, not that likely)! Proceed?";echo $?) + echo $answer + if [ $answer = 1 ]; then exit 1; fi + else + answer="n";read -p "You are trying to set the CPU clock to $newmhz which is above its specification of $safemhz, doing so may burn down your house, sour milk, or just blow up (OK, not that likely)! Proceed? [y/n]" -t 10 answer + echo $answer + if [ $answer = n ]; then exit 1; fi + fi + fi fi if [ $newmhz -le $minmhz ]; then newmhz=$minmhz; fi -- 2.39.2