mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 00:51:17 -08:00
Points at run 13100, the first portable build carrying the relocation patch. fetch.sh could never have worked: node wrote the manifest fields without a trailing newline, so read returned 1 at EOF and set -e killed the script before it printed anything. Every earlier test had bypassed fetch.sh via SABLE_WEBKIT_RUNTIME_DIR.
50 lines
1.5 KiB
Bash
Executable File
50 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#MISE description="Download the WebRTC-enabled WebKitGTK runtime"
|
|
# Downloads the pinned webkitgtk-webrtc portable artifact into a cache dir.
|
|
#
|
|
# Usage: scripts/webkit/fetch.sh [cache-dir]
|
|
# cache-dir defaults to src-tauri/target/webkit-runtime.
|
|
#
|
|
# Override the source with SABLE_WEBKIT_ARTIFACT_URL, or point
|
|
# SABLE_WEBKIT_RUNTIME_DIR at an already-unpacked tree to skip this entirely.
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
CACHE="${1:-$ROOT/src-tauri/target/webkit-runtime}"
|
|
MANIFEST="$ROOT/scripts/webkit/runtime.json"
|
|
|
|
read -r REPO RUN ARTIFACT VERSION < <(
|
|
node -e '
|
|
const m = require(process.argv[1]);
|
|
process.stdout.write([m.repository, m.run, m.artifact, m.version].join(" ") + "\n");
|
|
' "$MANIFEST"
|
|
)
|
|
|
|
URL="${SABLE_WEBKIT_ARTIFACT_URL:-$REPO/actions/runs/$RUN/artifacts/$ARTIFACT}"
|
|
STAMP="$CACHE/.stamp"
|
|
WANT="$URL $VERSION"
|
|
|
|
if [ -f "$STAMP" ] && [ "$(cat "$STAMP")" = "$WANT" ]; then
|
|
echo "→ WebKit runtime already cached in $CACHE"
|
|
exit 0
|
|
fi
|
|
|
|
WORK="$(mktemp -d)"
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
echo "→ downloading $URL"
|
|
curl -fL --retry 3 --progress-bar -o "$WORK/artifact.zip" "$URL"
|
|
unzip -q -j "$WORK/artifact.zip" -d "$WORK"
|
|
|
|
TARBALL="$(find "$WORK" -maxdepth 1 -name '*-portable-*.tar.zst' -print -quit)"
|
|
[ -n "$TARBALL" ] || {
|
|
echo "❌ no portable runtime tarball in the artifact." >&2
|
|
exit 1
|
|
}
|
|
|
|
rm -rf "$CACHE"
|
|
mkdir -p "$CACHE"
|
|
tar --zstd -xf "$TARBALL" -C "$CACHE"
|
|
|
|
echo "$WANT" > "$STAMP"
|
|
echo "✅ WebKit runtime $VERSION unpacked into $CACHE"
|