v0.1.1: external modules, publish YAML, proxy reset, binary-first README
- Host discovers/builds modules under modules/ (bbc, rte, tg4) - module-publish.yaml tracked; local module.yaml gitignored - drm --modules-dir / DRM_MODULES_DIR - drm proxy reset; Magisk reinject reliability - modules-v* Forgejo release workflow + build scripts - BBC full Explore channel map including S4C - README quickstart based on release binaries
This commit is contained in:
parent
1d36961a7c
commit
f9c28be3f1
52 changed files with 2915 additions and 636 deletions
116
scripts/build-modules-release.ps1
Normal file
116
scripts/build-modules-release.ps1
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
# Build per-module release zips for tag modules-vX.Y.Z
|
||||
# Usage:
|
||||
# .\scripts\build-modules-release.ps1
|
||||
# .\scripts\build-modules-release.ps1 -Version modules-v1.0.0
|
||||
param(
|
||||
[string]$Version = "",
|
||||
[string]$Out = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
if (-not $Out) { $Out = Join-Path $Root "dist\release" }
|
||||
if (-not $Version) {
|
||||
try { $Version = (git -C $Root describe --tags --always --dirty 2>$null) } catch { $Version = "modules-dev" }
|
||||
if (-not $Version) { $Version = "modules-dev" }
|
||||
}
|
||||
|
||||
function Resolve-Go {
|
||||
$cmd = Get-Command go -ErrorAction SilentlyContinue
|
||||
if ($cmd) { return $cmd.Source }
|
||||
$candidates = @(
|
||||
"$env:USERPROFILE\go-sdk\go\bin\go.exe",
|
||||
"C:\Program Files\Go\bin\go.exe"
|
||||
)
|
||||
foreach ($c in $candidates) {
|
||||
if ($c -and (Test-Path $c)) { return $c }
|
||||
}
|
||||
throw "go not found"
|
||||
}
|
||||
|
||||
$GoExe = Resolve-Go
|
||||
New-Item -ItemType Directory -Force -Path $Out | Out-Null
|
||||
|
||||
$Modules = @("bbc", "rte", "tg4")
|
||||
$Targets = @(
|
||||
@{ GOOS = "windows"; GOARCH = "amd64"; Ext = ".exe" },
|
||||
@{ GOOS = "windows"; GOARCH = "arm64"; Ext = ".exe" },
|
||||
@{ GOOS = "linux"; GOARCH = "amd64"; Ext = "" },
|
||||
@{ GOOS = "linux"; GOARCH = "arm64"; Ext = "" },
|
||||
@{ GOOS = "darwin"; GOARCH = "amd64"; Ext = "" },
|
||||
@{ GOOS = "darwin"; GOARCH = "arm64"; Ext = "" }
|
||||
)
|
||||
|
||||
$builtZips = @()
|
||||
foreach ($name in $Modules) {
|
||||
$src = Join-Path $Root "modules\$name"
|
||||
if (-not (Test-Path (Join-Path $src "go.mod"))) {
|
||||
Write-Host "SKIP $name (no go.mod)"
|
||||
continue
|
||||
}
|
||||
$publish = Join-Path $src "module-publish.yaml"
|
||||
if (-not (Test-Path $publish)) {
|
||||
throw "missing $publish"
|
||||
}
|
||||
|
||||
$stage = Join-Path $Root "dist\modules\$name"
|
||||
if (Test-Path $stage) { Remove-Item -Recurse -Force $stage }
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $stage ".bin") | Out-Null
|
||||
|
||||
Write-Host "==> module $name"
|
||||
foreach ($t in $Targets) {
|
||||
$binName = $name
|
||||
if ($t.Ext) { $binName = "$name$($t.Ext)" }
|
||||
# Ship one binary per OS/ARCH under .bin/<goos>-<goarch>/
|
||||
$sub = Join-Path $stage ".bin\$($t.GOOS)-$($t.GOARCH)"
|
||||
New-Item -ItemType Directory -Force -Path $sub | Out-Null
|
||||
$outBin = Join-Path $sub $binName
|
||||
Write-Host " - $($t.GOOS)/$($t.GOARCH) → $outBin"
|
||||
$env:GOOS = $t.GOOS
|
||||
$env:GOARCH = $t.GOARCH
|
||||
$env:CGO_ENABLED = "0"
|
||||
& $GoExe -C $src build -trimpath -ldflags="-s -w" -o $outBin .
|
||||
if ($LASTEXITCODE -ne 0) { throw "build failed for $name $($t.GOOS)/$($t.GOARCH)" }
|
||||
Remove-Item Env:GOOS, Env:GOARCH, Env:CGO_ENABLED -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Release zip gets module.yaml (= publish template, secrets empty/placeholders).
|
||||
Copy-Item $publish (Join-Path $stage "module.yaml") -Force
|
||||
# Also keep the publish name for clarity.
|
||||
Copy-Item $publish (Join-Path $stage "module-publish.yaml") -Force
|
||||
|
||||
$readme = @"
|
||||
# module-$name ($Version)
|
||||
|
||||
Drop this folder into your Null DRM ``modules/$name/`` directory (or point
|
||||
``drm --modules-dir`` at a folder that contains ``$name/``).
|
||||
|
||||
1. Edit ``module.yaml`` — fill in any sensitive fields marked in comments.
|
||||
2. Copy the matching ``.bin/<goos>-<goarch>/$name[.exe]`` up to ``.bin/$name[.exe]``
|
||||
for your OS, or leave the multi-arch tree and let the host rebuild from source
|
||||
if Go is installed.
|
||||
3. Run: ``drm modules`` then ``drm capture --app $name --channel …``
|
||||
|
||||
Local ``module.yaml`` with secrets must never be committed. This zip's
|
||||
``module.yaml`` is a rename of ``module-publish.yaml`` (universal values only).
|
||||
"@
|
||||
Set-Content -Path (Join-Path $stage "README.md") -Value $readme -Encoding utf8
|
||||
|
||||
$zipName = "module-$name-$Version.zip"
|
||||
$zipPath = Join-Path $Out $zipName
|
||||
if (Test-Path $zipPath) { Remove-Item -Force $zipPath }
|
||||
Compress-Archive -Path (Join-Path $stage "*") -DestinationPath $zipPath -Force
|
||||
$builtZips += $zipPath
|
||||
Write-Host " zip $zipPath"
|
||||
}
|
||||
|
||||
Write-Host "==> checksums"
|
||||
$sumsPath = Join-Path $Out "SHA256SUMS-modules.txt"
|
||||
$lines = @()
|
||||
foreach ($z in $builtZips) {
|
||||
$h = Get-FileHash $z -Algorithm SHA256
|
||||
$lines += ("{0} {1}" -f $h.Hash.ToLower(), (Split-Path $z -Leaf))
|
||||
}
|
||||
[System.IO.File]::WriteAllLines($sumsPath, $lines)
|
||||
Write-Host "DONE modules release $Version → $Out"
|
||||
Get-ChildItem $Out -Filter "module-*" | Format-Table Name, Length
|
||||
68
scripts/build-modules-release.sh
Normal file
68
scripts/build-modules-release.sh
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env bash
|
||||
# Build per-module release zips for tag modules-vX.Y.Z
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
VERSION="${1:-}"
|
||||
OUT="${2:-$ROOT/dist/release}"
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
VERSION="$(git -C "$ROOT" describe --tags --always --dirty 2>/dev/null || echo modules-dev)"
|
||||
fi
|
||||
mkdir -p "$OUT"
|
||||
|
||||
MODULES=(bbc rte tg4)
|
||||
TARGETS=(
|
||||
"windows amd64 .exe"
|
||||
"windows arm64 .exe"
|
||||
"linux amd64 "
|
||||
"linux arm64 "
|
||||
"darwin amd64 "
|
||||
"darwin arm64 "
|
||||
)
|
||||
|
||||
built=()
|
||||
for name in "${MODULES[@]}"; do
|
||||
src="$ROOT/modules/$name"
|
||||
[[ -f "$src/go.mod" ]] || { echo "SKIP $name"; continue; }
|
||||
publish="$src/module-publish.yaml"
|
||||
[[ -f "$publish" ]] || { echo "missing $publish"; exit 1; }
|
||||
|
||||
stage="$ROOT/dist/modules/$name"
|
||||
rm -rf "$stage"
|
||||
mkdir -p "$stage/.bin"
|
||||
|
||||
echo "==> module $name"
|
||||
while read -r goos goarch ext; do
|
||||
[[ -z "$goos" ]] && continue
|
||||
sub="$stage/.bin/${goos}-${goarch}"
|
||||
mkdir -p "$sub"
|
||||
bin="$sub/${name}${ext}"
|
||||
echo " - ${goos}/${goarch} → $bin"
|
||||
( cd "$src" && CGO_ENABLED=0 GOOS="$goos" GOARCH="$goarch" \
|
||||
go build -trimpath -ldflags='-s -w' -o "$bin" . )
|
||||
done <<< "$(printf '%s\n' "${TARGETS[@]}")"
|
||||
|
||||
cp "$publish" "$stage/module.yaml"
|
||||
cp "$publish" "$stage/module-publish.yaml"
|
||||
cat > "$stage/README.md" <<EOF
|
||||
# module-$name ($VERSION)
|
||||
|
||||
Drop into \`modules/$name/\`. Edit \`module.yaml\` for secrets. Copy
|
||||
\`.bin/<goos>-<goarch>/$name\` to \`.bin/$name\` for your OS, or rebuild with Go.
|
||||
|
||||
\`module.yaml\` in this zip is \`module-publish.yaml\` renamed (universal values).
|
||||
EOF
|
||||
|
||||
zip_path="$OUT/module-${name}-${VERSION}.zip"
|
||||
rm -f "$zip_path"
|
||||
( cd "$stage" && zip -qr "$zip_path" . )
|
||||
built+=("$zip_path")
|
||||
echo " zip $zip_path"
|
||||
done
|
||||
|
||||
sums="$OUT/SHA256SUMS-modules.txt"
|
||||
: > "$sums"
|
||||
for z in "${built[@]}"; do
|
||||
( cd "$(dirname "$z")" && sha256sum "$(basename "$z")" ) >> "$sums"
|
||||
done
|
||||
echo "DONE modules release $VERSION → $OUT"
|
||||
ls -la "$OUT"/module-* 2>/dev/null || true
|
||||
Loading…
Add table
Add a link
Reference in a new issue