Introduction
In this article, as a continuation of what was explained in the previous section, we will explain how to turn our application, which we have made independent from the system, into an appimage.
Part 1 of our article from this address .
First, decoding and packaging the Appimage file, then the internal structure of the appimage file will be discussed.
Resolving Appimage files
to any appimage file –appimage-extract Appimage file is resolved when parameter is added.
Appimage packaging
Appimage files appimagekit packaged using Appimagekit is used as follows.
ARCH=x86_64 appimagetool-x86_64.AppImage /home/user/appimage-project
Our Appimage file is created in a parent directory of our project directory.
Creating a packaging index
First we need to create the packaging directory. Appimage files need basic 3 files. These Apprun file is the application launcher and application icon.
$ ls appimage-test test.desktop test.png AppRun ... test.bin libs/ ld-linux-x86-64.so.2 ...
We need to place our application, which we made independent from the system in the previous section, as in the example above. Here .desktop Let's take a closer look at our extension file.
[Desktop Entry] Name=Test application Exec=test.bin Icon=test Type=Application Categories=Utility;
Burada Name the name of our application, Exec the name of the file to run, Icon Specifies the application icon name.
- Note: Icon There must be an application icon with the same name as the one specified in the section.
AppRun file
The AppRun file is the file that will be run when appimage is run. In this file, the commands required to run our application are defined.
#!/bin/bash echo "Hello World"
Above, we used a simple command that writes to the screen. Here are the points to note:
- Because Appimage is designed to work on all systems / bin / sh instead / bin / bash preferable.
- A packaged appimage file is mounted and executed as read-only.
- The AppRun file must be the yellow executable. It doesn't need to be a script. If binary files are to be used, they must be compiled as static.
Let's run our application in our AppRun file as in the previous section. First, we need to determine our current location. For this readlink We can use the command.
#!/bin/bash export SELF=$(readlink -f "$0") export HERE=${SELF%/*} "${HERE}"/ld-linux-x86-64.so.2 --library- path "${HERE}"/libs/ "${HERE}"/test.bin
In the example below, the appimage mount directory HERE We defined it as an environmental variable and started our application using it.
Environmental variables
In the rest of the article, we will focus on the definitions required for our application to work properly.
In our AppRun file glib For schemas, environmental variable definitions are made as follows. Then our glib schema is compiled.
# Add the following to our AppRun file. export GSETTINGS_SCHEMA_DIR="${HERE}"/glib-schemas # Our glib schema is compiled as follows. glib-compile-schemas project-directory/glib-schemas
Qt plugin directory QT_PLUGIN_PATH specified by the variable.
export QT_PLUGIN_PATH="${HERE}"/qt5/plugins
The app normally /usr/share the location of the files that should be in the directory XDG_DATA_DIRS We may need to define it with a variable.
export XDG_DATA_DIRS="${HERE}"/share
Python module directory PYTHONPATH is defined with.
export PYTHONPATH="${HERE}/python-shared"
Perl library directories PERLLIB is defined with.
export PERLLIB="${HERE}/perl-libs"