grabster/scripts/fetch-nzbget.sh
orca b6d53aae6e Bundle NZBGet, add news server settings, fix Linux rendering
- Ship the official static NZBGet 26.3 build (with unrar/7za) as a Tauri
  resource. scripts/fetch-nzbget.sh downloads it, checks its SHA-256 and
  unpacks it; tauri dev/build run it automatically. Binaries are git-ignored.
- src-tauri/src/engine.rs starts NZBGet in server mode on 127.0.0.1 with a
  random port and password (kept in a 0600 nzbget.conf, not argv), locks
  against a second instance, and stops it on exit or if Grabster dies.
- Settings: "Download Engine" chooses built-in vs. your own NZBGet; new
  "News Servers" page adds/edits/tests servers and picks the download folder
  via loadconfig/saveconfig/reload. Mock engine implements the same.
- Set WEBKIT_DISABLE_DMABUF_RENDERER=1 on Linux (WebKitGTK crashed on
  Wayland + NVIDIA with "Error 71 (Protocol error)").
- Drop -webkit-font-smoothing: none (jagged text without Tahoma); point docs
  at ms-core-tahoma-fonts.
- Commit Cargo.lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 09:26:53 -05:00

53 lines
2 KiB
Bash
Executable file

#!/usr/bin/env bash
# Downloads the official static NZBGet Linux build and unpacks the parts Grabster
# bundles into src-tauri/resources/nzbget/. Runs automatically before
# `npm run tauri dev` / `npm run tauri build`; does nothing if already present.
#
# To upgrade NZBGet: change VERSION and SHA256 (from the release's asset digest:
# gh api repos/nzbgetcom/nzbget/releases/latest --jq '.assets[] | select(.name|endswith("bin-linux.run")) | .digest'
set -euo pipefail
VERSION="26.3"
SHA256="6a7f0519cf7deeb59cc1457c87d6efc7f28ef3dd17ed5ddc3be6a698a6093391"
URL="https://github.com/nzbgetcom/nzbget/releases/download/v${VERSION}/nzbget-${VERSION}-bin-linux.run"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
OUT="$ROOT/src-tauri/resources/nzbget"
CACHE="$ROOT/src-tauri/target/nzbget-download"
if [[ "$(cat "$OUT/VERSION" 2>/dev/null)" == "$VERSION" ]]; then
exit 0
fi
case "$(uname -m)" in
x86_64) ARCH=x86_64 ;;
aarch64 | arm64) ARCH=aarch64 ;;
*) echo "fetch-nzbget: unsupported CPU $(uname -m)" >&2; exit 1 ;;
esac
mkdir -p "$CACHE"
RUN="$CACHE/nzbget-${VERSION}-bin-linux.run"
if ! echo "$SHA256 $RUN" | sha256sum -c --status 2>/dev/null; then
echo "fetch-nzbget: downloading NZBGet $VERSION…"
curl -fL --proto '=https' -o "$RUN.part" "$URL"
mv "$RUN.part" "$RUN"
fi
echo "$SHA256 $RUN" | sha256sum -c --quiet
STAGE="$CACHE/unpacked-$ARCH"
rm -rf "$STAGE"
# --unpack skips the installer's setup step and leaves every CPU's binaries, suffixed "-<arch>".
sh "$RUN" --destdir "$STAGE" --unpack --silent >/dev/null
rm -rf "$OUT"
mkdir -p "$OUT/webui"
for bin in nzbget unrar 7za; do
cp "$STAGE/$bin-$ARCH" "$OUT/$bin"
done
cp "$STAGE"/{cacert.pem,COPYING,license-unrar.txt,license-7zip.txt} "$OUT/"
# NZBGet needs the config template (option descriptions/defaults); the rest of the web UI isn't shipped.
cp "$STAGE/webui/nzbget.conf.template" "$OUT/webui/"
chmod 755 "$OUT"/{nzbget,unrar,7za}
echo "$VERSION" > "$OUT/VERSION"
rm -rf "$STAGE"
echo "fetch-nzbget: NZBGet $VERSION ($ARCH) ready in src-tauri/resources/nzbget"