From 00b4527efa54330d952677affc98f43754b05010 Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Fri, 15 Nov 2024 02:39:11 +0000 Subject: [PATCH] fix appimage cd error and use static appimage runtime (#1924) * fix appimage cd error and use static appimage runtime * include `desktop-file-utils` for appimagetool * remove mv of old `AppRun` * revert indentation * don't export `APPIMAGE_EXTRACT_AND_RUN` --- scripts/install-dependencies.sh | 2 +- scripts/package-appimage.sh | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index d6bb83ee..41e4f7ae 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -41,7 +41,7 @@ main() { fi if [[ "$OSTYPE" == "linux"* ]]; then - sudo apt-get install -qq libfuse2 ninja-build wayland-protocols libsdl2-dev libfreetype6 + sudo apt-get install -qq libfuse2 ninja-build wayland-protocols libsdl2-dev libfreetype6 desktop-file-utils pip3 install meson elif [[ "$OSTYPE" == "darwin"* ]]; then brew install bash ninja sdl2 diff --git a/scripts/package-appimage.sh b/scripts/package-appimage.sh index f3e98e92..090f7912 100755 --- a/scripts/package-appimage.sh +++ b/scripts/package-appimage.sh @@ -55,7 +55,7 @@ done setup_appimagetool() { if [ ! -e appimagetool ]; then - if ! wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then + if ! wget -O appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then echo "Could not download the appimagetool for the arch '${ARCH}'." exit 1 else @@ -64,17 +64,6 @@ setup_appimagetool() { fi } -download_appimage_apprun() { - if [ ! -e AppRun ]; then - if ! wget -O AppRun "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${ARCH}" ; then - echo "Could not download AppRun for the arch '${ARCH}'." - exit 1 - else - chmod 0755 AppRun - fi - fi -} - generate_appimage() { [[ ! -e $BUILD_DIR ]] && scripts/build.sh $@ @@ -85,21 +74,33 @@ generate_appimage() { echo "Creating LiteXL.AppDir..." DESTDIR="$(realpath LiteXL.AppDir)" meson install -C ${BUILD_DIR} - mv AppRun LiteXL.AppDir/ - # These could be symlinks but it seems they doesn't work with AppimageLauncher + cp resources/icons/lite-xl.svg LiteXL.AppDir/ cp resources/linux/com.lite_xl.LiteXL.desktop LiteXL.AppDir/ + # https://github.com/lite-xl/lite-xl/issues/1912 + mkdir -p ./LiteXL.AppDir/usr/share/../bin + mv ./LiteXL.AppDir/lite-xl ./LiteXL.AppDir/usr/bin + mv ./LiteXL.AppDir/data ./LiteXL.AppDir/usr/share/lite-xl + rm -rf ./LiteXL.AppDir/lib64 ./LiteXL.AppDir/include + + echo "Creating AppRun..." + cat >> LiteXL.AppDir/AppRun <<- 'EOF' + #!/bin/sh + CURRENTDIR="$(dirname "$(readlink -f "$0")")" + exec "$CURRENTDIR/usr/bin/lite-xl" "$@" + EOF + chmod +x LiteXL.AppDir/AppRun + echo "Generating AppImage..." local version="" if [ -n "$VERSION" ]; then version="-$VERSION" fi - ./appimagetool --appimage-extract-and-run LiteXL.AppDir LiteXL${version}-${ARCH}-linux.AppImage + APPIMAGE_EXTRACT_AND_RUN=1 ./appimagetool LiteXL.AppDir LiteXL${version}-${ARCH}-linux.AppImage rm -rf LiteXL.AppDir } setup_appimagetool -download_appimage_apprun generate_appimage