Environmental variables

Hello !

I’m about to release a program called pdf-tool or pdftool focused on manipulating pdf files via terminal/console .
Many operations are possible, such as extraction, concatenation, inclusion, exclusion, adding numbers at the bottom of pages(a page counter), stamping pdf files to indicate their sensitivity level, compression, rotation, encryption, decryption and others …

As I use some dependencies I would like in my snap program (the main which uses bash) not to indicate each time the complete path where the dependencies are located/called.
Like for example “$SNAP/usr/bin/am-okay” , Is possible?

Here the https://github.com/baldeuniversel/linux.git github repository where the package is located (in deb format).

If you run snap run --shell pdf-tool you can see the value of the environment variable PATH is modified to contain certain directories from the snap. You can learn more about this on Environment variables

1 Like

Hi ! @zyga .

Okay ! So when I add a dependency like pdfinfo in the stage-packages section, no need to specify the full path of pdfinfo in the main file of my snap program (using bash as command interpreter), like $SNAP/usr/bin/pdfinfo ?

It’s not related to stage-packages. Whatever you do to have the right files in your snap, you can control the PATH with the snapcraft PATH variable or rely on the built in value as defined in the article.

1 Like

Thanks @zyga .

I see . I’ve already experienced something like this where I was forced to specify the dependency path via the $SNAP environmental variable.