Update Debian/CPU Governor/setup.sh
Added extra IF statements to determine if a machine is already on a "Performance" or "Powersave" energy plan and adjust the menu accordingly.
This commit is contained in:
parent
73f0392238
commit
340deedd52
@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#Static Var
|
||||||
|
file=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||||
|
|
||||||
# Precheck
|
# Precheck
|
||||||
if [ $UID != 0 ]; then
|
if [ $UID != 0 ]; then
|
||||||
TERM=ansi whiptail --title "Info" --infobox "Please run as root!" 7 23
|
TERM=ansi whiptail --title "Info" --infobox "Please run as root!" 7 23
|
||||||
@ -11,12 +14,25 @@ fi
|
|||||||
|
|
||||||
# Check if file exists
|
# Check if file exists
|
||||||
if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
|
if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
|
||||||
# If file exists show menu
|
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 \
|
Governor=$(whiptail --title "Choose a power plan" --radiolist \
|
||||||
"Choose user's permissions" 9 61 3 \
|
"Choose user's permissions" 9 61 3 \
|
||||||
"Performance" "Run the CPU at the maximum frequency" OFF \
|
"Performance" "Run the CPU at the maximum frequency" OFF \
|
||||||
"Ondemand" "Scales the frequency according to load" OFF \
|
"Ondemand" "Scales the frequency according to load" OFF \
|
||||||
"Powersave" "Run the CPU at the minimum frequency" ON 3>&1 1>&2 2>&3)
|
"Powersave" "Run the CPU at the minimum frequency" ON 3>&1 1>&2 2>&3)
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
TERM=ansi whiptail --title "Info" --infobox "This CPU/OS does not support a governor!" 7 44
|
TERM=ansi whiptail --title "Info" --infobox "This CPU/OS does not support a governor!" 7 44
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user