diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-01 22:23:00 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-01 22:23:00 +0100 |
| commit | 4887abc5773b33ab1e213ed5f528dfebd242e2cd (patch) | |
| tree | 8eb2316783a21817cce422c3fb58ec953206dd9a /scripts/installers/windows.ps1.in | |
| parent | v4.3.1: render Windows through wgpu and keep the installer window open (diff) | |
| download | zagan-bet-4887abc5773b33ab1e213ed5f528dfebd242e2cd.tar.gz zagan-bet-4887abc5773b33ab1e213ed5f528dfebd242e2cd.zip | |
Adds web/latest.php: a plain-text feed of the newest version with each artifact's filename and SHA-256. The per-release generated installers are replaced by stable web/install.sh and web/install.ps1; both read the feed, pick the newest build, verify it, install per-user and add a launcher. Publishing a new app version no longer regenerates or versions the installers.
publish.sh drops the installer renderer and Python dependency. deploy.sh now also verifies latest.php against the local artifacts and that the served installer scripts match the repository.
Diffstat (limited to '')
| -rw-r--r-- | web/install.ps1 (renamed from scripts/installers/windows.ps1.in) | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/scripts/installers/windows.ps1.in b/web/install.ps1 index 4b8e61d..92eef83 100644 --- a/scripts/installers/windows.ps1.in +++ b/web/install.ps1 | |||
| @@ -1,21 +1,18 @@ | |||
| 1 | # Zagan-Bet desktop installer for Windows. | 1 | # Zagan-Bet installer for Windows. |
| 2 | # | 2 | # |
| 3 | # Verifies the app against its published SHA-256, installs it for the current | 3 | # Asks the site which build is newest, verifies its SHA-256, installs it for |
| 4 | # user and adds a Start-menu shortcut. Put the downloaded app next to this | 4 | # the current user and adds a Start-menu shortcut. Point it at a staging site |
| 5 | # script, or run the script on its own and it will fetch the matching binary. | 5 | # with -Site http://127.0.0.1:8899; add -NoPause for automation. |
| 6 | # | 6 | # |
| 7 | # Run it with: | 7 | # Run it with: |
| 8 | # powershell -ExecutionPolicy Bypass -File .\zagan-bet-gui-*-install.ps1 | 8 | # powershell -ExecutionPolicy Bypass -File .\install.ps1 |
| 9 | # Add -NoPause to run it unattended. | 9 | param( |
| 10 | param([switch]$NoPause) | 10 | [string]$Site = "https://zagan.2137697.xyz", |
| 11 | [switch]$NoPause | ||
| 12 | ) | ||
| 11 | 13 | ||
| 12 | $ErrorActionPreference = "Stop" | 14 | $ErrorActionPreference = "Stop" |
| 13 | 15 | ||
| 14 | $Version = "__VERSION__" | ||
| 15 | $Binary = "__BINARY__" | ||
| 16 | $Sha256 = "__SHA256__" | ||
| 17 | $Url = "__URL__" | ||
| 18 | |||
| 19 | function Finish([int]$Code) { | 16 | function Finish([int]$Code) { |
| 20 | if (-not $NoPause) { | 17 | if (-not $NoPause) { |
| 21 | Read-Host "Press Enter to close" | Out-Null | 18 | Read-Host "Press Enter to close" | Out-Null |
| @@ -28,6 +25,30 @@ function Stop-Install([string]$Message) { | |||
| 28 | Finish 1 | 25 | Finish 1 |
| 29 | } | 26 | } |
| 30 | 27 | ||
| 28 | try { | ||
| 29 | $latest = (Invoke-WebRequest -Uri "$Site/latest.php" -UseBasicParsing).Content | ||
| 30 | } catch { | ||
| 31 | Stop-Install "could not read $Site/latest.php: $_" | ||
| 32 | } | ||
| 33 | |||
| 34 | $line = ($latest -split "`r?`n") | | ||
| 35 | Where-Object { $_ -match '^gui windows x86_64 ' } | | ||
| 36 | Select-Object -First 1 | ||
| 37 | if (-not $line) { | ||
| 38 | Stop-Install "no Windows build is published yet" | ||
| 39 | } | ||
| 40 | |||
| 41 | $parts = $line.Trim() -split '\s+' | ||
| 42 | if ($parts.Count -lt 6) { | ||
| 43 | Stop-Install "the latest-build file is malformed" | ||
| 44 | } | ||
| 45 | $Version = $parts[3] | ||
| 46 | $Binary = $parts[4] | ||
| 47 | $Sha256 = $parts[5] | ||
| 48 | $Url = "$Site/bin/gui/$Binary" | ||
| 49 | |||
| 50 | Write-Host "Newest Zagan-Bet is $Version." | ||
| 51 | |||
| 31 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path | 52 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path |
| 32 | $candidates = @( | 53 | $candidates = @( |
| 33 | (Join-Path $here $Binary), | 54 | (Join-Path $here $Binary), |
