32 lines
1.1 KiB
PowerShell
32 lines
1.1 KiB
PowerShell
# PowerShell script to extract winCodeSign archive ignoring symlink errors
|
|||
|
|
param(
|
||
|
|
[string]$ArchivePath,
|
||
|
|
[string]$OutputPath
|
||
|
|
)
|
||
|
|
|
||
|
|
# Create output directory if it doesn't exist
|
||
|
|
if (-not (Test-Path $OutputPath)) {
|
||
|
|
New-Item -ItemType Directory -Path $OutputPath -Force | Out-Null
|
||
|
|
}
|
||
|
|
|
||
|
|
# Use 7zip with flag to ignore symlink errors
|
||
|
|
$7zipPath = Join-Path $PSScriptRoot "node_modules\7zip-bin\win\x64\7za.exe"
|
||
|
|
|
||
|
|
if (Test-Path $7zipPath) {
|
||
|
|
# Extract archive, ignoring symlink errors
|
||
|
|
$process = Start-Process -FilePath $7zipPath -ArgumentList "x", "-bd", "-y", $ArchivePath, "`"-o$OutputPath`"" -Wait -NoNewWindow -PassThru
|
||
|
|
|
||
|
|
# Check if extraction succeeded (exit code 0 or 2 - 2 means warnings but success)
|
||
|
|
if ($process.ExitCode -eq 0 -or $process.ExitCode -eq 2) {
|
||
|
|
Write-Host "Archive extracted successfully (ignored symlink warnings)"
|
||
|
|
exit 0
|
||
|
|
} else {
|
||
|
|
Write-Host "Extraction failed with exit code: $($process.ExitCode)"
|
||
|
|
exit $process.ExitCode
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
Write-Host "7zip not found at: $7zipPath"
|
||
|
|
exit 1
|
||
|
|
}
|
||
|
|
|