Add check for performance governor in available governors

This commit is contained in:
Adnan Hodzic 2022-02-19 15:21:51 +01:00
parent 8ff85e9371
commit a15e594fba
2 changed files with 9 additions and 7 deletions

View File

@ -371,10 +371,14 @@ def deploy_daemon():
def deploy_daemon_performance():
print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon " + "-" * 22 + "\n")
print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon (performance) " + "-" * 22 + "\n")
# ToDo:
# add check that performance exists otherwise exit
# check that performance is in scaling_available_governors
with open("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors") as available_governors:
if "performance" not in available_governors.read():
print("\"perfomance\" governor is unavailable on this system, run:\n"
"sudo sudo auto-cpufreq --install\n\n"
"to install auto-cpufreq using default \"balanced\" governor.\n")
# deploy cpufreqctl script func call
cpufreqctl()

View File

@ -177,10 +177,9 @@ def main(config, daemon, debug, install, install_performance, live, log, monitor
elif install_performance:
if os.getenv("PKG_MARKER") == "SNAP":
root_check()
print("This option is only available on non Snap installs"
"Please refer to: power_helper.py script for more info\n")
print("This option is only available on non Snap installs\n"
"Please refer to auto-cpufreq power_helper.py script for more info\n")
else:
print("in performance")
root_check()
running_daemon()
gov_check()
@ -198,7 +197,6 @@ def main(config, daemon, debug, install, install_performance, live, log, monitor
run("snapctl start --enable auto-cpufreq", shell=True)
deploy_complete_msg()
else:
print("in install")
root_check()
running_daemon()
gov_check()