code improvements for snap to work in strict confinement

This commit is contained in:
Adnan Hodzic 2020-02-10 18:16:56 +01:00
parent bb3cdababf
commit cda094fb89
3 changed files with 12 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERSION='20' VERSION='20'
cpucount=`nproc` cpucount=`cat /proc/cpuinfo|grep processor|wc -l`
FLROOT=/sys/devices/system/cpu FLROOT=/sys/devices/system/cpu
DRIVER=auto DRIVER=auto
VERBOSE=0 VERBOSE=0

View File

@ -26,17 +26,23 @@ parts:
apps: apps:
auto-cpufreq: auto-cpufreq:
command: bin/auto-cpufreq command: bin/auto-cpufreq
environment:
LC_ALL: C.UTF-8
LANG: C.UTF-8
PKG_MARKER: SNAP
plugs: plugs:
- cpu-control - cpu-control
- system-observe - system-observe
- hardware-observe - hardware-observe
- system-files - system-files
environment:
LC_ALL: C.UTF-8
LANG: C.UTF-8
PKG_MARKER: SNAP
service: service:
command: bin/auto-cpufreq --daemon 2>&1 | tee -a /var/log/auto-cpufreq.log command: bin/auto-cpufreq --daemon 2>&1 | tee -a /var/log/auto-cpufreq.log
plugs:
- cpu-control
- system-observe
- hardware-observe
- system-files
environment: environment:
LC_ALL: C.UTF-8 LC_ALL: C.UTF-8
LANG: C.UTF-8 LANG: C.UTF-8

View File

@ -321,7 +321,7 @@ def sysinfo():
# get distro information in snap env. # get distro information in snap env.
if os.getenv("PKG_MARKER") == "SNAP": if os.getenv("PKG_MARKER") == "SNAP":
searchfile = open("/usr/lib/os-release", "r") searchfile = open("/var/lib/snapd/hostfs/etc/os-release", "r")
for line in searchfile: for line in searchfile:
if line.startswith('NAME='): if line.startswith('NAME='):
distro = line[5:line.find('$')].strip("\"") distro = line[5:line.find('$')].strip("\"")