-
Notifications
You must be signed in to change notification settings - Fork 415
Custom wrapper script instead of AppRun
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:
- Create the
appdir/
directories (appdir/usr/bin
,appdir/usr/share/applications
, ...). - Create the wrapper script or program.
- Copy the main executables, not the wrapper, into
appdir/usr/bin/
. - Copy the
.desktop
files intoappdir/usr/share/applications/
. Note that the desktop files'Exec=
should still point to your executables, not theAppRun
. - Copy the icon file into
appdir/usr/share/icons/hicolor/
. - Copy any other resources you may wish (Qml, etc).
- Run
linuxdeployqt appdir/usr/share/application/*.desktop
with any options you may need. - Remove
appdir/AppRun
which is created bylinuxdeployqt
. - Copy your wrapper in
appdir/AppRun
(i.e. to the place of theAppRun
that was there). - 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 https://github.com/probonopd/linuxdeployqt/issues/135#issuecomment-310170286)
This could be in any scripting language your target platform supports, or a complete binary program.
#!/bin/bash
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.
linuxdeployqt -- Software packaging for Linux made simple! ❤️
Linuxdeployqt is the one-in-all solution for packaging application. If it doesn't do the job, we consider it a bug of the software. Please open an issue and suggest your idaes!
Support our mission for a revolution of the Linux desktop and application deployment therefore! Visit http://appimage.org for more information on AppImage, related technologies, user and open source project lead voices, and examples!