From 8cb1983e410d48a305f54948f4f8faeebe6493fd Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Fri, 28 Jun 2024 19:59:31 +1000 Subject: [PATCH] Add intunewin detection --- New-Win32Package.ps1 | 20 +++++++++++++------- packages/App/ImageCustomise/App.json | 2 +- scripts/Update-PackageJson.ps1 | 3 +++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/New-Win32Package.ps1 b/New-Win32Package.ps1 index 73825af1..fd29e5d3 100644 --- a/New-Win32Package.ps1 +++ b/New-Win32Package.ps1 @@ -347,14 +347,20 @@ process { } #region Create the intunewin package - Write-Msg -Msg "Create intunewin package in: '$Path\output'" - $params = @{ - SourceFolder = $SourcePath - SetupFile = $Manifest.PackageInformation.SetupFile - OutputFolder = $OutputPath - Force = $true + if ($Result.FullName -match "\.intunewin$") { + Write-Msg -Msg "Copy downloaded intunewin file to: '$Path\output'" + Copy-Item -Path $Result.FullName -Destination $OutputPath -Force + } + else { + Write-Msg -Msg "Create intunewin package in: '$Path\output'" + $params = @{ + SourceFolder = $SourcePath + SetupFile = $Manifest.PackageInformation.SetupFile + OutputFolder = $OutputPath + Force = $true + } + $IntuneWinPackage = New-IntuneWin32AppPackage @params } - $IntuneWinPackage = New-IntuneWin32AppPackage @params # Get the package file $PackageFile = Get-ChildItem -Path $OutputPath -Recurse -Include "*.intunewin" -ErrorAction "SilentlyContinue" diff --git a/packages/App/ImageCustomise/App.json b/packages/App/ImageCustomise/App.json index 97d135b3..0724c1f7 100644 --- a/packages/App/ImageCustomise/App.json +++ b/packages/App/ImageCustomise/App.json @@ -1,7 +1,7 @@ { "Application": { "Name": "ImageCustomise", - "Filter": "Get-EvergreenAppFromApi -Name \"stealthpuppyWindowsCustomisedDefaults\" | Where-Object { $_.Type -eq \"zip\" } | Select-Object -First 1", + "Filter": "Get-EvergreenAppFromApi -Name \"stealthpuppyWindowsCustomisedDefaults\" | Where-Object { $_.Type -eq \"intunewin\" } | Select-Object -First 1", "Title": "Windows Customised Defaults", "Language": "en-US", "Architecture": "x64" diff --git a/scripts/Update-PackageJson.ps1 b/scripts/Update-PackageJson.ps1 index d2b7ae3a..bff7ddc4 100644 --- a/scripts/Update-PackageJson.ps1 +++ b/scripts/Update-PackageJson.ps1 @@ -79,6 +79,9 @@ foreach ($ManifestJson in $ManifestList) { $Manifest.PackageInformation.SetupFile = $SetupFile -replace "%20", " " $Manifest.Program.InstallCommand = $Manifest.Program.InstallTemplate -replace "#SetupFile", $SetupFile -replace "%20", " " } + elseif ($AppUpdate.URI -match "\.intunewin$") { + # Do nothing because the download is already in intunewin format + } else { if ([System.Boolean]($AppUpdate.PSobject.Properties.name -match "Filename")) { $Manifest.PackageInformation.SetupFile = $AppUpdate.Filename -replace "%20", " "