138498956e
linuxdeploy injects a RUNPATH ($ORIGIN/../lib) via patchelf into every usr/bin executable when building the AppDir. The Bun-compiled xpbridge sidecar (self-contained, JS/assets appended past the ELF) does not survive ELF rewriting — the patched copy core-dumps on start, so the app launches but the bridge never listens. Add scripts/fix-linux-appimage.sh: extract the built AppImage, restore the pristine repo sidecar, repack with linuxdeploy-plugin-appimage (which does not patchelf), verify the sidecar is byte-identical, and regenerate the updater .sig. Wired into scripts/build-linux.sh after `tauri build`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
46 lines
2.2 KiB
Bash
46 lines
2.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Build the Linux AppImage + .deb (x86_64) in Docker. Run from the repo root,
|
|
# AFTER scripts/prep-desktop.sh has produced the linux sidecar + web resources.
|
|
# On Apple Silicon this runs under qemu (linux/amd64) and is slow but works.
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
IMG=xpcockpit-linux-builder
|
|
echo "==> building docker image ($IMG)"
|
|
docker build --platform linux/amd64 -f desktop/Dockerfile.linux -t "$IMG" desktop >/dev/null
|
|
|
|
# The updater signing key is a secret and is NOT in the repo. If it's present
|
|
# locally we sign + emit updater artifacts; otherwise we build plain installable
|
|
# bundles (appimage + deb) with updater artifacts disabled via a config override.
|
|
SIGN_ENV=(); BUNDLES="appimage,deb,updater"; CFG=""
|
|
if [[ -f desktop/.tauri-signing.key && -f desktop/.tauri-signing.pw ]]; then
|
|
SIGN_ENV=(-e "TAURI_SIGNING_PRIVATE_KEY=$(cat desktop/.tauri-signing.key)"
|
|
-e "TAURI_SIGNING_PRIVATE_KEY_PASSWORD=$(cat desktop/.tauri-signing.pw)")
|
|
echo "==> signing key found — emitting signed updater artifacts"
|
|
else
|
|
BUNDLES="appimage,deb"; CFG='--config {"bundle":{"createUpdaterArtifacts":false}}'
|
|
echo "==> no signing key — building plain appimage + deb (no updater artifacts)"
|
|
fi
|
|
|
|
echo "==> tauri build (x86_64-unknown-linux-gnu) in container — this takes a while under emulation"
|
|
docker run --rm --platform linux/amd64 \
|
|
-v "$ROOT":/work \
|
|
-e CARGO_TARGET_DIR=/work/target-linux \
|
|
-e APPIMAGE_EXTRACT_AND_RUN=1 \
|
|
-e ARCH=x86_64 \
|
|
"${SIGN_ENV[@]}" \
|
|
-w /work/desktop \
|
|
"$IMG" \
|
|
bash -c "export PATH=/usr/local/cargo/bin:\$PATH; tauri build --target x86_64-unknown-linux-gnu --bundles $BUNDLES $CFG"
|
|
|
|
# Repair the Bun sidecar that linuxdeploy's patchelf corrupts inside the AppImage
|
|
# (see scripts/fix-linux-appimage.sh). Runs on the host against the mounted
|
|
# artifacts; regenerates the updater .sig when a signing key is present.
|
|
echo "==> repairing AppImage sidecar"
|
|
bash "$ROOT/scripts/fix-linux-appimage.sh"
|
|
|
|
echo "==> artifacts:"
|
|
find target-linux/x86_64-unknown-linux-gnu/release/bundle -maxdepth 2 -type f \
|
|
\( -name '*.AppImage' -o -name '*.deb' -o -name '*.AppImage.sig' -o -name '*.tar.gz' -o -name '*.sig' \) 2>/dev/null
|