-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpu-boost
41 lines (36 loc) · 1.05 KB
/
cpu-boost
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
# Copyright (C) 2025 sppidy
#
# This file is a part of <https://github.com/sppidy/scripts>
# Please read the GNU General Public License in
# <https://www.github.com/sppidy/scripts/blob/main/LICENSE/>.
#!/bin/bash
if [[ -z "$1" || ! "$1" =~ ^[01]$ ]]; then
echo "Usage: $0 [1|0] [-h | --help] [--override-bat|-o]"
exit 1
fi
ac_status=$(check-ac | grep -E "0 :|1 :" | awk '{print $1}')
if [ "$1" -eq 1 ]; then
if [ "$ac_status" -eq 1 ]; then
sudo sh -c "echo '1' > /sys/devices/system/cpu/cpufreq/boost"
else
echo "Not Recommended on Battery"
fi
elif [ "$1" -eq 0 ]; then
sudo sh -c "echo '0' > /sys/devices/system/cpu/cpufreq/boost"
fi
while [[ $# -gt 1 ]]; do
case "$2" in
-o|--override-bat)
sudo sh -c "echo '1' > /sys/devices/system/cpu/cpufreq/boost"
shift
;;
-h|--help)
echo "Usage: $0 [1|0] [-h | --help] [--override|-o]"
exit 0
;;
*)
echo "Invalid option: $2"
exit 1
;;
esac
done