#!/usr/bin/env bash # Fetch busybox-w32 into third_party/busybox/busybox.exe (Linux/CI host). set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" DEST="$ROOT/third_party/busybox" mkdir -p "$DEST" OUT="$DEST/busybox.exe" # Override with BUSYBOX_W32_URL if the default 404s / TLS fails. URLS=( "${BUSYBOX_W32_URL:-}" "https://frippery.org/files/busybox/busybox-w64-FRP-5007-g82accfc19.exe" "https://frippery.org/files/busybox/busybox.exe" ) ok=0 for URL in "${URLS[@]}"; do [[ -z "$URL" ]] && continue echo "Downloading $URL -> $OUT" if curl -fsSL -L --connect-timeout 20 -o "$OUT" "$URL"; then ok=1 break fi echo "failed: $URL" >&2 done cat > "$DEST/LICENSE.busybox" << 'EOF' BusyBox is licensed under GPLv2. Obtain the corresponding source from the upstream busybox-w32 / BusyBox project when redistributing the binary. See: https://www.busybox.net/ https://frippery.org/busybox/ EOF if [[ "$ok" -ne 1 ]]; then cat >&2 <<'EOF' Could not download busybox-w32 automatically. Manual steps: 1. Visit https://frippery.org/busybox/ or busybox-w32 releases 2. Save the 64-bit binary as agent/third_party/busybox/busybox.exe 3. Copy it next to cst-agent.exe on Windows releases EOF exit 1 fi chmod +x "$OUT" || true file "$OUT" || true ls -la "$OUT" echo "OK: place this next to cst-agent.exe on Windows releases."