op_cpuspeed.sh: Made Max CPU, Safe Value, Min CPU and Warning
authorMichael Mrozek <EvilDragon@openpandora.de>
Mon, 17 Jan 2011 09:21:24 +0000 (10:21 +0100)
committerMichael Mrozek <EvilDragon@openpandora.de>
Mon, 17 Jan 2011 09:21:24 +0000 (10:21 +0100)
configurable

recipes/pandora-system/pandora-scripts/op_cpuspeed.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 72d0d87..45bddee
@@ -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