forked from KyleGospo/Steam-Deck-Software-Undervolt
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
executable file
·125 lines (110 loc) · 4.07 KB
/
install.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/sh
set -eu
cp_file()
{
cp "${1}${3}" "${2}${3}"
}
# Check for root privileges
if [ "$(id -u)" != "0" ]
then
echo "This script must be run with root privileges"
exit 1
fi
# Install files etc.
echo "Installing files..."
fromPath="./home/deck/.local/bin/"
toPath="/home/deck/.local/bin/"
mkdir -p $toPath
cp_file $fromPath $toPath "allowadj.txt"
cp_file $fromPath $toPath "curve.sh"
cp_file $fromPath $toPath "experimental.sh"
cp_file $fromPath $toPath "experimentaladj.txt"
cp_file $fromPath $toPath "off.sh"
cp_file $fromPath $toPath "on.sh"
cp_file $fromPath $toPath "ryzenadj"
cp_file $fromPath $toPath "set-ryzenadj-curve.sh"
cp_file $fromPath $toPath "set-ryzenadj-tweaks.sh"
cp_file $fromPath $toPath "statusadj.txt"
cp_file $fromPath $toPath "enable-coall.sh"
cp_file $fromPath $toPath "enable-coper.sh"
fromPath="./etc/systemd/system/"
toPath="/etc/systemd/system/"
cp_file $fromPath $toPath "ac.target"
cp_file $fromPath $toPath "battery.target"
cp_file $fromPath $toPath "set-ryzenadj-curve.path"
cp_file $fromPath $toPath "set-ryzenadj-curve.service"
cp_file $fromPath $toPath "set-ryzenadj-tweaks.path"
cp_file $fromPath $toPath "set-ryzenadj-tweaks.service"
fromPath="./etc/udev/rules.d/"
toPath="/etc/udev/rules.d/"
cp_file $fromPath $toPath "99-powertargets.rules"
echo "Set permissions on files..."
toPath="/home/deck/.local/bin/"
chmod 666 $toPath"allowadj.txt"
chmod 666 $toPath"experimentaladj.txt"
chmod 755 $toPath"experimental.sh"
chmod 755 $toPath"off.sh"
chmod 755 $toPath"on.sh"
chmod 755 $toPath"ryzenadj"
chmod 755 $toPath"set-ryzenadj-curve.sh"
chmod 755 $toPath"set-ryzenadj-tweaks.sh"
chmod 775 $toPath"enable-coper.sh"
chmod 775 $toPath"enable-coall.sh"
curuser=$(logname)
chown -R $curuser:$curuser $toPath
echo "Ensuring undervolt is off..."
bash $toPath"off.sh"
echo "Enable new powertarget rules..."
udevadm control --reload-rules
systemctl daemon-reload
while true; do
read -r -p "Select undervolt method: (all/coper): " ANSWER
case $ANSWER in
a|all)
echo "Enable path listener..."
systemctl enable --now set-ryzenadj-tweaks.path
echo "Enabling set-ryzenadj-tweaks service..."
systemctl enable set-ryzenadj-tweaks.service
break
;;
c|coper)
echo "Enable path listener..."
systemctl enable --now set-ryzenadj-curve.path
echo "Enabling set-ryzenadj-curve service..."
systemctl enable set-ryzenadj-curve.service
break
;;
esac
done
echo "Installation done."
echo ""
echo "Add on.sh, off.sh, and experimental.sh as non-steam"
echo "games and start testing undervolt settings in game mode."
echo "First try the on.sh script. It does a small -5 curve"
echo "offset. If it works fine you can try the experimental.sh"
echo "script. It does a much more ambitious -15 curve offset."
echo ""
echo "NOTE: It might cause a hard crash or a hang but you can"
echo "just restart your deck."
echo ""
echo "If the experimental setting also works fine you can edit"
echo "the undervolt settings in the 'experimental' and"
echo "'undervolt-on' sections of"
echo "/home/deck/.local/bin/set-ryzenadj-tweaks.sh"
echo "script moving the -15 curve offset to the 'undervolt-on'"
echo "section and making a more ambitous setting for the"
echo "'experimental' section, e.g., a -20 curve offset."
echo "If the experimental setting doesn't work you should go for"
echo "a less ambitious setting in the 'experimental' section,"
echo "eg., a -10 curve."
echo "In any case you can go back to game mode and test your new"
echo "experimental setting. Repeat until you find the best stable"
echo "setting and put that on the 'undervolt-on' section."
echo ""
echo "If something goes wrong and the deck hangs while applying"
echo "undervolt then all further undervolting attempts are"
echo "disabled. The file 'home/deck/.local/bin/statusadj.txt'"
echo "acts as a fail safe. It will contain the text"
echo "'Applying undervolt' after a failed restart. Make a less"
echo "ambitious undervolt setting and clear the contents of the"
echo "file to reactivate undervolting".