added option to detect if running on snap

This commit is contained in:
Adnan Hodzic 2020-01-22 22:26:27 +01:00
parent ee813abfdd
commit c78ea8dd59
3 changed files with 10 additions and 8 deletions

View File

@ -4,6 +4,7 @@
# #
# Blog post: http://foolcontrol.org/?p=3124 # Blog post: http://foolcontrol.org/?p=3124
# core import
import sys import sys
sys.path.append('../') sys.path.append('../')
from source.core import * from source.core import *

View File

@ -31,14 +31,11 @@ parts:
source: scripts source: scripts
organize: organize:
cpufreqctl.sh: usr/bin/cpufreqctl cpufreqctl.sh: usr/bin/cpufreqctl
# organize:
# auto-cpufreq-install.sh: usr/bin/auto-cpufreq-install
# organize:
# auto-cpufreq-remove.sh: usr/bin/auto-cpufreq-remove
apps: apps:
auto-cpufreq: auto-cpufreq:
command: bin/auto-cpufreq command: bin/auto-cpufreq
environment: environment:
LC_ALL: C.UTF-8 LC_ALL: C.UTF-8
LANG: C.UTF-8 LANG: C.UTF-8
PKG_MARKER: SNAP

View File

@ -37,11 +37,15 @@ auto_cpufreq_log_file = "/var/log/auto-cpufreq.log"
# deploy cpufreqctl script # deploy cpufreqctl script
def cpufreqctl(): def cpufreqctl():
# deploy cpufreqctl script (if missing) # detect if running on a SNAP
if os.path.isfile("/usr/bin/cpufreqctl"): if os.getenv('PKG_MARKER') == "SNAP":
pass pass
else: else:
os.system("cp scripts/cpufreqctl.sh /usr/bin/cpufreqctl") # deploy cpufreqctl script (if missing)
if os.path.isfile("/usr/bin/cpufreqctl"):
pass
else:
os.system("cp scripts/cpufreqctl.sh /usr/bin/cpufreqctl")
def footer(l): def footer(l):
print("\n" + "-" * l + "\n") print("\n" + "-" * l + "\n")