Files
navi/scripts/build-macos-arm64.sh
T
M4andCursor 041cbb1250 Release 2.7.3.1: harden proxy recovery, updates and local API.
Restore orphaned system proxy after crash, require update SHA-256, add macOS /api auth token, fix UDP ping false positives, HTTPS-only subscriptions, and keep the UI responsive during connect.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 18:48:54 +03:00

79 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# Build Navis GUI for Apple Silicon (arm64).
set -euo pipefail
cd "$(dirname "$0")/.."
VERSION="$(python3 - <<'PY'
import re
from pathlib import Path
t = Path('internal/update/update.go').read_text()
m = re.search(r'CurrentVersion\s*=\s*"([^"]+)"', t)
print(m.group(1) if m else '0.0.0')
PY
)"
BUILD="$(python3 - <<'PY'
import re
from pathlib import Path
t = Path('internal/update/update.go').read_text()
m = re.search(r'const BuildNumber\s*=\s*(\d+)', t)
print(m.group(1) if m else '0')
PY
)"
FULL="${VERSION}.${BUILD}"
echo "Building Navis ${VERSION}+${BUILD} (arm64)..."
OUT="dist/navis-release/darwin-arm64"
mkdir -p "$OUT"
LDFLAGS="-s -w"
export PATH="/tmp/go-sdk/go/bin:/usr/local/go/bin:$PATH"
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
go build -ldflags="$LDFLAGS" -trimpath -o "$OUT/Navis" ./cmd/vpnapp
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
go build -ldflags="$LDFLAGS" -trimpath -o "$OUT/Navis-cli" ./cmd/vpnclient
printf '%s\n' "$FULL" > "$OUT/VERSION"
printf '%s\n' "${VERSION}+${BUILD}" > "$OUT/Navis.version"
if command -v codesign >/dev/null 2>&1; then
codesign -s - --force "$OUT/Navis"
codesign -s - --force "$OUT/Navis-cli"
fi
go build -o tools/packmac/packmac ./tools/packmac
tools/packmac/packmac \
-bin "$OUT/Navis" \
-out "$OUT" \
-version "$VERSION" \
-build "$FULL" \
-arch arm64
cp -f "$OUT/Navis.dmg" "$OUT/Navis-${FULL}-arm64.dmg"
cp -f "$OUT/Navis.app.zip" "$OUT/Navis-${FULL}-arm64.app.zip"
python3 - <<PY
import hashlib, json
from pathlib import Path
ver = "${VERSION}"
build = "${BUILD}"
full = "${FULL}"
binp = Path('dist/navis-release/darwin-arm64/Navis')
h = hashlib.sha256(binp.read_bytes()).hexdigest()
notes = f"Navis {ver}+{build}: восстановление system proxy после crash; auth macOS /api; обязательный SHA обновлений; fix UDP ping; HTTPS-only подписки; UI без зависания на connect."
for p in [Path('dist/update.json'), Path('dist/navis-release/update.json')]:
if not p.exists():
continue
d = json.loads(p.read_text())
d['version'] = ver
d['notes'] = notes
plats = d.setdefault('platforms', {})
if 'darwin-arm64' in plats:
plats['darwin-arm64']['sha256'] = h
p.write_text(json.dumps(d, ensure_ascii=False, indent=2) + '\n')
print('updated', p, '->', ver, 'sha', h[:12])
PY
echo ""
echo "Done: Navis ${VERSION}+${BUILD}"
ls -lh "$OUT"