Hello.
I’m working on a snap that tries to be totally useful, yet extremely compact. The snap uses adapter: none
to avoid using the shell on startup. I would like to bake the right value, at snap build time, into the environment section of each application.
I use this naive approach:
apps:
hare:
command: usr/bin/hare
adapter: none
environment:
HARECACHE: $SNAP_USER_COMMON/cache
PATH: "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
LD_LIBRARY_PATH: "$SNAP_LIBRARY_PATH:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET"
This results in the following meta/snap.yaml
fragment:
apps:
hare:
command: usr/bin/hare
environment:
HARECACHE: $SNAP_USER_COMMON/cache
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
LD_LIBRARY_PATH: $SNAP_LIBRARY_PATH:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET
adapter: none
command-chain:
- snap/command-chain/snapcraft-runner
As you can see LD_LIBRARY_PATH
contains un-expanded $CRAFT_ARCH_TRIPLET
. I could work around this by manually putting the right variable but that defeats the purpose of the variable, IMO.
There’s also a minor issue with the command chain. Snapcraft generates unneeded snap/command-chain/snapcraft-runner
executable although nothing is referencing it.
All of this is on snapcraft 7.x/candidate
.
Am I holding it wrong? What is the right way to achieve what I want (LD_LIBRARY_PATH
set, no command chain)?
CC @mr_cal