handling interpreters in *-snapper scripts (or snapcraft)

Oliver Grawert ogra at ubuntu.com
Mon Jun 15 11:39:41 UTC 2015


i'm currently trying to set up something similar to node-snapper for
python snaps ... i.e. "py-snapper".

for such setups of interpreted code we kind of need to ship the
interpreter inside the snap.

the python binary shipped in snappy core is a temporary thing that will
go away as soon as we move system-image off the images in the near
future so we can not rely on it being there ...

while shipping a python, perl, ruby or whatever interpreter inside a
snap package is a breeze, the scripts that you will ship will most
likely have some shebang line in them ... usually with a full path to
the interpreter ... (#! /usr/bin/python) ... 

the problem i am hitting my head against now is how to handle these
hardcoded interpreter lines without requiring the user to manually
re-write them when producing a snap (or have error prone code in the
*-snapper script to mangle them with a prefix or some such)

one option would be an overlay or bind mount that overlays the shipped
interpreter on top of the existing path ... but i doubt that would work
per-app only inside the namespace the app is allowed to access.

another option would be to ship a shell script for each of the known
interpreters inside the core image to actually re-write the interpreter
path on the fly

and ricmm suggested to have a libsnappy.so or some such that does this
wrapping (but from go or C code) ...

this is a RFC, if you have any ideas (weird or proper, let them flow...)
please reply here  :)


More information about the snappy-devel mailing list