How to create a linux installer for a Xojo app

Tim Jones

I use a combination of a script and a tarball. The script handles checking that the user has the proper authorizations and then extracts the tarball content into their proper location. There are dozens of variations out there if you search, and this could be enhanced into a GUI using zenity or xdialog.

#!/bin/bash

id | grep uid=0
if [ $? -ne 0 ]
then
  echo "Must be root or use sudo to execute this installer."
  exit 1
fi

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

echo "Installing OWC ArGest Backup ..."

ARCHIVE=`awk '/^__ARCHIVE_BELOW__/ {print NR + 1; exit 0; }' $0`

tail -n+$ARCHIVE $0 | tar xzP

# notice the upper case P in that extract command
# This allows tar to retain the parent path elements instead
# of stripping them off.

# run post installation steps
## place any commands that should be executed after the
## tarball is extracted here.

echo "Installation complete!"
exit 0

__ARCHIVE_BELOW__:

Now, create your tarball using the same -P (upper case P), and then concat the two files into a .run file, and set the execute bit:

cp  installer_template.sh MyApp.Installer.run
cat MyApp.tgz >> MyApp_Installer.run
sudo chmod +x MyApp_Installer.run
zip -f MyApp_Installer.zip MyApp_Document.pdf MyApp_Installer.run

Share the MyApp_Installer.zip file with your users.

This works with any platform type redardless of the package manager. You’ll finde a lot of commercial apps use this type of installer.

source dec 2022