App command error: "cannot install snap file: snap is unusable due to missing files"

PS This has been solved

The daemon error message was masking a runtime issue.

I solved this with a wrapper script where I first cd into the right directory, then execute g.

Original Post

I’m having trouble with adding app section of my snapcraft.yaml. For my app command, I want to execute a binary file --included in the tarball dump of my team’s software-- with the argument start (or stop). When I try to install the snap, I get this error message while performing an install:

...
+ snap install --dangerous snapname.snap
error: cannot install snap file: snap is unusable due to missing files; contact
       developer

Here is the file structure of the installed snap when I don’t include the app section:

/snap/a/
├── current -> x1
└── x1
    ├── b
...
    │   ├── c
    │   │   ├── d -> e/f
    │   │   └── e
    │   │       └── f
...
    │   │           ├── g

g is the executable. I can’t move it to another location (e.g. a bin folder). d is a symlink to f.

Here is the relevant part of my yaml:

...
confinement: strict
...
parts:
  tarball:
    plugin: dump
    source: tarballs/my-tarball.tar.gz
...
apps:
  g:
    command: b/c/d/g start
    stop-command: b/c/d/g stop
    daemon: forking
    adapter: full

I don’t think I’m understanding the apps.<appname>.command correctly. I’ve tried adding $SNAP as a prefix to the commands, but it gets stripped anyways.

I’ve also tried making a wrapper bash script in a bin/ directory from a tarball dump, but that gives me another error. Here is the yaml where I use a bash wrapper script:

...
parts:
...
  exec-g:
    plugin: dump
    source: bin.tar.gz
...
apps:
  greengrassd:
    command: bin/start-greengrassd
    stop-command: bin/stop-greengrassd
    daemon: forking
    adapter: full

and here is the error:

The command 'bin/start-g' was not found in the prime directory, it has been changed to '/bin/bash'.
A shell wrapper will be generated for command '/bin/bash $SNAP/bin/start-g' as it does not conform with the command pattern expected by the runtime. Commands must be relative to the prime directory and can only consist of alphanumeric characters, spaces, and the following special characters: / . _ # : $ -
The command 'bin/stop-g' was not found in the prime directory, it has been changed to '/bin/bash'.
A shell wrapper will be generated for command '/bin/bash $SNAP/bin/stop-g' as it does not conform with the command pattern expected by the runtime. Commands must be relative to the prime directory and can only consist of alphanumeric characters, spaces, and the following special characters: / . _ # : $ -
Snapping 'snapname' ...

Snapped snapname.snap
+ snap install --dangerous snapname.snap                 
error: cannot perform the following tasks:
- Start snap "snapname" (unset) services ([start snap.snapname.g.service] failed with exit status 1: Job for snap.snapname.g.service failed because the control process exited with error code.
See "systemctl status snap.snapname.g.service" and "journalctl -xe" for details.
)

Does anyone immediately see what is wrong with the original approach?