Use of content interface for sharing files (read-only)

Producer snap can share whatever folder you want, with the permissions it needs. In this case, read permissions:

slots:
  myshare:
    interface: content
    content: mydirectory
    read:
      - $SNAP/myfolderweretheexecis

And then, consumer snap should plug to that slot. Define in snapcraft.yaml something like:

plugs:
  myshare:
    interface: content
    content: mydirectory
    target: $SNAP_DATA
    default-provider: myproducersnap

once connected:

snap connect myconsumersnap:myshare myproducersnap:myshare

you should have ready to use in consumer $SNAP_DATA folder whatever is available in producer $SNAP/myfolderweretheexecis path as readonly content.

You can find more details here

2 Likes