generated from pkgforge-dev/TEMPLATE-AppImage
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake-appimage.sh
More file actions
43 lines (36 loc) · 1.54 KB
/
make-appimage.sh
File metadata and controls
43 lines (36 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
set -eu
ARCH=$(uname -m)
VERSION=$(pacman -Q opencode-desktop-bin | awk '{print $2; exit}') # example command to get version of application here
export ARCH VERSION
export OUTPATH=./dist
export ADD_HOOKS="self-updater.bg.hook"
export UPINFO="gh-releases-zsync|${GITHUB_REPOSITORY%/*}|${GITHUB_REPOSITORY#*/}|latest|*$ARCH.AppImage.zsync"
export ICON=/usr/share/icons/hicolor/128x128/apps/OpenCode.png
export DESKTOP=/usr/share/applications/OpenCode.desktop
export DEPLOY_OPENGL=1
# Deploy dependencies
quick-sharun /usr/bin/opencode*
# bun makes binaries that self extract and read /proc/self/exe
# they are also very delicate and get broken by strip
kek=.$(tr -dc 'A-Za-z0-9_=-' < /dev/urandom | head -c 10)
rm -f \
./AppDir/bin/opencode \
./AppDir/bin/opencode-cli \
./AppDir/shared/bin/opencode \
./AppDir/shared/bin/opencode-cli
cp -v /usr/bin/opencode ./AppDir/bin/opencode
ln -s opencode ./AppDir/bin/opencode-cli
patchelf --set-interpreter /tmp/"$kek" ./AppDir/bin/opencode
patchelf --set-rpath '$ORIGIN/../lib' ./AppDir/bin/opencode
cat <<EOF > ./AppDir/bin/random-linker.src.hook
#!/bin/sh
cp -f "\$APPDIR"/shared/lib/ld-linux*.so* /tmp/"$kek"
EOF
chmod +x ./AppDir/bin/*.hook
# for weird reasons opencode now attempts to execute $(basename $APPIMAGE)/opencode-cli
# this makes absolutely no sense wtf, so we have to set the APPIMAGE var to the
# opencode binary inside the AppDir so that it resolves correctly
echo 'APPIMAGE=${SHARUN_DIR}/bin/opencode' >> ./AppDir/.env
# Turn AppDir into AppImage
quick-sharun --make-appimage