Distributing for Linux

Does anybody have a guide for preparing Xojo apps for distribution to Linux? It’s been a long while for me. My last adventure with the topic was building the rpm and deb installers for Xojo and Feedback. These days there seems to be more favorable options.

Flatpak seems like the most promising direction, but I can’t figure out what to tell it for a runtime. I’m not married to Flatpak either, so I’m open to other suggestions.

I package Linux apps as AppImages (for portability). A lot of the users of my Linux apps are on either Fedora or openSUSE so also build rpm’s for those.
I’ll try to find my latest notes on creating an AppImage for a Xojo app.

Desktop (GUI) or Server Process (Web, Console) ?

Desktop

This is the first I’m hearing of AppImage. Looking at Flatpak vs. Snap vs. AppImage | Side by Side Comparison suggests I’d probably want to look into Snap more though. AppImage has my curiosity, but it sounds like it wouldn’t handle setting up required dependencies such as libwebkitgtk.

I use a tarball created with the -P option so that the files are properly placed on extraction.

Place all of your needed files and environment into their proper locations and the tar 'em up. This has resolved 99% of our install problems on Linux. That 1% is usually libunwind …

For example:

#!/bin/bash

echo "Cleaning existing folders"
rm -rf /usr/local/ArGest\ Backup/.license*
rm -rf /usr/local/ArGest\ Backup/Catalogs/*
rm -rf /usr/local/ArGest\ Backup/Tapes/*
rm -rf /usr/local/ArGest\ Backup/Definitions/*
rm -rf /usr/local/ArGest\ Backup/Destinations/*
rm -rf /usr/local/ArGest\ Backup/tmp/*
rm -rf /usr/local/ArGest\ Backup/log/*
touch /usr/local/ArGest\ Backup/log/bruexeclog
rm -rf /usr/local/ArGest\ Backup/etc/*
touch /usr/local/ArGest\ Backup/etc/bruxpat
touch /usr/local/ArGest\ Backup/etc/brusmartrest

echo "Removing old version from /opt"
rm -rf /opt/ArGest\ Backup

echo "Copying the new build"
cp -r Builds\ -\ ArGest\ Backup/Linux\ 64\ bit/ArGest\ Backup /opt/

echo Resetting the ownership and group
chown -R root:tape /usr/local/ArGest\ Backup

echo "Building tarball"
tar -czPf ~/ArGest_Backup_$1_Linux-x86_64.tgz /usr/local/ArGest\ Backup \
    /opt/ArGest\ Backup /usr/local/bin/bru /usr/local/bin/brutalk \
    /usr/local/bin/showlicense /usr/share/applications/argestbackup.desktop \
    /etc/sudoers.d/BRUExemptions \
    /opt/ArGest\ Backup\ Import\ Tool /usr/share/applications/argestbackupimport.desktop

echo "Tarball complete."
sleep 1

You could then wrap that tarball in an installer using something like this (ArGestBackupInstaller.run) - grabbed this from a Baeldung article a while back, but not too complex:

#!/bin/bash

function die() { echo "Error!"; exit 1; }

installer="$(pwd)/$(basename $BASH_SOURCE)"

cd ~/ || die
echo "Installing demo-app to ~/demo-app..."

archive=$(grep -a -n "__ARCHIVE_BELOW__:$" $installer | cut -f1 -d:)
echo $(tail -n +$((archive + 1)) $installer)

tail -n +$((archive + 1)) $installer | gzip -vdc - | tar -xPf - > /dev/null || die
# notice the upper case P in that extract command

# run some post installation if any
# ./app_name/bin/post_install_configuration.sh || die

echo "Installation complete!"
exit 0

__ARCHIVE_BELOW__:

Now just cat the tarball onto the end of the script and make the result executable.