the build is successful and the local install works. when running the app the application can’t find the driver files though:
[unixODBC][Driver Manager]Can't open lib '/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so' : file not found","state":"01000"}],"error":"[node-odbc] SQL_ERROR","message":"[unixODBC][Driver Manager]Can't open lib '/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so' : file not found","state":"01000"
It doesn’t look like the file you’re generating depends on the target system or will change from run to run, so it would probably be better to generate the odbc.ini file at package build time, and then just use something like the following to set the environment variable:
I suggested to write it out in a wrapper because of the requirement to know where the snap is installed. While it is convention to use /snap/snapname/current this isn’t guaranteed afaik?
It really depends on which mount namespace you’re talking about. It is true that a snap’s data files might be mounted under /var/lib/snapd/snap on some distributions, but that is invisible to strictly confined snaps. The mount namespace constructed for strictly confined snaps always puts the snap’s data in /snap.
Thanks for the breakdown guys. One clarification: Shouldn’t the drivers installed with the packages listed under stage-packages be bundled with the snap? What exactly gets included by stage-packages if not the .so files?
What’s the right way to trigger this script at the build? During ‘override-{build | pull | stage}’ the env var $SNAP_USER_DATA seems to point somewhere else (like /root/snap/snapcraft/1871/) as during the actual snap run (like /home/me/snap/my-app/x4). Means the ini file is not located where the snap run expects it.