pr feedback

This commit is contained in:
Ben Hillis 2025-12-05 17:26:52 -08:00
parent e5993ff879
commit 531a3cb786

View File

@ -79,9 +79,14 @@ if ($Package) {
catch { catch {
# Fallback: manually import the certificate and trust it # Fallback: manually import the certificate and trust it
try { try {
$cert = (Get-AuthenticodeSignature -LiteralPath $Package).SignerCertificate $signature = Get-AuthenticodeSignature -LiteralPath $Package
if (-not $signature) {
Write-Error "Failed to get package signature. Cannot import certificate."
exit 1
}
$cert = $signature.SignerCertificate
if ($cert) { if ($cert) {
$certPath = Join-Path $env:TEMP "private-wsl-$([guid]::NewGuid()).cert" $certPath = Join-Path $env:TEMP "wsl-package-cert.cer"
$cert | Export-Certificate -FilePath $certPath | Out-Null $cert | Export-Certificate -FilePath $certPath | Out-Null
try { try {
Import-Certificate -FilePath $certPath -CertStoreLocation Cert:\LocalMachine\Root | Out-Null Import-Certificate -FilePath $certPath -CertStoreLocation Cert:\LocalMachine\Root | Out-Null
@ -92,9 +97,9 @@ if ($Package) {
} }
} }
catch { catch {
Write-Warning "Could not import certificate: $_" Write-Error "Failed to import certificate required for package installation: $_"
exit 1
} }
$installed = $false
} }
} }
@ -106,7 +111,7 @@ if ($Package) {
Write-Host "Error installing package: $_" Write-Host "Error installing package: $_"
# Only show recent relevant logs, not all historical logs # Only show recent relevant logs, not all historical logs
try { try {
Get-AppPackageLog -ActivityID * | Where-Object {$_.TimeCreated -gt (Get-Date).AddMinutes(-5)} | Select-Object -First 10 Get-AppPackageLog -ActivityID * | Where-Object {$_.TimeCreated -gt (Get-Date).AddMinutes(-5)} | Select-Object -First 10 | Format-List
} catch { } catch {
Write-Host "Could not retrieve app package logs" Write-Host "Could not retrieve app package logs"
} }