# Zu Online installer. Run from PowerShell: irm https://zu-online.online/install.ps1 | iex # Downloads the Zu Online launcher into the current folder and starts it; the launcher asks where to install the # game and downloads it. Nothing here needs administrator rights. Source: this file, as served by the site. & { $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' # Invoke-WebRequest is many times slower with the progress bar [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 $base = 'https://zu-online.online/' # Public half of the key that signs launcher/manifest.txt (the launcher checks the same signature). $pub = 'lWLZMYUXeTTtcF1KRjHkhgcLWTWbdiyD+m+RnmEOqMLhwgrWN6qrYuO+StXncoZUM72nKGjtEj1Eft7qUijRgjTU9Z1fZ+6OHfH8gpBcoziUF3qMIyaeo7rkGCHIwOAKAcwxlmfRsVIE6DplQb0a9l/jsFHPbIIkPaJEP8OV2elqk5OE3hmHnTKv7O8OiVDQEEp/RfJRrA024xobE0MqREccwJmSY8xBbSmCALaMpdWC/xHVw9dPz9+W1mopSgpIxvmu0NeLKqHLAHUI4OlxkG+Jdw+o0xZsjHuq/r5ETWe2crrnrnugYOXmXp6YWIuBdgU0Nk+lc5IIJvvYJuXqAQ==AQAB' Write-Host '' Write-Host ' Zu Online installer' -ForegroundColor Yellow try { # The launcher goes into the current folder; where that is not writable (C:\, System32 ...) into Downloads, # else %TEMP%. The game folder is chosen in the launcher, which copies itself there. function Writable($d) { try { $p = Join-Path $d '.zu_write_test'; [IO.File]::WriteAllText($p, ''); Remove-Item $p; $true } catch { $false } } $loc = Get-Location $downloads = try { (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path } catch { Join-Path $HOME 'Downloads' } $dir = @($(if ($loc.Provider.Name -eq 'FileSystem') { $loc.ProviderPath }), $downloads, $env:TEMP) | Where-Object { $_ -and (Test-Path -LiteralPath $_ -PathType Container) -and (Writable $_) } | Select-Object -First 1 if (-not $dir) { throw 'No folder to save the launcher in. Run the command from a folder you can write to.' } Write-Host ' Checking the launcher...' $man = (Invoke-WebRequest "${base}launcher/manifest.txt?t=$([DateTime]::UtcNow.Ticks)" -UseBasicParsing).RawContentStream.ToArray() $sig = (Invoke-WebRequest "${base}launcher/manifest.txt.sig?t=$([DateTime]::UtcNow.Ticks)" -UseBasicParsing).Content if ($sig -is [byte[]]) { $sig = [Text.Encoding]::ASCII.GetString($sig) } $rsa = New-Object Security.Cryptography.RSACryptoServiceProvider (New-Object Security.Cryptography.CspParameters 24) $rsa.FromXmlString($pub) if (-not $rsa.VerifyData($man, 'SHA256', [Convert]::FromBase64String($sig.Trim()))) { throw 'The launcher list has a bad signature. Nothing was installed.' } $line = ([Text.Encoding]::UTF8.GetString($man) -split "`r?`n") | Where-Object { ($_ -split "`t")[2] -eq 'ZuLauncher.exe' } | Select-Object -First 1 if (-not $line) { throw 'The launcher is missing from the server list.' } $sha = ($line -split "`t")[0] Write-Host " Downloading the launcher into $dir ..." $exe = Join-Path $dir 'ZuLauncher.exe'; $tmp = "$exe.download" Invoke-WebRequest "${base}launcher/files/ZuLauncher.exe?v=$sha" -UseBasicParsing -OutFile $tmp if ((Get-FileHash $tmp -Algorithm SHA1).Hash -ne $sha) { Remove-Item $tmp; throw 'The launcher download is damaged. Please run the command again.' } Move-Item $tmp $exe -Force Write-Host ' Starting the launcher: choose the game folder. The launcher shows download size and progress.' -ForegroundColor Green Start-Process -FilePath $exe -ArgumentList '--install' -WorkingDirectory $dir } catch { Write-Host " $($_.Exception.Message)" -ForegroundColor Red Write-Host ' Nothing was installed. If this keeps happening, tell us on the website.' } }