1
0
Fork 0

remove intel undervolt script due to vulnerability

This commit is contained in:
Kim, Jimin 2022-06-26 00:07:20 +09:00
parent 1637561ac3
commit e932e9b972

View file

@ -1,46 +0,0 @@
from src.util import paru_install
from os import system
name = "Intel CPU undervolting"
def setup():
"""
Adds -100mV undervolting to CPU and CPU cache
https://wiki.archlinux.org/index.php/Undervolting_CPU
"""
paru_install("intel-undervolt")
#
# configuration
#
config_file_path = "/etc/intel-undervolt.conf"
# create backup
system(f"sudo install --backup {config_file_path} {config_file_path}.bak")
# Explanation:
# for lines that are not comments (lines that do not start with "#")
# search for: "undervolt <number> '<field>' <original value><comment>"
# and replaces with: "undervolt <number> '<field>' -100 <comment>"
#
# WARNING:
# This method does not preserve the space between the value and the comment.
# So this:
# value # space between comment and value: 2
# becomes this:
# value # space between comment and value: 1
system(
f"sudo sed -i -e \"/^[^#]/s/\(undervolt [0-9]* 'CPU'\) .*\(#.*\)/\1 -100 \2/\" {config_file_path}"
)
system(
f"sudo sed -i -e \"/^[^#]/s/\(undervolt [0-9]* 'CPU Cache'\) .*\(#.*\)/\1 -100 \2/\" {config_file_path}"
)
# apply config changes
system("sudo intel-undervolt apply")
# enable undervolting
system("sudo systemctl enable intel-undervolt")