Comment 5 for bug 1876217

Revision history for this message
Alberto Donato (ack) wrote :

@Ian how do you do that? I tried the following in a test snap and it didn't work (after connecting the interface):

name: testsnap
version: "1.0"
summary: testsnap
description: testsnap
architectures:
  - amd64
base: core18
confinement: strict
grade: stable

plugs:
  read-system-os-release:
    interface: system-files
    read:
      - /var/lib/snapd/hostfs/etc/os-release

apps:
  testsnap:
    command: script
    plugs:
      - read-system-os-release

where "script" does the following:

#!/bin/bash

for file in /etc/os-release /var/lib/snapd/hostfs/etc/os-release; do
    echo "------- $file"
    cat "$file"
    echo "-------"
done

After connecting "testsnap:read-system-os-release" I still get:

$ testsnap
------- /etc/os-release
NAME="Ubuntu Core"
VERSION="18"
ID=ubuntu-core
PRETTY_NAME="Ubuntu Core 18"
VERSION_ID="18"
HOME_URL="https://snapcraft.io/"
BUG_REPORT_URL="http://bugs.launchpad.net/snappy/"
-------
------- /var/lib/snapd/hostfs/etc/os-release
cat: /var/lib/snapd/hostfs/etc/os-release: Permission denied
-------