Files
CM95/tools/update_manifest_sha256.ps1

32 lines
806 B
PowerShell

# CM95 tracked-file SHA256 manifest generator
# 在仓库根目录执行:
# powershell -ExecutionPolicy Bypass -File .\tools\update_manifest_sha256.ps1
$ErrorActionPreference = "Stop"
$root = (Get-Location).Path
$out = Join-Path $root "MANIFEST.sha256"
$files = git ls-files
if ($LASTEXITCODE -ne 0) {
throw "git ls-files failed"
}
$lines = foreach ($rel in $files) {
if ($rel -eq "MANIFEST.sha256") {
continue
}
$path = Join-Path $root $rel
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
continue
}
$hash = (Get-FileHash -LiteralPath $path -Algorithm SHA256).Hash.ToLowerInvariant()
"$hash $($rel -replace '\\','/')"
}
$lines | Set-Content -LiteralPath $out -Encoding UTF8
Write-Host "Updated: $out"
Write-Host "Files: $($lines.Count)"