fixed daemon install/removal with setup.py

This commit is contained in:
Adnan Hodzic 2020-01-25 17:39:17 +01:00
parent efabcab056
commit 683141616f
4 changed files with 7 additions and 11 deletions

View File

@ -36,9 +36,6 @@ def main(monitor, live, daemon, install, log):
if daemon:
while True:
root_check()
# this is needed on SELinux enabled systems (see also ConditionPathExists in .service)
#create_log()
# ToDo: unless daemon invoked from snap fail
gov_check()
cpufreqctl()
sysinfo()

View File

@ -15,7 +15,7 @@ fi
touch /var/log/auto-cpufreq.log
echo -e "\n* Deploy auto-cpufreq systemd unit file"
cp scripts/auto-cpufreq.service /etc/systemd/system/auto-cpufreq.service
cp ../scripts/auto-cpufreq.service /etc/systemd/system/auto-cpufreq.service
echo -e "\n* Reloading systemd manager configuration"
systemctl daemon-reload

0
source/__init__.py Normal file
View File

View File

@ -72,13 +72,13 @@ def deploy():
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.py /usr/bin/auto-cpufreq")
os.system("cp auto-cpufreq /usr/bin/auto-cpufreq")
print("\n* Deploy auto-cpufreq install script")
os.system("cp scripts/auto-cpufreq-install.sh /usr/bin/auto-cpufreq-install")
os.system("cp ../scripts/auto-cpufreq-install.sh /usr/bin/auto-cpufreq-install")
print("\n* Deploy auto-cpufreq remove script")
os.system("cp scripts/auto-cpufreq-remove.sh /usr/bin/auto-cpufreq-remove")
os.system("cp ../scripts/auto-cpufreq-remove.sh /usr/bin/auto-cpufreq-remove")
# run auto-cpufreq daemon deploy script
s.call("/usr/bin/auto-cpufreq-install", shell=True)
@ -104,6 +104,9 @@ def remove():
# run auto-cpufreq daemon install script
s.call("/usr/bin/auto-cpufreq-remove", shell=True)
# remove auto-cpufreq-remove
os.remove("/usr/bin/auto-cpufreq-remove")
# check for necessary scaling governors
def gov_check():
avail_gov = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"
@ -365,10 +368,6 @@ def read_log():
print("ERROR: auto-cpufreq log is missing.\n\nMake sure to run: \"python3 auto-cpufreq.py --install\" first")
footer(79)
# create log func
def creat_log():
open("/var/log/auto-cpufreq.log", "a").close()
def running_check():
daemon_marker = False
for proc in p.process_iter():