Here are the important parts of my working snapcraft.yaml
...
name: my-lib
apps:
library-sample:
command: library_sample $SNAP/arg_file.json
parts:
library:
source: https://github.com/the/sample.git
plugin: cmake
install: |
cp -r samples/library_sample $SNAPCRAFT_PART_INSTALL/
cp -r ../src/samples/src/arg_file.json $SNAPCRAFT_PART_INSTALL/
cp --parents modules/dep_lib1/libdep_lib1.so $SNAPCRAFT_PART_INSTALL/
cp --parents modules/dep_lib2/libdep_lib2.so $SNAPCRAFT_PART_INSTALL/
Ultimately, I would like arg_file.json
to be in $SNAP_DATA
, so I changed
cp -r ../src/samples/src/arg_file.json $SNAPCRAFT_PART_INSTALL/
to
cp -r ../src/samples/src/arg_file.json $SNAP_DATA/
However, this causes the file to disappear from my install
directory (and ultimately from my installed snap). I feel certain this is because the $SNAP_DATA
environment variable is not available to me from the install:
scriptlet, but I don't know how I should work around this otherwise.