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
VERSION='20'
cpucount=`nproc`
cpucount=`cat /proc/cpuinfo|grep processor|wc -l`
FLROOT=/sys/devices/system/cpu
DRIVER=auto
VERBOSE=0

View File

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

View File

@ -321,7 +321,7 @@ def sysinfo():
# get distro information in snap env.
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:
if line.startswith('NAME='):
distro = line[5:line.find('$')].strip("\"")