diff --git a/scripts/package-release.ps1 b/scripts/package-release.ps1 index b73bdcc..0059b36 100644 --- a/scripts/package-release.ps1 +++ b/scripts/package-release.ps1 @@ -55,8 +55,11 @@ $PackageName = "sanctum-v$Version-windows-x86_64" $StagingDir = Join-Path $DistDir $PackageName $ZipFile = Join-Path $DistDir "$PackageName.zip" -if (Test-Path $DistDir) { - Remove-Item $DistDir -Recurse -Force +if (-not (Test-Path $DistDir)) { + New-Item -ItemType Directory -Path $DistDir -Force | Out-Null +} +if (Test-Path $StagingDir) { + Remove-Item $StagingDir -Recurse -Force } New-Item -ItemType Directory -Path $StagingDir -Force | Out-Null @@ -84,7 +87,17 @@ $ZipHash = (Get-FileHash -Path $ZipFile -Algorithm SHA256).Hash.ToLower() $ExeHash = (Get-FileHash -Path $ExeSource -Algorithm SHA256).Hash.ToLower() $ChecksumFile = Join-Path $DistDir "SHA256SUMS.txt" -@("$ZipHash $PackageName.zip", "$ExeHash sanctum.exe") | Set-Content -Path $ChecksumFile -Encoding utf8 +$ExistingLines = if (Test-Path $ChecksumFile) { + Get-Content $ChecksumFile | Where-Object { $_ -notmatch "$PackageName\.zip" -and $_ -notmatch "\s+sanctum\.exe$" } +} else { + @() +} + +$AllLines = @() +$AllLines += "$ZipHash $PackageName.zip" +$AllLines += "$ExeHash sanctum.exe" +$AllLines += $ExistingLines +$AllLines | Set-Content -Path $ChecksumFile -Encoding utf8 Write-Host "[OK] Pruefsummen in SHA256SUMS.txt gespeichert." -ForegroundColor Green