diff --git a/Debian/CPU Governor/setup.sh b/Debian/CPU Governor/setup.sh index c704a6a..4ac946f 100644 --- a/Debian/CPU Governor/setup.sh +++ b/Debian/CPU Governor/setup.sh @@ -1,5 +1,8 @@ #!/bin/bash +#Static Var +file=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + # Precheck if [ $UID != 0 ]; then TERM=ansi whiptail --title "Info" --infobox "Please run as root!" 7 23 @@ -11,12 +14,25 @@ fi # Check if file exists if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then - # If file exists show menu - Governor=$(whiptail --title "Choose a power plan" --radiolist \ - "Choose user's permissions" 9 61 3 \ - "Performance" "Run the CPU at the maximum frequency" OFF \ - "Ondemand" "Scales the frequency according to load" OFF \ - "Powersave" "Run the CPU at the minimum frequency" ON 3>&1 1>&2 2>&3) + if grep -Fxq "powersave" $file + then + # If file exists on performance settings autoselect powersave in menu + Governor=$(whiptail --title "Choose a power plan" --radiolist \ + "Choose user's permissions" 9 61 3 \ + "Performance" "Run the CPU at the maximum frequency" ON \ + "Ondemand" "Scales the frequency according to load" OFF \ + "Powersave" "Run the CPU at the minimum frequency" OFF 3>&1 1>&2 2>&3) + elif grep -Fxq "performance" $file + then + # If file exists on performance settings autoselect powersave in menu + Governor=$(whiptail --title "Choose a power plan" --radiolist \ + "Choose user's permissions" 9 61 3 \ + "Performance" "Run the CPU at the maximum frequency" OFF \ + "Ondemand" "Scales the frequency according to load" OFF \ + "Powersave" "Run the CPU at the minimum frequency" ON 3>&1 1>&2 2>&3) + else + echo "" + fi else TERM=ansi whiptail --title "Info" --infobox "This CPU/OS does not support a governor!" 7 44 sleep 3