Custom wrapper script instead of AppRun

orbifx edited this page Jun 26, 2017 · 1 revision

In certain situations, you may wish to pass some default parameters to your main program or generally change the environment it gets started in. The steps are:

  1. Create the appdir/ directories (appdir/usr/bin, appdir/usr/share/applications, ...).
  2. Create the wrapper script or program.
  3. Copy the main executables, not the wrapper, into appdir/usr/bin/.
  4. Copy the .desktop files into appdir/usr/share/applications/. Note that the desktop files' Exec= should still point to your executables, not the AppRun.
  5. Copy the icon file into appdir/usr/share/icons/hicolor/.
  6. Copy any other resources you may wish (Qml, etc).
  7. Run linuxdeployqt appdir/usr/share/application/*.desktop with any options you may need.
  8. Remove appdir/AppRun which is created by linuxdeployqt.
  9. Copy your wrapper in appdir/AppRun (i.e. to the place of the AppRun that was there).
  10. Run appimagetool appdir to create your image. (Note: there is a bug that may require you run this step twice).

The important think to take here, is that linuxdeployqt doesn't generate the AppImage anymore. It is only used to assess the dynamic libraries needed to packaged. Then appimagetool is used to create the image after AppRun is replaced with the wrapper script.

(based on

Example wrapper in Bash

This could be in any scripting language your target platform supports, or a complete binary program.

HERE="$(dirname "$(readlink -f "${0}")")"
export LD_LIBRARY_PATH=${HERE}/usr/lib/foobar:$LD_LIBRARY_PATH
exec "${HERE}/usr/bin/foo" "$@"

Optionally, before exec .. you might wish to cd "${HERE}/usr, so that your application will run as if it was run if it were AppRun.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.