$ErrorActionPreference = "Stop" $root = $PSScriptRoot $ver = ([xml](Get-Content (Join-Path $root "app\UltraParadise.Linux.csproj"))).Project.PropertyGroup[0].Version $env:DOTNET_CLI_TELEMETRY_OPTOUT = "1"; $env:DOTNET_NOLOGO = "1" Push-Location (Join-Path $root "app") try { & dotnet publish -c Release -r linux-x64 -o (Join-Path $root "out\linux-x64") | Out-Null if ($LASTEXITCODE -ne 0) { throw "app build failed" } } finally { Pop-Location } $stage = Join-Path $root "out\pkg\UltraParadise-CU-Trainer" Remove-Item (Join-Path $root "out\pkg") -Recurse -Force -ErrorAction SilentlyContinue New-Item -ItemType Directory $stage | Out-Null Copy-Item (Join-Path $root "out\linux-x64\UltraParadiseCUTrainer") $stage Copy-Item (Join-Path $root "art\icon.png") $stage $readme = [IO.File]::ReadAllText((Join-Path $root "README.txt")).Replace("@@VER@@", $ver).Replace("`r`n", "`n") [IO.File]::WriteAllText((Join-Path $stage "README.txt"), $readme, (New-Object Text.UTF8Encoding($false))) Get-ChildItem $root -Filter "UltraParadise-Linux-*" | Remove-Item -Force $tgz = Join-Path $root "UltraParadise-Linux-$ver.tar.gz" $b = ($root -replace '\\', '/') -replace '^([A-Za-z]):', '/$1' & "C:\Program Files\Git\bin\bash.exe" -lc "cd '$b/out/pkg' && tar --owner=0 --group=0 --numeric-owner --mode=755 -czf '$b/UltraParadise-Linux-$ver.tar.gz' UltraParadise-CU-Trainer" $zip = Join-Path $root "UltraParadise-Linux-$ver.zip" & powershell -ExecutionPolicy Bypass -File (Join-Path $root "zipunix.ps1") -Src $stage -Out $zip -Exec UltraParadiseCUTrainer Write-Host "" Write-Host "Linux v$ver" Write-Host (" {0} {1:N1} MB {2}" -f (Split-Path $tgz -Leaf), ((Get-Item $tgz).Length / 1MB), (Get-FileHash $tgz).Hash.ToLower()) Write-Host (" {0} {1:N1} MB {2}" -f (Split-Path $zip -Leaf), ((Get-Item $zip).Length / 1MB), (Get-FileHash $zip).Hash.ToLower())