|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +set -ex |
| 4 | + |
| 5 | +export ARCH=$(uname -m) |
| 6 | +REPO="https://api.github.com/repos/lapce/lapce/releases" |
| 7 | +APPIMAGETOOL="https://github.com/pkgforge-dev/appimagetool-uruntime/releases/download/continuous/appimagetool-$ARCH.AppImage" |
| 8 | +UPINFO="gh-releases-zsync|$(echo $GITHUB_REPOSITORY | tr '/' '|')|latest|*$ARCH.AppImage.zsync" |
| 9 | +DESKTOP="https://github.com/lapce/lapce/raw/refs/heads/master/extra/linux/dev.lapce.lapce.desktop" |
| 10 | +ICON="https://raw.githubusercontent.com/lapce/lapce/eb83cee172efed14850dfe32e4bf7a5053fc2839/icons/lapce/lapce_logo.svg" |
| 11 | +URUNTIME="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-squashfs-lite-$ARCH" |
| 12 | + |
| 13 | +# lapce uses amd64 and arm64 instead |
| 14 | +if [ "$(uname -m)" = 'x86_64' ]; then |
| 15 | + arch=amd64 |
| 16 | +elif [ "$(uname -m)" = 'aarch64' ]; then |
| 17 | + arch=arm64 |
| 18 | +fi |
| 19 | + |
| 20 | +tarball_url=$(wget "$REPO" -O - | sed 's/[()",{} ]/\n/g' \ |
| 21 | + | grep -oi "https.*linux-$arch.tar.gz$" | grep -vi 'nightly' | head -1) |
| 22 | + |
| 23 | +export VERSION=$(echo "$tarball_url" | awk -F'/' '{print $(NF-1); exit}') |
| 24 | +echo "$VERSION" > ~/version |
| 25 | + |
| 26 | +wget "$tarball_url" -O ./package.tar.gz |
| 27 | +tar xvf ./package.tar.gz |
| 28 | +rm -f ./package.tar.gz |
| 29 | +mv -v ./Lapce ./AppDir |
| 30 | +chmod +x ./AppDir/lapce |
| 31 | + |
| 32 | +ln -s lapce ./AppDir/AppRun |
| 33 | +wget "$DESKTOP" -O ./AppDir/lapce.desktop |
| 34 | +wget "$ICON" -O ./AppDir/dev.lapce.lapce.svg |
| 35 | +ln -s dev.lapce.lapce.svg ./AppDir/.DirIcon |
| 36 | + |
| 37 | +# We need to set the uruntime to never use FUSE because this application |
| 38 | +# has a built in terminal which FUSE will not let us elevate rights in it |
| 39 | +# also it actually doesn't work at all when FUSE is used 👀 |
| 40 | +wget "$URUNTIME" -O ./uruntime |
| 41 | +sed -i 's|URUNTIME_EXTRACT=[0-9]|URUNTIME_EXTRACT=1|' ./uruntime |
| 42 | + |
| 43 | +wget "$APPIMAGETOOL" -O ./appimagetool |
| 44 | +chmod +x ./appimagetool |
| 45 | +./appimagetool -n -u "$UPINFO" ./AppDir --runtime-file ./uruntime |
0 commit comments