Skip to content

Commit f72df7f

Browse files
authored
switch to electron builds (#12)
1 parent 5190b89 commit f72df7f

2 files changed

Lines changed: 33 additions & 23 deletions

File tree

get-dependencies.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,31 @@ ARCH=$(uname -m)
66

77
echo "Installing package dependencies..."
88
echo "---------------------------------------------------------------"
9-
pacman -Syu --noconfirm patchelf gst-plugins-good gst-plugins-bad libnss_nis nss-mdns
9+
pacman -Syu --noconfirm patchelf libnss_nis nss-mdns nss
1010

1111
echo "Installing debloated packages..."
1212
echo "---------------------------------------------------------------"
13-
get-debloated-pkgs --add-common --prefer-nano
13+
get-debloated-pkgs --add-common --prefer-nano ffmpeg-mini
1414

1515
# Comment this out if you need an AUR package
16-
make-aur-package opencode-desktop-bin
16+
# make-aur-package
1717

18-
# If the application needs to be manually built that has to be done down here
18+
echo "Getting binary..."
19+
echo "---------------------------------------------------------------"
20+
case "$ARCH" in
21+
x86_64) farch=amd64;;
22+
aarch64) farch=arm64;;
23+
esac
24+
link=https://github.com/anomalyco/opencode/releases/latest/download/opencode-electron-linux-$farch.deb
25+
if ! wget --retry-connrefused --tries=30 "$link" -O /tmp/temp.deb 2>/tmp/download.log; then
26+
cat /tmp/download.log
27+
exit 1
28+
fi
29+
ar xvf /tmp/temp.deb
30+
tar -xvf ./data.tar.xz
31+
rm -f ./*.xz /tmp/temp.deb
32+
33+
mkdir -p ./AppDir/bin
34+
cp -rv ./opt/OpenCode/* ./AppDir/bin
35+
cp -v ./usr/share/applications/@*.desktop ./AppDir
36+
cp -v ./usr/share/icons/hicolor/150x150/apps/@*.png ./AppDir

make-appimage.sh

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,32 @@ export ARCH VERSION
88
export OUTPATH=./dist
99
export ADD_HOOKS="self-updater.bg.hook"
1010
export UPINFO="gh-releases-zsync|${GITHUB_REPOSITORY%/*}|${GITHUB_REPOSITORY#*/}|latest|*$ARCH.AppImage.zsync"
11-
export ICON=/usr/share/icons/hicolor/128x128/apps/OpenCode.png
12-
export DESKTOP=/usr/share/applications/OpenCode.desktop
1311
export DEPLOY_OPENGL=1
1412

13+
# save the bun binary for later
14+
cp -v ./AppDir/bin/resources/opencode-cli ./
15+
1516
# Deploy dependencies
1617
quick-sharun \
17-
/usr/bin/opencode* \
18+
./AppDir/bin/* \
1819
/usr/lib/libnss_nis.so* \
1920
/usr/lib/libnsl.so* \
2021
/usr/lib/libnss_mdns*_minimal.so*
2122

2223
# bun makes binaries that self extract and read /proc/self/exe
2324
# they are also very delicate and get broken by strip
25+
f=./AppDir/bin/opencode-cli
26+
rm -f "$f" ./AppDir/bin/resources/opencode-cli
2427
kek=.$(tr -dc 'A-Za-z0-9_=-' < /dev/urandom | head -c 10)
25-
rm -f \
26-
./AppDir/bin/opencode \
27-
./AppDir/bin/opencode-cli \
28-
./AppDir/shared/bin/opencode \
29-
./AppDir/shared/bin/opencode-cli
30-
cp -v /usr/bin/opencode ./AppDir/bin/opencode
31-
ln -s opencode ./AppDir/bin/opencode-cli
32-
patchelf --set-interpreter /tmp/"$kek" ./AppDir/bin/opencode
33-
patchelf --set-rpath '$ORIGIN/../lib' ./AppDir/bin/opencode
28+
cp -v ./opencode-cli "$f"
29+
patchelf --set-interpreter /tmp/"$kek" "$f"
30+
patchelf --set-rpath '$ORIGIN/../lib' "$f"
31+
ln -s ../opencode-cli ./AppDir/bin/resources/opencode-cli
3432

3533
cat <<EOF > ./AppDir/bin/random-linker.src.hook
36-
#!/bin/sh
34+
#!/bin/false
3735
cp -f "\$APPDIR"/shared/lib/ld-linux*.so* /tmp/"$kek"
3836
EOF
39-
chmod +x ./AppDir/bin/*.hook
40-
41-
# for weird reasons opencode now attempts to execute $(basename $APPIMAGE)/opencode-cli
42-
# this makes absolutely no sense wtf, so we have to set the APPIMAGE var to the
43-
# opencode binary inside the AppDir so that it resolves correctly
44-
echo 'APPIMAGE=${SHARUN_DIR}/bin/opencode' >> ./AppDir/.env
4537

4638
# Turn AppDir into AppImage
4739
quick-sharun --make-appimage

0 commit comments

Comments
 (0)