Arch2appimage: Convert Arch Package into Appimage using Python Script on Linux

If you are using Arch Linux due to a specific package being only available in that distribution, then it’s time for you to move on with that package.

What am I talking about? You might be thinking about what I’ve just said. Look, you and I both know that Arch or its derivatives like Manjaro and Endeavour, are community-driven and have the largest software repository.

It’s been a long time since I’ve used Arch or any of its derivates, but as I recall, I remember there were many packages that were not available for other distributions and vice-versa.

However, if you are using an Arch-based system just because your favourite package is not available for another distribution like Debian, Ubuntu, RHEL, Fedora, etc, then it’s time for you to move your package to those distributions using Arch2appimage.

What is the Arch2appimage Tool in Arch Linux?

The Arch2appimage (inspired by Arch-Deployer) is a free and open-source script or tool written in Python with the goal of converting Arch Linux packages either from the official Arch Linux Repositories or from the AUR into Appimage.

As you already know, Appimage is mostly supported by all popular Linux distributions. Why? Because it includes the package and all its dependencies inside the sandboxed package, isolated from your Linux system.

When you execute this tool, it will ask for the package name and then compile the package and create an Appimage format including all necessary dependencies, including dependencies on dependencies for better compatibility.

Remember, to use this tool you have to have an Arch-based system like Manjaro or Endeavour. Because it uses the Yay package manager under the shell to download the package. However, if you are a developer, you can easily modify the script according to your personal needs.

With that due, let’s move into the next section on the installation of this tool.

How to Install Arch2appimage on Arch Linux

To install this tool, make sure you have Python3, Pip3, and Git installed on your system.

Then run the following command to clone the Arch2appimage repository:

$ git clone https://github.com/hanzala123/arch2appimage

Below is the output of the above command.

Cloning git repository
Cloning git repository

Enter into the tool directory using the cd command as shown.

$ cd arch2appimage/

Download and install all the required Python libraries for this tool.

$ pip3 install -r requirements.txt

Below is the output of the above command.

Installing python required libraries
Installing Python required libraries

That’s all for now. Now you can move into the next section and start packaging your favourite Arch package into Appimage.

Convert Arch Packages into Appimage Format using Arch2appimage

First, launch the application using Python3.

$ python3 arch2appimage.py

Then you will interact with the following screen.

Arch2appimage
Arch2appimage

As you look above, you will notice that the program is asking for the Arch package name.

In this case, I want to create an Appimage for the gnome-terminal from the Arch repository. For that, I will pass the gnome-terminal as input to the program.

Enter the name of the package (leave empty to quit)
[?] >>: gnome-terminal

Note: Replace gnome-terminal with the actual package name that you want to create an Appimage for.

It will download the package from the Arch repository and ask you to choose an icon to be used for your application. For gnome-terminal, there are three options, but it varies from package to package. Just go with your intuition and choose the one you find more relevant.

Downloading gnome-terminal...
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB961.5 kB/s • 0:00:00   

Please select the icon file to be used
[?] >>: AppDir/usr/share/icons/hicolor/scalable/apps/org.gnome.Terminal.svg
 > AppDir/usr/share/icons/hicolor/scalable/apps/org.gnome.Terminal.svg
   AppDir/usr/share/icons/hicolor/symbolic/apps/org.gnome.Terminal-symbolic.svg
=

Next, it will show you the list of packages to be downloaded to support this application. If you have any additional packages to add, then specify them by typing their names, or else press ENTER to continue.

These packages (and their dependencies) will be downloaded:
1. vte3
2. gsettings-desktop-schemas

If you would like to add additional packages please enter them below (space seperated). Leave empty to start downloading
[?] >>: 

It will now download the supporting packages.

Downloading vte3...
      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB961.5 kB/s • 0:00:00    
Downloading gsettings-desktop-schemas...
      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB961.5 kB/s • 0:00:00     

It will ask you to download the latest version of the libunionpreload.so package or use the existing one. For now, I will choose “yes” to download the latest version of the libunionpreload.so package.

Would you like to download the latest libunionpreload.so? If you select No the existing one will be used.
[?] >>: Yes
 > Yes
   No

Downloading libunionpreload.so...
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB961.5 kB/s • 0:00:00    
AppDir is ready. Please take a look into the directory to ensure everything is OK.
Exec the AppRun (command './AppRun') to test if everything works.

Finally, your package is ready to be converted into Appimage format. All the resources for your packages, like source code and dependencies, are downloaded and located in the arch2appimage/AppDir directory.

At the next prompt, it will ask you to either build the AppImage or Add more packages. For now, there is no extra package I need to add, so I will continue with the Build the AppImage option.

What would you like to do next?
[?] >>: Build the AppImage
 > Build the AppImage
   Add more packages

Next, it will ask you to choose the latest AppImageTool to build your Appimage (used to generate Appimage files) or the existing one. For instance, I will go with “yes“.

Would you like to download the latest AppImageTool? If you select No the existing one will be used.
[?] >>: Yes
 > Yes
   No

Downloading AppImageTool...
            ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB961.5 kB/s • 0:00:00    
Running AppImageTool...

Created symlink /home/jr/.config/systemd/user/default.target.wants/appimagelauncherd.service → /usr/lib/systemd/user/appimagelauncherd.service.
[AppImageLauncher] Warning: can't find fallback icon for namedialog-ok
[AppImageLauncher] Warning: can't find fallback icon for namedialog-cancel
[AppImageLauncher] Warning: can't find fallback icon for namedocument-revert
appimagetool, continuous build (commit 4bcfe23), build <local dev build> built on 2022-08-17 01:03:50 UTC
Using architecture x86_64
/home/jr/arch2appimage/AppDir should be packaged as out/gnome-terminal-x86_64.AppImage
Deleting pre-existing .DirIcon
Creating .DirIcon symlink based on information from desktop file
Generating squashfs...
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on out/gnome-terminal-x86_64.AppImage, block size 131072.
[==================================================================================================================================================-] 985/985 100%

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
        compressed data, compressed metadata, compressed fragments,
        compressed xattrs, compressed ids
        duplicates are removed
Filesystem size 4037.33 Kbytes (3.94 Mbytes)
        27.38% of uncompressed filesystem size (14743.19 Kbytes)
Inode table size 12519 bytes (12.23 Kbytes)
        27.21% of uncompressed inode table size (46012 bytes)
Directory table size 9384 bytes (9.16 Kbytes)
        25.97% of uncompressed directory table size (36131 bytes)
Number of duplicate files found 4
Number of inodes 1350
Number of files 971
Number of fragments 129
Number of symbolic links  60
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 319

Congratulation! The gnome-terminal is converted into Appimage format and waiting for you in the arch2appimage/out directory.

But hold on, it will again prompt you to “Would you like to re-build it?“. Simply go with the “no” option.

Would you like to re-build it?
[?] >>: No
   Yes
 > No

Finally, choose “yes” to remove all the resources from AppDir/ that are no longer required.

Would you like to remove AppDir/
[?] >>: Yes
 > Yes
   No

Exiting...

In the same Arch2appimage cloned directory, you will find the /out directory. You can check your Appimage inside that directory by using the cd and ls commands.

$ cd out/
$ ls -l

Below is the output of the above commands.

Checking the content of the out directory
Checking the content of the out directory

Wrap Up

This method is useful for some packages that are exclusive to Arch-based distros. However, note that if you are creating an Appimage of a package that needs to be run on a specific desktop environment, then you should have to run the Appimage on that DE.

For example, I have created an Appimage of gnome-terminal. This method has included all of the dependencies that are required by this package. However, the gnome-terminal also requires some programs that come with the Gnome desktop environment.

So, if you run the Appimage in KDE, Xfce, etc, the desktop environment will throw an error. In this case, you need to run this Appimage only in the Gnome desktop environment, which you can easily convert from your current DE.

If you have encountered any issues or are facing any difficulty while using this program, then do let us know in the comment section.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments