AppImage

How to add a system envrionment variable in an appimage

There is a snake game I want to package, it use some libraries like libjpeg8 not in my system debian 10. So I package them all.
But it need to run:
export LD_LIBRARY_PATH=.
at first, so the main execute program can load the libraries.
Anyone know how can I do that in my appimage? Because seems that appimage not support a bash shell for AppRun.
Please help.

The app:

Hi @eclair. You can use your own bash script as AppRun, and export the variable from there. We are doing it all the time.

here is my filelist:
[eclair@debian:DungeonRush_1.0a_amd64]$ ls
AppRun libSDL2_image-2.0.so.0 libSDL2_ttf-2.0.so.0 snake
bin libSDL2_image.so libSDL2_ttf.so snake.desktop
libjpeg.so.8 libSDL2_mixer-2.0.so.0 libwebp.so.6.0.2 snake.png
libjpeg.so.8.1.2 libSDL2_mixer.so libwebp.so.7 storage.dat
libSDL2-2.0.so libSDL2.so res usr

here is my AppRun:
[eclair@debian:DungeonRush_1.0a_amd64]$ cat AppRun
#!/bin/bash
export LD_LIBRARY_PATH=.
export PATH=%PATH%:.
snake

after appimage created, run it:
[eclair@debian:DungeonRush_1.0a_amd64]$ LANG=en_us ./Snake-x86_64.AppImage
/tmp/.mount_Snake-klf0zz/AppRun: line 4: snake: command not found

I don’t know what’s wrong with it. It seems the shell can not load other executable file in the appimage, is there a grammar to do that?
Please help.

Please see https://github.com/Rapiz1/DungeonRush/pull/13.

Thank you very much.
I am just learning make appimage package myself.
The travis CI job log is very useful.
Thanks again.

And I should say the program is not suitable to be a appimage, it’s save file not in user’s home, but in it’s program’s directory which is readonly, will make the appimage report some error.

It should be changed then since it will fail not only with AppImage, but also if it is installed to any read-only location such as /usr/bin or /opt.