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 'scripts/installers/windows.ps1.in')
| -rw-r--r-- | scripts/installers/windows.ps1.in | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/scripts/installers/windows.ps1.in b/scripts/installers/windows.ps1.in deleted file mode 100644 index 4b8e61d..0000000 --- a/scripts/installers/windows.ps1.in +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | # Zagan-Bet desktop installer for Windows. | ||
| 2 | # | ||
| 3 | # Verifies the app against its published SHA-256, installs it for the current | ||
| 4 | # user and adds a Start-menu shortcut. Put the downloaded app next to this | ||
| 5 | # script, or run the script on its own and it will fetch the matching binary. | ||
| 6 | # | ||
| 7 | # Run it with: | ||
| 8 | # powershell -ExecutionPolicy Bypass -File .\zagan-bet-gui-*-install.ps1 | ||
| 9 | # Add -NoPause to run it unattended. | ||
| 10 | param([switch]$NoPause) | ||
| 11 | |||
| 12 | $ErrorActionPreference = "Stop" | ||
| 13 | |||
| 14 | $Version = "__VERSION__" | ||
| 15 | $Binary = "__BINARY__" | ||
| 16 | $Sha256 = "__SHA256__" | ||
| 17 | $Url = "__URL__" | ||
| 18 | |||
| 19 | function Finish([int]$Code) { | ||
| 20 | if (-not $NoPause) { | ||
| 21 | Read-Host "Press Enter to close" | Out-Null | ||
| 22 | } | ||
| 23 | exit $Code | ||
| 24 | } | ||
| 25 | |||
| 26 | function Stop-Install([string]$Message) { | ||
| 27 | Write-Host "install: $Message" -ForegroundColor Red | ||
| 28 | Finish 1 | ||
| 29 | } | ||
| 30 | |||
| 31 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
| 32 | $candidates = @( | ||
| 33 | (Join-Path $here $Binary), | ||
| 34 | (Join-Path (Get-Location) $Binary), | ||
| 35 | (Join-Path $env:USERPROFILE "Downloads\$Binary") | ||
| 36 | ) | ||
| 37 | $sourceFile = $null | ||
| 38 | foreach ($candidate in $candidates) { | ||
| 39 | if (Test-Path -LiteralPath $candidate) { | ||
| 40 | $sourceFile = $candidate | ||
| 41 | break | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | $temporary = $null | ||
| 46 | if (-not $sourceFile) { | ||
| 47 | $temporary = Join-Path ([System.IO.Path]::GetTempPath()) $Binary | ||
| 48 | Write-Host "Downloading $Binary..." | ||
| 49 | try { | ||
| 50 | Invoke-WebRequest -Uri $Url -OutFile $temporary -UseBasicParsing | ||
| 51 | } catch { | ||
| 52 | Stop-Install "download failed: $_" | ||
| 53 | } | ||
| 54 | $sourceFile = $temporary | ||
| 55 | } | ||
| 56 | |||
| 57 | try { | ||
| 58 | $actual = (Get-FileHash -LiteralPath $sourceFile -Algorithm SHA256).Hash.ToLowerInvariant() | ||
| 59 | if ($actual -ne $Sha256.ToLowerInvariant()) { | ||
| 60 | Stop-Install "checksum mismatch: expected $Sha256, got $actual" | ||
| 61 | } | ||
| 62 | |||
| 63 | $installDir = Join-Path $env:LOCALAPPDATA "Programs\Zagan-Bet" | ||
| 64 | New-Item -ItemType Directory -Force -Path $installDir | Out-Null | ||
| 65 | $target = Join-Path $installDir "zagan-bet-gui.exe" | ||
| 66 | Copy-Item -LiteralPath $sourceFile -Destination $target -Force | ||
| 67 | |||
| 68 | $startMenu = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs" | ||
| 69 | New-Item -ItemType Directory -Force -Path $startMenu | Out-Null | ||
| 70 | $shortcutPath = Join-Path $startMenu "Zagan-Bet.lnk" | ||
| 71 | $shell = New-Object -ComObject WScript.Shell | ||
| 72 | $shortcut = $shell.CreateShortcut($shortcutPath) | ||
| 73 | $shortcut.TargetPath = $target | ||
| 74 | $shortcut.WorkingDirectory = $installDir | ||
| 75 | $shortcut.IconLocation = "$target,0" | ||
| 76 | $shortcut.Description = "Slots, roulette, blackjack and crash" | ||
| 77 | $shortcut.Save() | ||
| 78 | |||
| 79 | Write-Host "Installed Zagan-Bet $Version to $target" | ||
| 80 | Write-Host "A Start-menu shortcut was created." | ||
| 81 | } finally { | ||
| 82 | if ($temporary -and (Test-Path -LiteralPath $temporary)) { | ||
| 83 | Remove-Item -LiteralPath $temporary -Force | ||
| 84 | } | ||
| 85 | } | ||
| 86 | |||
| 87 | Finish 0 | ||
