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”
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 $SNAP/plugins):
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_DATA/plugins to $SNAP/plugins/new_plugin_from_snap2 by adding the following to the snippet in the snapcraft.yaml for snap1: