forked from edupr91/turbo-boost-disable
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTurboBoostManager.sh
executable file
·77 lines (72 loc) · 1.6 KB
/
TurboBoostManager.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env sh
RED='\033[91m'
GREEN='\033[92m'
# From https://stackoverflow.com/a/246128
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source "${SCRIPT_DIR}/functions.sh"
while true
do
CHECK_STATUS
if [ $result -eq 0 ]; then
echo " ---- Turbo Boost Manager ----"
echo "TurboBoost: [${RED}enabled${NC}]"
else
echo " ---- Turbo Boost Manager ----"
echo "TurboBoost: [${GREEN}disabled${NC}]"
fi
printf '
1) Disable Turbo Boost
2) Enable Turbo Boost
3) Re-Disable
4) Check status
5) Exit
Enter: ';
read var;
# option #3 Re-disable unloads the kext and loads it again
case $var in
1)
CHECK_STATUS
if [ $result -eq 0 ]; then
LOAD
break
else
PRINT_STATUS
sleep 0.5
fi
;;
2)
CHECK_STATUS
if [ $result -eq 0 ]; then
PRINT_STATUS
sleep 0.5
else
UNLOAD
break
fi
;;
3)
PRINT_STATUS
UNLOAD
sleep 3 # give time to the system to do unload the kext properly
LOAD
break
;;
4)
PRINT_STATUS
sleep 0.5
;;
5)
echo "Bye"
exit 0
;;
*)
echo
echo "Valid range of choices [1-5]."
echo "Try again..."
echo
sleep 0.5
continue
esac
done
sudo -k
exit 0