From ef1a8ddb92e9b3c583e07663338fcd088a2f7c69 Mon Sep 17 00:00:00 2001 From: lambdcalculus <64238778+lambdcalculus@users.noreply.github.com> Date: Mon, 17 Mar 2025 06:32:11 -0300 Subject: [PATCH] More Linux integration (#1085) * Add integration shell scripts for linux! These shell scripts (one for appimage and one for dynamic) both should: 1: Move the program files to ~/.local/Attorney_Online 2: Create a .desktop file (which is what applications on Linux use to know to be interacted with) in the ~/.local/share/applications folder (where all other user applications tend to go), with at current a temporary logo until the logo file is parsed out from the xapplication window. 3: open the application, assuming the necessary dependencies are fulfilled Dynamic required some further support due to the startup shell command working correctly when you click it manually, but struggling on the .desktop folder, so it has the additional step of recreating the current launch.sh command, which still functions if you go to the folder to click it, or if you open the program before integration to test things. Both sh commands open AO2-Client at completion time. I hope this will help newer Linux users, or older Linux users who normally wouldn't bother, to bring AO into their normal day to day experience. This has been tested on (by me): Fedora 40 Workstation (Gnome) Arch Linux KDE Plasma 6 Ubuntu Unity 24.10 aka Oracular Oriole Debian 13 Trixie (Before it's freeze, marking date February 9th 2025) Thank you for reading, have a wonderful day! * linux CI tweaks * remove the need for `launch.sh` * add git hash as appimage version * bit of reorganization * add linux install scripts to CI * tweak linux install scripts to add install scripts * remove `launch.sh` (as per previous commit) * add instructions in README_LINUX * include icon in linux install * fix install script and fix typo * add exec path to desktop files * why would freedesktop.org do this to me --------- Co-authored-by: OrioleNix <163466443+OrioleNix@users.noreply.github.com> --- .github/workflows/build.yml | 21 +++++++++++++++------ README_LINUX.md | 2 ++ scripts/APPIMAGE_INSTALL.sh | 32 ++++++++++++++++++++++++++++++++ scripts/DYNAMIC_INSTALL.sh | 29 +++++++++++++++++++++++++++++ scripts/launch.sh | 10 ---------- 5 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 scripts/APPIMAGE_INSTALL.sh create mode 100644 scripts/DYNAMIC_INSTALL.sh delete mode 100644 scripts/launch.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4589b4..031cd4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -187,13 +187,16 @@ jobs: cd ${{ github.workspace }}/bin mkdir ./imageformats cp ../qtapng/plugins/imageformats/libqapng.so ./imageformats - cp ../scripts/launch.sh . + cp ../data/logo-client.png ./icon.png cp ../README_LINUX.md . - chmod +x launch.sh + cp ../scripts/DYNAMIC_INSTALL.sh ./INSTALL.sh + chmod +x INSTALL.sh chmod +x Attorney_Online + patchelf --add-rpath . Attorney_Online + cd .. - tar --transform='flags=r;s|bin|Attorney_Online|' -cvf Attorney_Online-Dynamic.tar bin + tar --transform='flags=r;s|bin|Attorney Online|' -cvf Attorney_Online-Dynamic.tar bin - name: Create AppImage shell: bash @@ -214,17 +217,23 @@ jobs: cp scripts/Attorney_Online.desktop AppDir/usr/share/applications cp data/logo-client.png AppDir/Attorney_Online.png + GIT_SHORT_SHA="${GITHUB_SHA::8}" QTDIR=${QT_ROOT_DIR} ./appimagetool deploy AppDir/usr/share/applications/Attorney_Online.desktop - ARCH=x86_64 VERSION=2.11 ./appimagetool AppDir + ARCH=x86_64 VERSION=${GIT_SHORT_SHA} ./appimagetool AppDir + - name: Deploy AppImage + shell: bash + run: | mkdir bin-appimage cp -r bin/base bin-appimage + cp data/logo-client.png bin-appimage/icon.png cp README_LINUX.md bin-appimage + cp scripts/APPIMAGE_INSTALL.sh bin-appimage/INSTALL.sh cp Attorney_Online-*-x86_64.AppImage bin-appimage + chmod +x bin-appimage/INSTALL.sh chmod +x bin-appimage/Attorney_Online-*-x86_64.AppImage - tar -cvf Attorney_Online-AppImage.tar bin-appimage/* - tar --transform='flags=r;s|bin-appimage|Attorney_Online|' -cvf Attorney_Online-AppImage.tar bin-appimage + tar --transform='flags=r;s|bin-appimage|Attorney Online|' -cvf Attorney_Online-AppImage.tar bin-appimage - name: Upload Dynamic Artifact uses: actions/upload-artifact@master diff --git a/README_LINUX.md b/README_LINUX.md index ceabf14..146799b 100644 --- a/README_LINUX.md +++ b/README_LINUX.md @@ -2,6 +2,8 @@ There are two download options for running on Linux: the **dynamically-linked** build and the **AppImage**. The dynamic build is lighter, but might only run on newer systems. The AppImage is a bit bigger, but should run seamlessly on most systems (anything newer than Ubuntu 22.04 LTS). +Each version also accompanies an `INSTALL.sh` script that will create a desktop file for AO pointing to where the script was ran. This will enable you to run AO from an app launcher. Note that moving AO's folder will require running this script again. + ### AppImage If you downloaded the **AppImage** version, it should just be plug-and-play. If you run into errors or bugs, contact us in our [Discord server](https://discord.gg/wWvQ3pw) or open an [issue on GitHub](https://github.com/AttorneyOnline/AO2-Client/issues). diff --git a/scripts/APPIMAGE_INSTALL.sh b/scripts/APPIMAGE_INSTALL.sh new file mode 100644 index 0000000..98eb538 --- /dev/null +++ b/scripts/APPIMAGE_INSTALL.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# exit on error +set -e + +# Move to script's directory +SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +cd "${SCRIPT_DIR}" + +#add .desktop file (which should allow most DE's easy access to the program +mkdir -p ~/.local/share/applications + +# desktop files don't like spaces in the Exec field, we have to replace them with "\s" +appimage="$(echo Attorney_Online-*-x86_64.AppImage)" +escaped_exec="$(echo "$(pwd)" | sed 's/ /\\s/g')"/"$appimage" + +desktop_file="\ +[Desktop Entry] +Type=Application +Name=Attorney Online +Comment=The courtroom drama simulator +Path=$(pwd) +Exec=\"$escaped_exec\" +Icon=$(pwd)/icon.png" + +echo "$desktop_file" > ~/.local/share/applications/'Attorney Online'.desktop + +#marking the program as executable +chmod +x Attorney_Online-*-x86_64.AppImage + +#running the executable +./Attorney_Online-*-x86_64.AppImage diff --git a/scripts/DYNAMIC_INSTALL.sh b/scripts/DYNAMIC_INSTALL.sh new file mode 100644 index 0000000..87b3715 --- /dev/null +++ b/scripts/DYNAMIC_INSTALL.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# exit on error +set -e + +# Move to script's directory +SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +cd "${SCRIPT_DIR}" + +#add .desktop file (which should allow most DE's easy access to the program +mkdir -p ~/.local/share/applications + +# desktop files don't like spaces in the Exec field, we have to replace them with "\s" +escaped_exec="$(echo "$(pwd)" | sed 's/ /\\s/g')"/Attorney_Online + +desktop_file="\ +[Desktop Entry] +Type=Application +Name=Attorney Online +Comment=The courtroom drama simulator +Path=$(pwd) +Exec=\"$escaped_exec\" +Icon=$(pwd)/icon.png" + +echo "$desktop_file" > ~/.local/share/applications/'Attorney Online'.desktop + +#running the program +chmod +x Attorney_Online +./Attorney_Online diff --git a/scripts/launch.sh b/scripts/launch.sh deleted file mode 100644 index bdae56d..0000000 --- a/scripts/launch.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# Required to launch correctly - -# Move to AO's directory -SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -cd "${SCRIPT_DIR}" - -# Run with correct linker path -chmod +x Attorney_Online -LD_LIBRARY_PATH=. ./Attorney_Online