@@ -889,54 +889,17 @@ function Update-PSSignedBuildFolder
889889 [string []] $RemoveFilter = (' *.pdb' , ' *.zip' , ' *.r2rmap' )
890890 )
891891
892- $BuildPathNormalized = (Get-Item $BuildPath ).FullName
893- $SignedFilesPathNormalized = (Get-Item $SignedFilesPath ).FullName
894-
895- Write-Verbose - Verbose " BuildPath = $BuildPathNormalized "
896- Write-Verbose - Verbose " SignedFilesPath = $signedFilesPath "
897-
898892 # Replace unsigned binaries with signed
899- $signedFilesFilter = Join-Path - Path $SignedFilesPathNormalized - ChildPath ' *'
900- Write-Verbose - Verbose " signedFilesFilter = $signedFilesFilter "
901-
893+ $signedFilesFilter = Join-Path - Path $SignedFilesPath - ChildPath ' *'
902894 Get-ChildItem - Path $signedFilesFilter - Recurse - File | Select-Object - ExpandProperty FullName | ForEach-Object - Process {
903- Write-Verbose - Verbose " Processing $_ "
904-
905- # Agents seems to be on a case sensitive file system
906- if ($IsLinux ) {
907- $relativePath = $_.Replace ($SignedFilesPathNormalized , ' ' )
908- } else {
909- $relativePath = $_.ToLowerInvariant ().Replace($SignedFilesPathNormalized.ToLowerInvariant (), ' ' )
910- }
911-
912- Write-Verbose - Verbose " relativePath = $relativePath "
913- $destination = (Get-Item (Join-Path - Path $BuildPathNormalized - ChildPath $relativePath )).FullName
914- Write-Verbose - Verbose " destination = $destination "
895+ $relativePath = $_.ToLowerInvariant ().Replace($SignedFilesPath.ToLowerInvariant (), ' ' )
896+ $destination = Join-Path - Path $BuildPath - ChildPath $relativePath
915897 Write-Log " replacing $destination with $_ "
916-
917- if (-not (Test-Path $destination )) {
918- $parent = Split-Path - Path $destination - Parent
919- $exists = Test-Path - Path $parent
920-
921- if ($exists ) {
922- Write-Verbose - Verbose " Parent:"
923- Get-ChildItem - Path $parent | Select-Object - ExpandProperty FullName | Write-Verbose - Verbose
924- }
925-
926- Write-Error " File not found: $destination , parent - $parent exists: $exists "
927- }
928-
929- $signature = Get-AuthenticodeSignature - FilePath $_
930-
931- if ($signature.Status -ne ' Valid' ) {
932- Write-Error " Invalid signature for $_ "
933- }
934-
935898 Copy-Item - Path $_ - Destination $destination - Force
936899 }
937900
938901 foreach ($filter in $RemoveFilter ) {
939- $removePath = Join-Path - Path $BuildPathNormalized - ChildPath $filter
902+ $removePath = Join-Path - Path $BuildPath - ChildPath $filter
940903 Remove-Item - Path $removePath - Recurse - Force
941904 }
942905}
0 commit comments