So I’m trying to preinstall a config file for a service containing a webserver. One of the values in the config file should be the path to the webserver public folder which is also shipped in the same snap package and installed to
/snap/<package>/<version>/webinterface
The only way so far that I have found to generate such a config file is to wrap my binary in a script that will copy the template conf file into $SNAP_COMMON if there isn’t one there yet and then use sed to replace @WEBDIR@ with the above path. So, the obvious variable to use there is $SNAP/webinterface, however, this will break on upgrades as the config file in $SNAP_COMMON would still point to the old version.
Is there a variable that would point me to /snap/<package>/current/ instead of /snap/<package>/<version>/ ?