mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-07-24 06:05:08 +02:00
working remove/install of snap service
This commit is contained in:
parent
a8068ab0bf
commit
6b5fba3ac3
@ -29,7 +29,8 @@ def main(monitor, live, daemon, install, log):
|
|||||||
footer(79)
|
footer(79)
|
||||||
else:
|
else:
|
||||||
if daemon:
|
if daemon:
|
||||||
if os.getenv("PKG_MARKER") == "SNAP" and os.getenv("DAEMON") == "ENABLED":
|
#if os.getenv("PKG_MARKER") == "SNAP" and os.getenv("DAEMON") == "ENABLED":
|
||||||
|
if os.getenv("PKG_MARKER") == "SNAP":
|
||||||
while True:
|
while True:
|
||||||
root_check()
|
root_check()
|
||||||
gov_check()
|
gov_check()
|
||||||
@ -75,25 +76,21 @@ def main(monitor, live, daemon, install, log):
|
|||||||
read_log()
|
read_log()
|
||||||
elif install:
|
elif install:
|
||||||
if os.getenv('PKG_MARKER') == "SNAP":
|
if os.getenv('PKG_MARKER') == "SNAP":
|
||||||
os.environ["DAEMON"] = "ENABLED"
|
|
||||||
running_check()
|
running_check()
|
||||||
root_check()
|
root_check()
|
||||||
gov_check()
|
gov_check()
|
||||||
# ToDo:
|
#os.environ["DAEMON"] = "ENABLED"
|
||||||
# implement option to restart snap service?
|
s.run("snapctl start --enable auto-cpufreq", shell=True)
|
||||||
else:
|
else:
|
||||||
running_check()
|
running_check()
|
||||||
root_check()
|
root_check()
|
||||||
gov_check()
|
gov_check()
|
||||||
deploy()
|
deploy()
|
||||||
# ToDo: add remove for snap
|
|
||||||
elif remove:
|
elif remove:
|
||||||
if os.getenv('PKG_MARKER') == "SNAP":
|
if os.getenv('PKG_MARKER') == "SNAP":
|
||||||
root_check()
|
root_check()
|
||||||
# ToDo: remove if not needed?
|
#s.run("snapctl stop --disable auto-cpufreq", shell=True)
|
||||||
#kill_process("auto-cpufreq --daemon")
|
s.run("snapctl stop --disable auto-cpufreq", shell=True)
|
||||||
# ToDo:
|
|
||||||
# implement option to stop and restart snap service?
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
root_check()
|
root_check()
|
||||||
|
@ -37,6 +37,6 @@ apps:
|
|||||||
LC_ALL: C.UTF-8
|
LC_ALL: C.UTF-8
|
||||||
LANG: C.UTF-8
|
LANG: C.UTF-8
|
||||||
PKG_MARKER: SNAP
|
PKG_MARKER: SNAP
|
||||||
DAEMON: ENABLED
|
DAEMON: DISABLED
|
||||||
daemon: simple
|
daemon: simple
|
||||||
|
|
@ -401,11 +401,4 @@ def running_check():
|
|||||||
print("----")
|
print("----")
|
||||||
print("\nTo view live log run:\n\tauto-cpufreq --log")
|
print("\nTo view live log run:\n\tauto-cpufreq --log")
|
||||||
footer(79)
|
footer(79)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# kill process func
|
|
||||||
def kill_process(pstring):
|
|
||||||
for line in os.popen("ps ef | grep \"" + pstring + "\" | grep -v grep"):
|
|
||||||
fields = line.split()
|
|
||||||
pid = fields[0]
|
|
||||||
os.kill(int(pid), signal.SIGKILL)
|
|
Loading…
x
Reference in New Issue
Block a user