Vestibule/packaging/build-installer.ps1

64 lines
2.6 KiB
PowerShell

# build-installer.ps1 — one-shot Windows packaging: build usher, then
# compile the Inno Setup installer.
#
# Output: packaging\Output\Vestibule-Setup-<version>.exe
#
# Prerequisites:
# - Rust (rustup) for usher
# - Inno Setup 6 https://jrsoftware.org/isinfo.php
# (or: choco install innosetup -y)
#
# Usage:
# powershell -ExecutionPolicy Bypass -File packaging\build-installer.ps1
$ErrorActionPreference = "Stop"
$packagingDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$repoRoot = Split-Path -Parent $packagingDir
# ─── 1. Build usher ───────────────────────────────────────────────────
Write-Host "==> cargo build --release (usher)" -ForegroundColor Cyan
& cargo build --release --manifest-path (Join-Path $repoRoot "helper\Cargo.toml")
if ($LASTEXITCODE -ne 0) {
Write-Error "cargo build failed"
exit 1
}
$usher = Join-Path $repoRoot "helper\target\release\usher.exe"
Write-Host " [ok] $usher"
# ─── 2. Locate ISCC.exe ───────────────────────────────────────────────
$iscc = Get-Command "ISCC.exe" -ErrorAction SilentlyContinue
if (-not $iscc) {
foreach ($candidate in @(
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
"${env:ProgramFiles}\Inno Setup 6\ISCC.exe")) {
if (Test-Path $candidate) { $iscc = $candidate; break }
}
} else {
$iscc = $iscc.Source
}
if (-not $iscc) {
Write-Error "ISCC.exe (Inno Setup 6) not found. Install from https://jrsoftware.org/isinfo.php or: choco install innosetup -y"
exit 1
}
# ─── 3. Compile installer ─────────────────────────────────────────────
Write-Host "==> ISCC vestibule.iss" -ForegroundColor Cyan
& $iscc (Join-Path $packagingDir "vestibule.iss")
if ($LASTEXITCODE -ne 0) {
Write-Error "Inno Setup compile failed"
exit 1
}
$out = Join-Path $packagingDir "Output\Vestibule-Setup-1.2.2.exe"
Write-Host ""
Write-Host " [ok] $out ($([math]::Round((Get-Item $out).Length / 1MB, 2)) MB)" -ForegroundColor Green
Write-Host ""
Write-Host "Next: run it on the kiosk machine and tick 'Run the kiosk"
Write-Host "provisioning wizard', or deploy unattended:"
Write-Host " Vestibule-Setup-1.2.2.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART"
Write-Host " powershell -ExecutionPolicy Bypass -File ``"C:\Program Files\Vestibule\scripts\provision-kiosk.ps1``" -KioskUser Kiosk -HomeUrl https://example.org -Quiet -Restart"