Suppose there is a snap package named ‘snap1’ that installs files that looks like
is it possible for a second snap package named ‘snap2’ to add a file to ‘snap1’ files? for example to add a file named ‘new_plugin_from_snap2’ into /snap/snap1/10/plugins? so if the user installed snap1 and snap2 they would have the following files
I am trying to port debian packages to the snap format and looking to mirror the above behavior of those debian packages in the snap world. I understand this sort of behavior is very “un snap like”
Yes it is possible! I will reply with details on how to do it tomorrow.
Not sure if this is what @zyga-snapd was going to show, but you can accomplish this with 2 technologies in snapd, the content interface and layouts. If snap1 is consuming the files but the files are located in snap2, you would first plug a content interface inside snap1 like this in the snapcraft.yaml for snap1:
and then snap2 would expose a content interface slot like this in the snapcraft.yaml for snap2 (assuming the plugin files in snap2 are located in
Then when both snaps are installed you can connect the interfaces (put the plug in the slot) like so:
$ snap connect snap1:plugin snap2:plugin
And the files will show up in
$SNAP_DATA/plugins for snap1. Then you can use layouts to map
$SNAP/plugins/new_plugin_from_snap2 by adding the following to the snippet in the snapcraft.yaml for snap1:
I meant to show the
source property that allows you to connect any number of plugins to one directory. Sorry for not having the time to do so yet.
Is there any documentation on the source property?
I tried to follow ijohnson example with no success so far.
I had a look at https://docs.snapcraft.io/content-interface but didn’t find this documented. I will look at fixing that.