George
George

Reputation: 7327

How to package shell programs into an AppImage?

I have made an AppImage via:

linuxdeploy --appdir AppDir --icon-file icon.png --desktop-file desktop.desktop --executable myExecutable --output appimage

which runs fine. However, the program I've packaged (myExecutable) makes shell calls (say to shellProgram1, shellProgram2, ...) at run-time to make use of various programs that aren't necessarily on every distro.

Question: Does linuxdeploy (or some other AppImage utility) provide an easy way to package these programs into the AppImage, so that when myExecutable calls them at run-time, they are guaranteed to be available?

Upvotes: 1

Views: 971

Answers (1)

Alexis
Alexis

Reputation: 641

To achieve such thing you need to deploy all the binaries that may not be present in all distros into the AppDir and set the PATH environment to make them available at runtime.

With linuxdeploy you have to manually copy the files into the AppDir and create a wrapper for the main binary to set the PATH. Something like this

$!/bin/bash
export PATH="$APPDIR/usr/bin:$PATH"

exec $APPDIR/usr/bin/my_program

You can also use appimage-builder which creates such wrapper for you. In the project examples folder, you can find several recipes that can be used for inspiration.

Upvotes: 1

Related Questions