Multiple commands, but don't prepend with snap name

Hi all,

I am new to creating snaps, but close to get one working, my only problem is that this particular software has multiple commands, that I would like to expose. I have spend ~2 weeks on and off to look for something, with examples, but still have not been successful

I could probably write an install hook, and add symbolic links in /snap/bin, but not sure if that is the right approach

The code for the snap is here, https://code.launchpad.net/~arif-ali/+git/snap-rpi-userland/
The buildlogs are here, https://code.launchpad.net/~arif-ali/+snap/rpi-userland-arif-ali
And the snap in the snap store is named as rpi-userland-arif-ali

Any assistance on this would be appreciated

Arif

1 Like

For reference: I’m looking at this snapcraft.yaml file.

It seems you’re on the right track. The first step is to define all the commands in the apps section in snapcraft.yaml like you did:

apps:
  dtmerge:
    command: dtmerge
    plugs: [ opengl ]
    environment:
      LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/opt/vc/lib
      PATH: $SNAP/opt/vc/bin:$PATH
  dtoverlay:
    command: dtoverlay
    plugs: [ opengl ]
    environment:
      LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/opt/vc/lib
      PATH: $SNAP/opt/vc/bin:$PATH
  ...

With this definition, a user can run these commands using rpi-userland-arif-ali.dtmerge and rpi-userland-arif-ali.dtoverlay etc.

However, if I understand it correctly, you want users to be able to run dtmerge and dtoverlay in their terminal, without the rpi-userland-arif-ali prefix, right?

This is not something you can configure yourself in your snap. You will need to request an “alias” for each of these commands. For example, you’ll need to request the alias dtmerge for the command rpi-userland-arif-ali.dtmerge. You can request aliases by creating a post on this forum in the store-requests category. See Commands and aliases for more information.

1 Like

here i’m using only the vc libs from the userland, but it might give you some ideas:

1 Like