mirror of
https://github.com/timsutton/brigadier.git
synced 2025-06-03 00:30:08 -04:00
Support ProductID filtering
This commit is contained in:
parent
455550864c
commit
0c813c9ab4
1 changed files with 10 additions and 4 deletions
|
@ -29,6 +29,7 @@ Write-Host "Using model: $Model"
|
||||||
|
|
||||||
# Read data from sucatalog and find all Bootcamp ESD's
|
# Read data from sucatalog and find all Bootcamp ESD's
|
||||||
Write-Host "Downloading software update catalog..."
|
Write-Host "Downloading software update catalog..."
|
||||||
|
$bootcamplist = @()
|
||||||
[xml]$sucatalog = Invoke-WebRequest -Uri $SUCATALOG_URL -Method Get -ErrorAction Stop
|
[xml]$sucatalog = Invoke-WebRequest -Uri $SUCATALOG_URL -Method Get -ErrorAction Stop
|
||||||
$sucatalog.plist.dict.dict.dict | Where-Object { $_.String -match "Bootcamp" } | ForEach-Object {
|
$sucatalog.plist.dict.dict.dict | Where-Object { $_.String -match "Bootcamp" } | ForEach-Object {
|
||||||
# Search dist files to find supported models, using regex match to find models in dist files - stole regex from brigadier's source
|
# Search dist files to find supported models, using regex match to find models in dist files - stole regex from brigadier's source
|
||||||
|
@ -37,12 +38,17 @@ $sucatalog.plist.dict.dict.dict | Where-Object { $_.String -match "Bootcamp" } |
|
||||||
$distXML = (Invoke-RestMethod -Uri $distURL).InnerXml
|
$distXML = (Invoke-RestMethod -Uri $distURL).InnerXml
|
||||||
$SupportedModels = [regex]::Matches($distXML,$modelRegex).Value
|
$SupportedModels = [regex]::Matches($distXML,$modelRegex).Value
|
||||||
if ($SupportedModels -contains $Model) {
|
if ($SupportedModels -contains $Model) {
|
||||||
$version = [regex]::Match($distURL,"(\d{3}-\d{4,5})").Value
|
$_ | Add-Member -NotePropertyName Version -NotePropertyValue ([regex]::Match($distURL,"(\d{3}-\d{4,5})").Value)
|
||||||
Write-Output "Found supported ESD: $Version, posted $($_.Date)"
|
Write-Output "Found supported ESD: $($_.Version), posted $($_.Date)"
|
||||||
[array]$bootcamplist += $_
|
$bootcamplist += $_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ProductId) {
|
||||||
|
Write-Host "ProductID specified, filtering Boot Camp ESD selection to match."
|
||||||
|
$bootcamplist = $bootcamplist | Where-Object {$_.Version -in $ProductId}
|
||||||
|
}
|
||||||
|
|
||||||
if ($bootcamplist.Length -gt 1) {
|
if ($bootcamplist.Length -gt 1) {
|
||||||
Write-Host "Found more than 1 supported Bootcamp ESD. Selecting newest based on posted date which may not always be correct"
|
Write-Host "Found more than 1 supported Bootcamp ESD. Selecting newest based on posted date which may not always be correct"
|
||||||
} elseif ($bootcamplist.length -eq 0) {
|
} elseif ($bootcamplist.length -eq 0) {
|
||||||
|
@ -53,7 +59,7 @@ if ($bootcamplist.Length -gt 1) {
|
||||||
$esd = $bootcamplist | Sort-Object -Property Date | Select-Object -Last 1
|
$esd = $bootcamplist | Sort-Object -Property Date | Select-Object -Last 1
|
||||||
# Build a hash table of the package's properties from the XML
|
# Build a hash table of the package's properties from the XML
|
||||||
$package = $esd.array.dict.selectnodes('key') | ForEach-Object {@{$($_.'#text') = $($_.nextsibling.'#text')}}
|
$package = $esd.array.dict.selectnodes('key') | ForEach-Object {@{$($_.'#text') = $($_.nextsibling.'#text')}}
|
||||||
$package += @{'ESDVersion' = $Version}
|
$package += @{'ESDVersion' = $($esd.Version)}
|
||||||
Write-Host "Selected $($package.ESDVersion) as it's the most recently posted."
|
Write-Host "Selected $($package.ESDVersion) as it's the most recently posted."
|
||||||
|
|
||||||
$landingDir = Join-Path $OutputDir "BootCamp-$($package.ESDVersion)"
|
$landingDir = Join-Path $OutputDir "BootCamp-$($package.ESDVersion)"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue