Hello,
I’m trying to create my first snap from the Hypnotix project just for playing with snapcraft, but I can’t understand how the “command:” parameter must be used.
returns:
Failed to generate snap metadata: The specified command ‘bin/hypnotix-unofficial’ defined in the app ‘hypnotix-unofficial’ does not exist.
Ensure that ‘bin/hypnotix-unofficial’ is installed with the correct path.
I read the documentation that says
Each key under apps is the command name that should be made available on users’ systems.
I thought “command:” is an “output” binary that I may name as I want, not an “input” command that should already exist on the system.
this is relative to the toplevel of your snap, so you are telling it that executing /snap/bin/hypnotix-unofficial (or simply hypnotix-unofficial when /snap/bin is in your path) will execute:
After many tests I understood that the command: path is the executing path of the standard application (not the snapped one). Eg. if the non-snapped application would run from /usr/bin/hypnotix the command: path should be /usr/bin/hypnotix. Can you please confirm?
Moreover I found that using /usr/bin/hypnotix - which is the right path for hypnotix binary - returns a “non exiting path” error…
Looking from an online example I tried adding this stage part and it seems to work
stage:
- usr
- usr/bin
is this part necessary to use the path? It’s not written in the documentation I’m looking at (maybe it’s something which affects only me) https://snapcraft.io/docs/python-apps
The snap still doesn’t run, but it’s a little step forward Thanks
and you would then be able to execute it as “mycommand” from /snap/bin after installation …
indeed, if the non-snapped app runs from /usr/bin/hypnotix and your part actually installed it in this path your command would then be usr/bin/hypnotix … but often building from source installs things into /usr/local/bin or somewhere else …
what helps here is to completely omit the apps block, build the snap. take a look inside the built snap where things ended up and only then create the apps block with the correct command: … one thing to not forget is that you should always omit the first slash and that everything is relative to the snaps top level.