User Tools

Site Tools


k11:k11.10:k11.10.3:start

11.10.3 Gambas-AppImages

The Gambas IDE offers the creation of installation packages for various distributions. However, you will quickly realise that the installation of a Gambas application on a target platform presents typical Linux hurdles that can quickly overwhelm a user. This applies, for example, to installation packages that were put together on platforms on which Gambas was installed via PPA. In such cases, it is often necessary to include the PPA on the target platform. Information on this can be found in the Gambas book in chapter 2.3 Installation from alternative sources - PPA. It is also tedious to create a specific installation package for each distribution and often the necessary background knowledge is lacking.

AppImages offer an alternative method here and have the great advantage that the programme runs on different Linux operating systems without special adaptation, as it contains all the necessary components in its image. AppImages are also portable and can be started from any source, including a USB stick. They can even run in a sandbox such as Firejail. These advantages come at the cost of a longer start-up time and a much larger file, which may no longer be able to be sent by email. If you want to part with an AppImage, simply delete it.

11.10.3.1 Requirements for the Gambas source code

11.10.3.1.1 Programme configuration via gb.settings

Gambas applications typically save configurations in the directory /home/user/.config/gambas3. Remember that the gambas3 directory is missing on target platforms if no Gambas is installed. It is therefore advisable to check whether the gambas3 directory exists when starting the programme. If not, you should create it immediately.

11.10.3.1.2 Using command line tools with the shell command

For a Gambas programme that is to be distributed as an AppImage, you must take into account that the target platforms can be quite different. For example, it can happen that necessary programmes are missing on the target platform. For example, when using Gambas shell commands, you should insert suitable check routines in the source code that indicate any necessary installations of missing packages. Dependencies on different desktops should be avoided or taken into account.

11.10.3.1.3 Embedding command line tools in the AppImage

To eliminate the dependency on the availability of command line tools on the target platform, you can also embed the required tools as an internal resource in the AppImage. To do this, enter the desired tool as a dependency in the dialogue for creating the installation package under “Extra dependencies”. However, these tools are then no longer accessible for shell commands due to the changed environment. You should therefore use the Exec command in such a case. Please note that the size of the AppImage increases by the size of the integrated package when a dependency is specified.

11.10.3.1.4 Problems when using curl or gb.net.curl

When using curl as a command line tool or the Gambas HttpClient (gb.net.curl), it turned out that AppImages worked perfectly on some platforms, while they failed on others - such as Opensuse. Different storage locations for SSL certificates are suspected to be the reason for this. It may therefore be necessary to take such special features of a distribution into account. Concrete solutions have not yet been developed and can therefore not yet be offered. For the time being, it is therefore recommended to use curl as a shell or exec command without embedding curl as an “extra dependency” in the AppImage.

11.10.3.2 Requirements for the creation of AppImages

11.10.3.2.1 AppImages and Ubuntu

The creation of AppImages is currently (June 2024) only possible on platforms based on the Ubuntu operating system. This includes Linux Mint. If you use other operating systems, you can help yourself with an Ubuntu-based virtual machine, for example, on which you can also install an older version of the operating system, while the Gambas version should be as up-to-date as possible. The following description was created using Mint 20.3 Una and experience has shown that it is not transferable to Ubuntu 20.4.

11.10.3.2.2 Installing the app image builder

To be able to create AppImages with the Gambas IDE, the AppImage Builder from Simon Peter is required. This builder can either be installed directly or used via an AppImage. Installation instructions for the various distributions can be found here:

https://appimage-builder.readthedocs.io/en/latest/intro/install.html

For installation on Mint platforms 20.3, these methods have proven to be successful:

Installing the required dependencies:

sudo apt install -y libgdk-pixbuf2.0-dev patchelf python3-pip python3-setuptools zsync

Installation of the AppImage-Builder:

sudo pip3 install appimage-builder

11.10.3.2.3 Creating an AppImage in the IDE

BILD 1

Figure 11.10.3.2.1: 1st package information

First load the source code of the Gambas programme from which you want to create an AppImage into the Gambas development environment (IDE). First create an executable file from the project. Then select the menu item “Project/Create installation package”. The dialogue for creating the installation package appears.

If you click on '“ Next' this dialogue appears:

BILD 2

Figure 11.10.3.2.2: 2nd change log

Optionally add a short comment on the changes here or simply click on '” Next' again - this dialogue appears:

BILD 3

Figure 11.10.3.2.3: 3rd target distribution

Select “AppImage” here and click on '“ Next'. Please note that you can skip all dialogues listed here by clicking on “Create package now”. This will start the packaging process immediately. You will find this button as a “shortcut” on all dialogue windows. If you are using an Ubuntu derivative such as Linux Mint, first select the Ubuntu version that corresponds to your Mint 20.3 (Ubuntu 20.04) in the following dialogue. Then enter the Ubuntu repository to be used “http://archive.ubuntu.com/ubuntu” and initially omit the option to create a signature.

BILD 4

Figure 11.10.3.2.4: 4th AppImageBuilder configuration

Click on '” Next'.

Select the package group in the following dialogue (option):

BILD 5

Figure 11.10.3.2.5: 5th selection of the package group

Click on '“ Next'.

Select the menu item in the next dialogue (option):

BILD 6

Figure 11.10.3.2.6: 6th menu item

After you have clicked on '” Next', you can specify the mime types used and a desktop configuration in the following dialogue (option):

BILD 7

Figure 11.10.3.2.7: 7th desktop configuration file

Click on '“ Next'.

In the following dialogue, you may have to enter important information about dependencies.

These are then taken into account when creating the package:

BILD 8

Figure 11.10.3.2.8: 8th definition of dependencies

At this point, it may be necessary to include packages in the dependency list.

Attention:

For programmes that use the gb.media component, all required GStreamer plug-ins must be specified as dependencies. For audio playback, these are the following plugins

  • gstreamer1.0-pulseaudio,
  • gstreamer1.0-plugins.base,
  • gtsreamer1.0-plugins-good.

For X11 visualisations when using the ximagesink element use:

  • gstreamer1.0-x

and for the playback of videos in various formats :

  • gstreamer1.0-libav .

In another case, the Gambas component gb.net had to be specified as a dependency because the component was only loaded in the programme at runtime.

Click on '” Next' to open the next dialogue in which you can specify additional files:

BILD 9

Figure 11.10.3.2.9: 9th specification of additional files

Clicking on '“ Next' takes you to the next dialogue in which you can specify the directory in which the generated AppImage is stored:

BILD 10

Figure 11.10.3.2.10: 10th specification of the target directory

Clicking on '” Next' takes you to the last dialogue page.

On this page, you only need to click on “Create package” to start the builder process, the progress of which will be displayed. After a few seconds, the progress journal should display the message “The packages have been successfully created” at the end.

BILD 11

Figure 11.10.3.2.11: Creating the 11th packageFinally, you will find the new AppImage in the specified target directory. You can immediately check that the application is working properly by starting it with a double-click.

11.10.3.3 Running AppImage on a third-party platform

11.10.3.3.1 Making the AppImage executable

In order for an AppImage to be started on another platform, it must first be made executable there. You can do this using the file manager or in the console:

chmod +x TV_recorder-x86_64.AppImage

11.10.3.3.2 Starting an AppImage

You can start an AppImage by double-clicking with the mouse or in the console:

./TV_recorder-x86_64.AppImage

11.10.3.4 Signing a Gambas AppImage

With Gambas versions >= 3.20.0, it is possible to sign AppImages.

This allows the authenticity of an AppImage to be ensured by checking the signature used. A GnuPG key is required for this.

11.10.3.4.1 Using existing GnuGPG keys

If you use GnuPG encryption with the Thunderbird email programme, you already have a suitable key that can be used in the Appimage Builder. Call up the menu item “Extras/Manage OpenPGP keys” in the Thunderbird GUI. In the dialogue that appears, select your own key and then click on the right mouse button. A context menu appears. In this menu, select the entry 'Copy/Fingerprint'. This copies the key to the clipboard. You can enter this key in the above dialogue '4. AppImageBuilder configuration'.

11.10.3.4.2 Creating a new signature key

As an alternative to using an existing GnuPG key, you can generate a new key in the console. The exemplary details and the generated key are not real and cannot be reproduced:

claus@claus-VirtualBox:~$ gpg --full-generate-key
gpg (GnuPG) 2.2.19; Copyright (C) 2019 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Bitte wählen Sie, welche Art von Schlüssel Sie möchten:
   (1) RSA und RSA (voreingestellt)
   (2) DSA und Elgamal
   (3) DSA (nur signieren/beglaubigen)
   (4) RSA (nur signieren/beglaubigen)
  (14) Vorhandener Schlüssel auf der Karte
Ihre Auswahl? 4
RSA-Schlüssel können zwischen 1024 und 4096 Bit lang sein.
Welche Schlüssellänge wünschen Sie? (3072)
Die verlangte Schlüssellänge beträgt 3072 Bit
Bitte wählen Sie, wie lange der Schlüssel gültig bleiben soll.
         0 = Schlüssel verfällt nie
      <n>  = Schlüssel verfällt nach n Tagen
      <n>w = Schlüssel verfällt nach n Wochen
      <n>m = Schlüssel verfällt nach n Monaten
      <n>y = Schlüssel verfällt nach n Jahren
Wie lange bleibt der Schlüssel gültig? (0)
Schlüssel verfällt nie
Ist dies richtig? (j/N) j

GnuPG erstellt eine User-ID, um Ihren Schlüssel identifizierbar zu machen.

Ihr Name: Claus Dietrich
Email-Adresse: claus.dietrich@exampledomain.de
Kommentar: For signing AppImages
Sie haben diese User-ID gewählt:
    "Claus Dietrich (For signing AppImages) <claus.dietrich@exampledomain.de>"

Ändern: (N)ame, (K)ommentar, (E)-Mail oder (F)ertig/(A)bbrechen? F
Wir müssen eine ganze Menge Zufallswerte erzeugen.  Sie können dies
unterstützen, indem Sie z.B. in einem anderen Fenster/Konsole irgendetwas
tippen, die Maus verwenden oder irgendwelche anderen Programme benutzen.
gpg: Schlüssel B3603E9243F6E126 ist als ultimativ vertrauenswürdig gekennzeichnet
gpg: Widerrufzertifikat wurde als '/home/claus/.gnupg/openpgp-revocs.d/84A01D03A8E60CB0493A6C4FB3603E9243F6E126.rev' gespeichert.
Öffentlichen und geheimen Schlüssel erzeugt und signiert.

Bitte beachten Sie, daß dieser Schlüssel nicht zum Verschlüsseln benutzt werden kann.  Sie können aber mit dem Befehl "--edit-key" einen Unterschlüssel für diesem Zweck erzeugen.
pub   rsa3072 2023-06-23 [SC]
      CB0493A6C4FB3603E9243F6E12684A01D03A8E60
uid                      Claus Dietrich (For signing AppImages) <claus.dietrich@exampledomain.de>
claus@claus-VirtualBox:~$

Memorise the password used, as it is still required!

Now enter the key 'CB0493A6C4FB3603E9243F6E12684A01D03A8E60' in the dialogue as described below.

11.10.3.4.3 Signing an AppImage (Gambas >= 3.20.0)

To sign your AppImage, you must create it as described above. You only need to select the option “Sign AppImage file with GPG key” in dialogue no. 4 and enter the existing or newly generated GnuPG key:

BILD 12

Figure 11.10.3.4.1: Entering the GnuPG key

The rest of the package creation dialogue is identical. However, at the end of the creation process, you will be asked to enter the password that was used to create the key.

11.10.3.4.4 Publishing the signature

The signature of the AppImage can be displayed with the following command and published together with the programme.

./TV_Recorder-x86_64.AppImage --appimage-signature

The signature looks like this and should be published in this form with the programme:

-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEESKAeYDpsT7NgPpJD9uEmc6sjUo4FAmSbM9QACgkQ9uEmc6sj
Uo7AXAwAgaBVkxJA7ZOvY3WgrbiWyFVqkCbCGsrI/ztlzG1ZmGoM1mxK1gSpzrKY
HJQQ+OFq9HQQgCeIn5gPRCumCiOw3qGPjhrABFVbzkQUZ8g8oR14bkQOH4vkKreC
eYVAskgVfgJ6FvJwwwwCICoHZAAOjjBrirGh5J/MLggQFv5gGLcIzj2Ak2nOXmEP
XTwRNDfj+TULvVb2UhmmppKjbVKnbudnx0WWovczbzsgoO6tvC6T1y2LILgchUxZ
hS0xsgyn0BpjusZmjGrffkfm4EoMRkuEH5Jj6tadMmw69VhxpEIevDbmUes8HZs0
pZ3DTtFnnzpCHiRvWAIAiH9SwoZr4780/bnedJFbI4ThGmI83chJudvfSIr3mwTu
a47Q+hGHWow8/ouBt0O3QiiEObhRw78W4vjNL6dhNjfC6a3hXOGvq+pfb3kRZuZT
kiMUVR0lDtx6aFBvSQasgKkBzgLnxn8gJrR9N2l3VWqpNQzMqb1GcAuTWH7Ie9Xg
gW+00mBX
=TC2c
-----END PGP SIGNATURE-----

11.10.3.4.5 Verification of the signature

As a user of the AppImage, you can now use the signature to verify the authenticity of the AppImage.

To do this, execute the same command as the creator of the AppImage:

./TV_Recorder-x86_64.AppImage --appimage-signature
The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k11/k11.10/k11.10.3/start.txt · Last modified: 16.07.2024 by emma

Page Tools