-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·31 lines (25 loc) · 1.13 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
#!/bin/bash
if [ $EUID -ne 0 ]; then
echo "You need sudo permissions to run this"
exit 1
fi
mkdir -p /usr/share/temperamental/profiles
mkdir -p /usr/bin/temperamental-polkit-helpers/
mkdir -p /usr/lib/temperamental
cp -r $PWD/usr/lib/temperamental/* /usr/lib/temperamental/
cp -r $PWD/usr/lib/temperamental/profiles /usr/share/temperamental/
cp -r $PWD/usr/lib/temperamental/temperamental-polkit-helpers/ /usr/bin/
cp $PWD/org.ruineka.temperamental.policy /usr/share/polkit-1/actions/
# Set up the sudo permissions
echo "***POSSIBLE SECURITY RISK. UNDERSTAND THE FOLLOWING***"
echo "Adding password free sudo access to the following files for user ${SUDO_USER}:"
echo "/sys/devices/system/cpu/cpufreq/boost"
echo "/sys/devices/system/cpu/smt/control"
cat <<-EOF > "/etc/sudoers.d/temperamental_sudo"
${SUDO_USER} ALL=(ALL) NOPASSWD: /usr/bin/tee /sys/devices/system/cpu/cpufreq/boost*
${SUDO_USER} ALL=(ALL) NOPASSWD: /usr/bin/tee /sys/devices/system/cpu/smt/control*
EOF
# Set up temperamental service
cp $PWD/temperamental.service /usr/lib/systemd/system/
systemctl enable temperamental && systemctl start temperamental
echo "Installed Successfully"