diff options
| author | bitflash-maintainer <noreply@bitflash.invalid> | 2026-09-05 22:46:52 +0000 |
|---|---|---|
| committer | bitflash-maintainer <noreply@bitflash.invalid> | 2026-09-05 22:46:52 +0000 |
| commit | ceae3d076b5ad11ee84729ae43f14e9312896646 (patch) | |
| tree | 7e9132aa871fdc01cb95268d2f5ea3bb11853ddf /scripts/package-windows-tor.sh | |
| parent | be63e83d79e7e00e6b8ca889a70e6a19886aa1d8 (diff) | |
| parent | 66e0b9158d050c46b1ff2509faeee3f4573cac1c (diff) | |
Bring main onto the line this project actually ships
main had drifted to a history with no ancestor in common with the tree we
build and deploy. It sat at be63e83 (2026-08-09) with 28 commits; the shipped
line, deploy/soak-2026-08-21, had 383. The two shared nothing -- git
merge-base returns no result at all -- so anyone cloning this repository
landed on a default branch that was neither current nor related to the
running node.
The 28 commits on main were audited before this merge: every one is already
present in the tree by content, including the two that are hardest to see
because they were rewritten afterwards -- the payout reorg-safety work
(PayoutBlockStillOnChain, since evolved to re-check on every retry rather
than once at maturity) and the nostr relay certificate verification
(SSL_set1_host, now with a Windows root-store path). Nothing on main is lost
by this merge.
Recorded as a merge rather than a force-push: main only ever moves forward,
its old history stays reachable as the first parent, and this is revertible.
The tree is taken wholesale from the merged branch, so main's content is now
exactly what was built and tested.
What this brings onto main:
- compactblock: BIP152-style compact block relay ported from upstream 1.2.23,
primitives and unit test only, with the RAND_bytes failure path closed and
the reconstruction allocation bounded.
- upstream/main 17741d9: isolated testnet parameters and genesis, optional
2 MB large pages for RandomX. Mainnet genesis verified byte-identical
through upstream's BuildGenesisBlock() refactor.
- deploy: every image built on bookworm so binaries run on Debian 12, and the
container build now honours the RandomX and libsecp256k1 pins it had been
silently ignoring since before 1.2.15.
Gates at this tree: 15/15 selftests, compactblock's 17 checks, consensus
constants unchanged against e4f898c apart from the pre-existing
MAX_BLOCK_SIZE_GEN, mainnet genesis intact, money-log check ok.
Diffstat (limited to 'scripts/package-windows-tor.sh')
| -rwxr-xr-x | scripts/package-windows-tor.sh | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/scripts/package-windows-tor.sh b/scripts/package-windows-tor.sh new file mode 100755 index 0000000..c8cca3b --- /dev/null +++ b/scripts/package-windows-tor.sh | |||
| @@ -0,0 +1,187 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | set -euo pipefail | ||
| 3 | |||
| 4 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| 5 | VERSION="${VERSION:-$(sed -n 's/^VERSION[[:space:]]*:= *//p' "$ROOT/Makefile" | head -1)}" | ||
| 6 | |||
| 7 | TOR_VERSION="${TOR_VERSION:-15.0.19}" | ||
| 8 | TOR_ARCHIVE_NAME="tor-expert-bundle-windows-x86_64-${TOR_VERSION}.tar.gz" | ||
| 9 | TOR_URL="${TOR_URL:-https://archive.torproject.org/tor-package-archive/torbrowser/${TOR_VERSION}/${TOR_ARCHIVE_NAME}}" | ||
| 10 | TOR_SHA256="${TOR_SHA256:-6AC067402C7B4A3DC37887ED3754B3914B67FDC220C966190683E9CCF91ABF0F}" | ||
| 11 | TOR_ASC_URL="${TOR_ASC_URL:-${TOR_URL}.asc}" | ||
| 12 | TOR_SIGNING_KEY_FINGERPRINT="${TOR_SIGNING_KEY_FINGERPRINT:-EF6E286DDA85EA2A4BA7DE684E2C6E8793298290}" | ||
| 13 | TOR_VERIFY_GPG="${TOR_VERIFY_GPG:-auto}" | ||
| 14 | |||
| 15 | BUNDLE_DIR="${BUNDLE_DIR:-$ROOT/Bitflash-${VERSION}-windows}" | ||
| 16 | OUT_ZIP="${OUT_ZIP:-$ROOT/Bitflash-${VERSION}-windows-with-tor.zip}" | ||
| 17 | CACHE_DIR="${CACHE_DIR:-$ROOT/.cache}" | ||
| 18 | ARCHIVE="${TOR_ARCHIVE:-$CACHE_DIR/$TOR_ARCHIVE_NAME}" | ||
| 19 | ASC_FILE="${TOR_ASC:-$ARCHIVE.asc}" | ||
| 20 | |||
| 21 | usage() { | ||
| 22 | cat <<EOF | ||
| 23 | Usage: scripts/package-windows-tor.sh | ||
| 24 | |||
| 25 | Creates Bitflash-${VERSION}-windows-with-tor.zip from an existing | ||
| 26 | Bitflash-${VERSION}-windows/ release directory. | ||
| 27 | |||
| 28 | Environment overrides: | ||
| 29 | VERSION Bitflash release version, default read from Makefile | ||
| 30 | TOR_VERSION Tor Expert Bundle version, default ${TOR_VERSION} | ||
| 31 | TOR_URL Download URL, default official Tor archive URL | ||
| 32 | TOR_ASC_URL Signature URL, default TOR_URL.asc | ||
| 33 | TOR_SHA256 Expected archive SHA256 | ||
| 34 | TOR_ARCHIVE Use an existing archive instead of downloading | ||
| 35 | TOR_ASC Use an existing detached signature | ||
| 36 | TOR_VERIFY_GPG auto, required, or off; default auto | ||
| 37 | BUNDLE_DIR Existing unpacked Windows release directory | ||
| 38 | OUT_ZIP Output zip path | ||
| 39 | EOF | ||
| 40 | } | ||
| 41 | |||
| 42 | if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then | ||
| 43 | usage | ||
| 44 | exit 0 | ||
| 45 | fi | ||
| 46 | |||
| 47 | need() { | ||
| 48 | command -v "$1" >/dev/null 2>&1 || { | ||
| 49 | echo "missing required command: $1" >&2 | ||
| 50 | exit 1 | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | need sha256sum | ||
| 55 | need tar | ||
| 56 | need zip | ||
| 57 | |||
| 58 | download() { | ||
| 59 | local url="$1" | ||
| 60 | local out="$2" | ||
| 61 | if command -v curl >/dev/null 2>&1; then | ||
| 62 | curl -L --fail --output "$out" "$url" | ||
| 63 | elif command -v wget >/dev/null 2>&1; then | ||
| 64 | wget -O "$out" "$url" | ||
| 65 | else | ||
| 66 | echo "missing required command: curl or wget" >&2 | ||
| 67 | exit 1 | ||
| 68 | fi | ||
| 69 | } | ||
| 70 | |||
| 71 | if [ ! -d "$BUNDLE_DIR" ]; then | ||
| 72 | echo "missing Windows release directory: $BUNDLE_DIR" >&2 | ||
| 73 | echo "run 'make windows' first, or set BUNDLE_DIR" >&2 | ||
| 74 | exit 1 | ||
| 75 | fi | ||
| 76 | if [ ! -f "$BUNDLE_DIR/Bitflash.exe" ]; then | ||
| 77 | echo "missing Bitflash.exe in $BUNDLE_DIR" >&2 | ||
| 78 | exit 1 | ||
| 79 | fi | ||
| 80 | BUNDLE_PARENT="$(cd "$(dirname "$BUNDLE_DIR")" && pwd)" | ||
| 81 | BUNDLE_NAME="$(basename "$BUNDLE_DIR")" | ||
| 82 | OUT_PARENT="$(mkdir -p "$(dirname "$OUT_ZIP")" && cd "$(dirname "$OUT_ZIP")" && pwd)" | ||
| 83 | OUT_NAME="$(basename "$OUT_ZIP")" | ||
| 84 | OUT_ZIP_ABS="$OUT_PARENT/$OUT_NAME" | ||
| 85 | |||
| 86 | mkdir -p "$CACHE_DIR" | ||
| 87 | if [ ! -f "$ARCHIVE" ]; then | ||
| 88 | download "$TOR_URL" "$ARCHIVE" | ||
| 89 | fi | ||
| 90 | |||
| 91 | got="$(sha256sum "$ARCHIVE" | awk '{print tolower($1)}')" | ||
| 92 | want="$(printf '%s' "$TOR_SHA256" | tr 'A-F' 'a-f')" | ||
| 93 | if [ "$got" != "$want" ]; then | ||
| 94 | echo "Tor archive SHA256 mismatch" >&2 | ||
| 95 | echo " expected: $want" >&2 | ||
| 96 | echo " got: $got" >&2 | ||
| 97 | exit 1 | ||
| 98 | fi | ||
| 99 | |||
| 100 | tmp="$(mktemp -d "${TMPDIR:-/tmp}/bitflash-tor-package.XXXXXX")" | ||
| 101 | trap 'rm -rf "$tmp"' EXIT | ||
| 102 | |||
| 103 | case "$TOR_VERIFY_GPG" in | ||
| 104 | auto|required|off) ;; | ||
| 105 | *) echo "TOR_VERIFY_GPG must be auto, required, or off" >&2; exit 2 ;; | ||
| 106 | esac | ||
| 107 | |||
| 108 | if [ "$TOR_VERIFY_GPG" != "off" ]; then | ||
| 109 | if command -v gpg >/dev/null 2>&1; then | ||
| 110 | if [ ! -f "$ASC_FILE" ]; then | ||
| 111 | download "$TOR_ASC_URL" "$ASC_FILE" | ||
| 112 | fi | ||
| 113 | gnupg_home="$tmp/gnupg" | ||
| 114 | mkdir -p "$gnupg_home" | ||
| 115 | chmod 0700 "$gnupg_home" | ||
| 116 | gpg --homedir "$gnupg_home" --batch --auto-key-locate nodefault,wkd,keyserver \ | ||
| 117 | --locate-keys torbrowser@torproject.org >/dev/null 2>&1 || { | ||
| 118 | if [ "$TOR_VERIFY_GPG" = "required" ]; then | ||
| 119 | echo "could not import Tor Browser Developers signing key" >&2 | ||
| 120 | exit 1 | ||
| 121 | fi | ||
| 122 | echo "WARNING: skipped Tor GPG signature verification; signing key import failed" >&2 | ||
| 123 | } | ||
| 124 | if gpg --homedir "$gnupg_home" --batch --with-colons --fingerprint "$TOR_SIGNING_KEY_FINGERPRINT" \ | ||
| 125 | 2>/dev/null | grep -q "^fpr:::::::::${TOR_SIGNING_KEY_FINGERPRINT}:"; then | ||
| 126 | gpg --homedir "$gnupg_home" --batch --verify "$ASC_FILE" "$ARCHIVE" >/dev/null 2>&1 || { | ||
| 127 | echo "Tor archive GPG signature verification failed" >&2 | ||
| 128 | exit 1 | ||
| 129 | } | ||
| 130 | echo "Tor archive GPG signature verified against ${TOR_SIGNING_KEY_FINGERPRINT}" | ||
| 131 | elif [ "$TOR_VERIFY_GPG" = "required" ]; then | ||
| 132 | echo "Tor signing key fingerprint mismatch" >&2 | ||
| 133 | exit 1 | ||
| 134 | else | ||
| 135 | echo "WARNING: skipped Tor GPG signature verification; signing key fingerprint was not available" >&2 | ||
| 136 | fi | ||
| 137 | elif [ "$TOR_VERIFY_GPG" = "required" ]; then | ||
| 138 | echo "missing required command for TOR_VERIFY_GPG=required: gpg" >&2 | ||
| 139 | exit 1 | ||
| 140 | else | ||
| 141 | echo "WARNING: gpg not found; relying on pinned SHA256 only" >&2 | ||
| 142 | fi | ||
| 143 | fi | ||
| 144 | |||
| 145 | mkdir -p "$tmp/extract" | ||
| 146 | tar -xzf "$ARCHIVE" -C "$tmp/extract" | ||
| 147 | |||
| 148 | if [ ! -f "$tmp/extract/tor/tor.exe" ]; then | ||
| 149 | echo "Tor archive did not contain tor/tor.exe" >&2 | ||
| 150 | exit 1 | ||
| 151 | fi | ||
| 152 | |||
| 153 | rm -rf "$BUNDLE_DIR/tor" | ||
| 154 | mkdir -p "$BUNDLE_DIR/tor" | ||
| 155 | cp -R "$tmp/extract/tor/." "$BUNDLE_DIR/tor/" | ||
| 156 | if [ -d "$tmp/extract/docs" ]; then | ||
| 157 | mkdir -p "$BUNDLE_DIR/tor/docs" | ||
| 158 | cp -R "$tmp/extract/docs/." "$BUNDLE_DIR/tor/docs/" | ||
| 159 | fi | ||
| 160 | if [ -d "$tmp/extract/data" ]; then | ||
| 161 | mkdir -p "$BUNDLE_DIR/tor/data-defaults" | ||
| 162 | cp -R "$tmp/extract/data/." "$BUNDLE_DIR/tor/data-defaults/" | ||
| 163 | fi | ||
| 164 | |||
| 165 | cat > "$BUNDLE_DIR/TOR-EXPERT-BUNDLE.txt" <<EOF | ||
| 166 | Bitflash managed Tor bundle | ||
| 167 | |||
| 168 | This Windows package includes the Tor Expert Bundle so -managedtor can start | ||
| 169 | Tor without requiring a separate Tor install. | ||
| 170 | |||
| 171 | Tor Expert Bundle: ${TOR_VERSION} | ||
| 172 | Archive URL: ${TOR_URL} | ||
| 173 | Archive SHA256: ${TOR_SHA256} | ||
| 174 | |||
| 175 | Bitflash uses tor/tor.exe from this package. Runtime state, hidden-service keys, | ||
| 176 | and control authentication cookies are written under the user's Bitflash data | ||
| 177 | directory, not inside this release directory. | ||
| 178 | EOF | ||
| 179 | |||
| 180 | rm -f "$OUT_ZIP_ABS" | ||
| 181 | ( | ||
| 182 | cd "$BUNDLE_PARENT" | ||
| 183 | zip -qr "$OUT_ZIP_ABS" "$BUNDLE_NAME" | ||
| 184 | ) | ||
| 185 | |||
| 186 | echo "Bundled Tor Expert Bundle ${TOR_VERSION}" | ||
| 187 | echo "Built: $OUT_ZIP_ABS" | ||