Skip to content

Commit 41b31c2

Browse files
authored
work around bun nonsense
1 parent ead175b commit 41b31c2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

make-appimage.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@ quick-sharun \
1616
/usr/bin/OpenCode \
1717
/usr/bin/opencode-cli
1818

19-
# Additional changes can be done in between here
19+
# bun makes binaries that self extract and read /proc/self/exe
20+
# they are also very delicate and get broken by strip
21+
kek=.$(tr -dc 'A-Za-z0-9_=-' < /dev/urandom | head -c 10)
22+
rm -f ./AppDir/bin/opencode-cli ./AppDir/shared/bin/opencode-cli
23+
cp -v /usr/bin/opencode-cli ./AppDir/bin/opencode-cli.wrapped
24+
patchelf --set-interpreter /tmp/"$kek" ./AppDir/bin/opencode-cli.wrapped
25+
patchelf --set-rpath '$ORIGIN/../lib' ./AppDir/bin/opencode-cli.wrapped
26+
27+
cat <<EOF > ./AppDir/bin/opencode-cli
28+
#!/bin/sh
29+
cp -f "\$APPDIR"/shared/lib/ld-linux*.so* /tmp/"$kek"
30+
exec "\$APPDIR"/bin/opencode-cli.wrapped "\$@"
31+
EOF
32+
chmod +x ./AppDir/bin/opencode-cli*
2033

2134
# Turn AppDir into AppImage
2235
quick-sharun --make-appimage

0 commit comments

Comments
 (0)