Skip to content

Commit 312a459

Browse files
Replace cpufrequtils with CPUFreq sysfs interaction
1 parent 49e6d81 commit 312a459

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

install.sh

100755100644
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ package_is_installed(){
3232
install_if_missing() {
3333
if package_is_installed "$1" ; then
3434
debug "Found existing $1. Skipping..."
35-
# Always mark our upstream apt deps as held back, which will prevent the package
35+
# Always mark our upstream apt deps as held back, which will prevent the package
3636
# from being automatically installed, upgraded or removed
3737
if [[ -z $TEST ]]; then
3838
apt-mark manual "$1"
@@ -43,7 +43,7 @@ install_if_missing() {
4343
debug "Installing $1..."
4444
if [[ -z $TEST ]]; then
4545
apt-get install --yes "$1"
46-
# Always mark our upstream apt deps as held back, which will prevent the package
46+
# Always mark our upstream apt deps as held back, which will prevent the package
4747
# from being automatically installed, upgraded or removed
4848
apt-mark manual "$1"
4949
fi
@@ -251,19 +251,26 @@ debug "Updated package list."
251251

252252
install_if_missing curl
253253
install_if_missing avahi-daemon
254-
install_if_missing cpufrequtils
255254
install_if_missing libatomic1
256255
install_if_missing v4l-utils
257256
install_if_missing sqlite3
258257
install_if_missing openjdk-17-jre-headless
259258

260-
debug "Setting cpufrequtils to performance mode"
259+
debug "Adding cpu governor service"
261260
if [[ -z $TEST ]]; then
262-
if [ -f /etc/default/cpufrequtils ]; then
263-
sed -i -e 's/^#\?GOVERNOR=.*$/GOVERNOR=performance/' /etc/default/cpufrequtils
264-
else
265-
echo 'GOVERNOR=performance' > /etc/default/cpufrequtils
266-
fi
261+
cat > /etc/systemd/system/cpu_governor.service <<EOF
262+
[Unit]
263+
Description=Service that sets the cpu frequency governor
264+
265+
[Service]
266+
Type=oneshot
267+
ExecStart=bash -c 'echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
268+
269+
[Install]
270+
WantedBy=multi-user.target
271+
EOF
272+
chmod 644 /etc/systemd/system/cpu_governor.service
273+
systemctl enable cpu_governor.service
267274
fi
268275

269276
if [[ "$INSTALL_NETWORK_MANAGER" == "yes" ]]; then
@@ -291,7 +298,7 @@ if [[ "$DISTRO" = "Ubuntu" && -z $(apt-cache search libcholmod3) ]]; then
291298
if [[ -z $TEST ]]; then
292299
if [[ "$ARCH" = "x86_64" ]]; then
293300
add-apt-repository -y -S 'deb http://security.ubuntu.com/ubuntu jammy main universe'
294-
else
301+
else
295302
add-apt-repository -y -S 'deb http://ports.ubuntu.com/ubuntu-ports jammy main universe'
296303
fi
297304
fi

0 commit comments

Comments
 (0)