$SNAP variable in the build env not the same as inside the snap after install?

Hello

To build a snap I need to patch a script that ships with source code. The script references

/usr/bin/

for example.

I want to use the command

sed -i -e 's:/usr/:${SNAP_SOME_PLACE}/usr/:g' <SCRIPT>.sh

If i use ${SNAP}, then my script replaces /usr/ with something like

/snap/snapcraft/9362

which is useless outside of the build environment. What am I supposed to be using to emulate the ${SNAP} that would exist inside the actual snap?

The solution was to replace /usr/ with the variables ${SNAP}. so,

sed -i -e 's:/usr/:\${SNAP_SOME_PLACE}/usr/:g' <SCRIPT>.sh

The best solution is make it to

sed -i -e 's:/usr/:\$SNAP/usr/:g' <SCRIPT>.sh

If it’s a shell script, the app can detect the SNAP variable. Just like here it’s done