minor code improvements/clean-up
This commit is contained in:
parent
e3b207795b
commit
8a06de40cd
|
@ -26,6 +26,7 @@ share/python-wheels/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
files.txt
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
|
|
|
@ -25,12 +25,7 @@ def main(monitor, live, daemon, install, log):
|
||||||
print("\nExample usage:\nauto-cpufreq --monitor")
|
print("\nExample usage:\nauto-cpufreq --monitor")
|
||||||
print("\n-----\n")
|
print("\n-----\n")
|
||||||
|
|
||||||
# ToDo: add option what to run depending on the env
|
s.call(["auto-cpufreq", "--help"])
|
||||||
if os.getenv('PKG_MARKER') == "SNAP":
|
|
||||||
s.call(["auto-cpufreq", "--help"])
|
|
||||||
else:
|
|
||||||
s.call(["python3", "auto-cpufreq", "--help"])
|
|
||||||
#s.call([tool_run, " --help"])
|
|
||||||
footer(79)
|
footer(79)
|
||||||
else:
|
else:
|
||||||
if daemon:
|
if daemon:
|
||||||
|
|
|
@ -21,7 +21,6 @@ import signal
|
||||||
p = psutil
|
p = psutil
|
||||||
pl = platform
|
pl = platform
|
||||||
s = subprocess
|
s = subprocess
|
||||||
tool_run = sys.argv[0]
|
|
||||||
cpus = os.cpu_count()
|
cpus = os.cpu_count()
|
||||||
|
|
||||||
# get turbo boost state
|
# get turbo boost state
|
||||||
|
@ -73,14 +72,9 @@ def deploy():
|
||||||
except:
|
except:
|
||||||
print("\nERROR:\nWas unable to turn off bluetooth on boot")
|
print("\nERROR:\nWas unable to turn off bluetooth on boot")
|
||||||
|
|
||||||
#print("\n* Deploy auto-cpufreq as system wide accessible binary")
|
|
||||||
#os.system("cp auto-cpufreq /usr/bin/auto-cpufreq")
|
|
||||||
|
|
||||||
# create log file
|
# create log file
|
||||||
create_file(auto_cpufreq_log_file)
|
create_file(auto_cpufreq_log_file)
|
||||||
|
|
||||||
# sudo python3 setup.py install --record files.txt
|
|
||||||
|
|
||||||
print("\n* Deploy auto-cpufreq install script")
|
print("\n* Deploy auto-cpufreq install script")
|
||||||
os.system("cp /usr/local/share/auto-cpufreq/scripts/auto-cpufreq-install.sh /usr/bin/auto-cpufreq-install")
|
os.system("cp /usr/local/share/auto-cpufreq/scripts/auto-cpufreq-install.sh /usr/bin/auto-cpufreq-install")
|
||||||
|
|
||||||
|
@ -135,7 +129,8 @@ def gov_check():
|
||||||
def root_check():
|
def root_check():
|
||||||
if not os.geteuid() == 0:
|
if not os.geteuid() == 0:
|
||||||
print("\n" + "-" * 33 + " Root check " + "-" * 34 + "\n")
|
print("\n" + "-" * 33 + " Root check " + "-" * 34 + "\n")
|
||||||
sys.exit("ERROR:\n\nMust be run root for this functionality to work, i.e: \nsudo " + tool_run + "\n")
|
print("ERROR:\n\nMust be run root for this functionality to work, i.e: \nsudo auto-cpufreq")
|
||||||
|
footer(79)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
# refresh countdown
|
# refresh countdown
|
||||||
|
@ -384,7 +379,7 @@ def read_log():
|
||||||
s.call(["tail", "-n 50", "-f", auto_cpufreq_log_file])
|
s.call(["tail", "-n 50", "-f", auto_cpufreq_log_file])
|
||||||
else:
|
else:
|
||||||
print("\n" + "-" * 30 + " auto-cpufreq log " + "-" * 31 + "\n")
|
print("\n" + "-" * 30 + " auto-cpufreq log " + "-" * 31 + "\n")
|
||||||
print("ERROR: auto-cpufreq log is missing.\n\nMake sure to run: \"python3 auto-cpufreq.py --install\" first")
|
print("ERROR: auto-cpufreq log is missing.\n\nMake sure to run: \"auto-cpufreq --install\" first")
|
||||||
footer(79)
|
footer(79)
|
||||||
|
|
||||||
def running_check():
|
def running_check():
|
||||||
|
|
Loading…
Reference in New Issue