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(): 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: # check that performance is in scaling_available_governors
# add check that performance exists otherwise exit 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 # deploy cpufreqctl script func call
cpufreqctl() cpufreqctl()

View File

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