How to refer commands from another snap using content interface


#1

I have a provider snap exposing a bunch of executables under $SNAP/bin directory via content interface. If I try to create an app section in my consumer snap using the executables from the provider snap, the snapcraft command fails with Failed to generate snap metadata: The specified command 'fusermount3' defined in the app 'fusermount3' does not exist or is not executable. How to overcome this error ?

Here are the sections of consumer and producer yamls.

Consumer snapracft.yaml

...
....
apps:
  fusermount3:
      command: $SNAP/base/fusermount3
      # command: fusermount3
      plugs: [home, base, network, network-bind, fuse-support, process-control, serial-port, raw-usb, mount-observe, docker-support]

plugs:
  base:
    content: executables
    interface: content
    target: $SNAP/base
    default-provider: provider-base

environment:
  PATH: $PATH:$SNAP/base:$SNAP/base/bin:$SNAP/base/usr/bin
  LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/base/lib:$SNAP/base/usr/lib:$SNAP/base/usr/lib/x86_64-linux-gnu:$SNAP/base/usr/lib/x86_64-linux-gnu
  LD_LIBRARY_PATH: $SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH
  PYTHONPATH: $PYTHONPATH:$SNAP/base/lib/python2.7/site-packages
...

provider snapcraft.yaml

...
...
slots:
  base:
    content: executables
    interface: content
    read:
      - /

#2

This seems more of a snapcraft question, I think the solution would seem to be to have a wrapper/indirection in the consuming snap


#3

snap pack expects the commands to exist, so regardless of using snapcraft or snap pack directly a wrapper must be put in place.