Open ManBearPigg opened 6 months ago
This script turns the released binary into a appimage.
#!/bin/sh
set -u
APP=Lorien
SITE="mbrlabs/Lorien"
APPIMAGETOOL=$(wget -q https://api.github.com/repos/probonopd/go-appimage/releases -O - | sed 's/[()",{} ]/\n/g' | grep -oi 'https.*continuous.*tool.*86_64.*mage$')
# CREATE DIRECTORIES AND PREPARE ARCHIVE
[ -n "$APP" ] && mkdir -p ./"$APP".AppDir && cd ./"$APP".AppDir
version=$(wget -q https://api.github.com/repos/"$SITE"/releases/latest -O - | sed 's/[()",{} ]/\n/g' | grep -oi 'https.*linux.*xz$' | head -1)
wget "$version" && tar fx ./*tar* && rm -f ./*tar* && mv ./*/* ./ && find . -empty -type d -delete && mv ./*x86_64 ./"$APP" || exit 1
mkdir -p ./usr/bin ./usr/share/applications && mv "$APP"* ./usr/bin/ || exit 1
# DESKTOP ENTRY AND ICON
DESKTOP="https://raw.githubusercontent.com/mbrlabs/Lorien/main/public/linux/com.github.mbrlabs.Lorien.desktop"
ICON="https://raw.githubusercontent.com/mbrlabs/Lorien/main/art/logo.svg"
wget -q "$DESKTOP" -O ./usr/share/applications/com.github.mbrlabs.Lorien.desktop || exit 1
wget -q "$ICON" -O ./com.github.mbrlabs.Lorien.svg || exit 1
ln -s usr/share/applications/*desktop ./ && ln -s ./*.svg ./.DirIcon || exit 1
# AppRun
cat >> ./AppRun << 'EOF'
#!/bin/sh
CURRENTDIR="$(readlink -f "$(dirname "$0")")"
exec "$CURRENTDIR"/usr/bin/Lorien "$@"
EOF
chmod a+x ./AppRun
# MAKE APPIMAGE
cd ..
export ARCH=x86_64
export VERSION="$(./"$APP".AppDir/AppRun --version)"
wget -q "$APPIMAGETOOL" -O ./appimagetool && chmod a+x ./appimagetool || exit 1
./appimagetool -s ./"$APP".AppDir || exit 1
echo "All Done!"
It uses go-appimagetool instead as it makes the appimage with the static runtime which means there is no libfuse2 requirement on the host.
I tried to add an appimage job ci
However I get error Required helper tool file missing
from appimagetool, this is because the docker container doesn't have file
available.
I don't know how to make it available.
I tried to add an appimage job ci
However I get error
Required helper tool file missing
from appimagetool, this is because the docker container doesn't havefile
available.I don't know how to make it available.
The CI should be using the .AppImage releases of appimagetool
:-"|
The Case for AppImage
I see that there is discussion about a Flatpak release and that's great. But for now, there is a single binary. Usually this type of single file release uses AppImage format. There is commonly used tooling to essentially install an AppImage, providing a taskbar shortcut with an icon, adding it to the application launcher, etc. When foregoing package managers, AppImage is a more polished and user friendly release that accommodates the Linux user's GUI. People don't really want to start a graphical app with the terminal.
Furthermore, converting the binary into an AppImage is super easy. It will take literally two minutes and it will work the first try.
How to Convert the Linux Binary to an AppImage File
I'm not experienced with Github release CLI or whatever, so I'll just explain how I converted the binary to an AppImage.
Create the following directory structure:
Copy and paste the AppRun file:
Copy and paste the Lorien.desktop file:
Make AppRun and Lorien (the Lorien binary, I might have renamed it) executable.
Download the appimagetool (itself an AppImage!) which is the official software used to build an AppImage: https://github.com/AppImage/AppImageKit/releases
Then simply:
./appimagetool-x86_64.AppImage Lorien.AppDir
That will produce the Lorien-x86_64.AppImage file which can be included as a release.
Then the Linux user can use their GearLever or whatever to install the program, and they will be appreciative.