mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Allow custom BYO app list file paths in UI
Updates the FFU UI and orchestration scripts to allow users to specify custom file paths for their Bring Your Own (BYO) app lists, rather than forcing the use of `UserAppList.json` in a specific directory. Also modifies the orchestration to sync this custom path via `AppInstallConfig.json` so that the runtime orchestration phase resolves the correct file name and path during installation. Refreshes the Apps ISO if the custom BYO app list is updated.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
# Allow Orchestrator.ps1 to override the app list file paths while preserving legacy defaults.
|
||||
param(
|
||||
[Parameter()]
|
||||
[string]$wingetAppsJsonFile = (Join-Path -Path $PSScriptRoot -ChildPath "WinGetWin32Apps.json"),
|
||||
[Parameter()]
|
||||
[string]$userAppsJsonFile = (Join-Path -Path (Split-Path -Parent $PSScriptRoot) -ChildPath "UserAppList.json")
|
||||
)
|
||||
|
||||
function Invoke-Process {
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param
|
||||
@@ -247,11 +255,6 @@ function Install-Applications {
|
||||
}
|
||||
}
|
||||
|
||||
# Define paths for the JSON files
|
||||
$wingetAppsJsonFile = "$PSScriptRoot\WinGetWin32Apps.json"
|
||||
# Look for UserAppList.json one directory level up from the script's location. This keeps the user specific json files (AppList.json and UserAppList.json in the Apps dir)
|
||||
$userAppsJsonFile = Join-Path -Path (Split-Path -Parent $PSScriptRoot) -ChildPath "UserAppList.json"
|
||||
|
||||
# Initialize empty arrays for apps from each source
|
||||
$wingetApps = @()
|
||||
$userApps = @()
|
||||
@@ -286,9 +289,9 @@ if ($wingetApps.Count -gt 0) {
|
||||
Install-Applications -apps $wingetApps
|
||||
}
|
||||
|
||||
# Read the UserAppList.json file if it exists
|
||||
# Read the configured BYO app list file if it exists
|
||||
if (Test-Path -Path $userAppsJsonFile) {
|
||||
Write-Host "Processing UserAppList.json..."
|
||||
Write-Host "Processing $(Split-Path -Path $userAppsJsonFile -Leaf)..."
|
||||
try {
|
||||
$userContent = Get-Content -Path $userAppsJsonFile -Raw -ErrorAction Stop | ConvertFrom-Json
|
||||
if ($userContent -is [array]) {
|
||||
@@ -296,19 +299,19 @@ if (Test-Path -Path $userAppsJsonFile) {
|
||||
Write-Host "Found $(($userApps | Measure-Object).Count) user-defined apps."
|
||||
}
|
||||
elseif ($userContent) {
|
||||
$userApps = @($userContent) # Ensure it's an array
|
||||
$userApps = @($userContent)
|
||||
Write-Host "Found 1 user-defined app."
|
||||
}
|
||||
else {
|
||||
Write-Host "UserAppList.json is empty or invalid."
|
||||
Write-Host "$(Split-Path -Path $userAppsJsonFile -Leaf) is empty or invalid."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to read or parse UserAppList.json file: $_"
|
||||
Write-Error "Failed to read or parse BYO app list file '$userAppsJsonFile': $_"
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "UserAppList.json file not found. Skipping."
|
||||
Write-Host "BYO app list file not found at $userAppsJsonFile. Skipping."
|
||||
}
|
||||
|
||||
# Install User apps if any were found
|
||||
|
||||
Reference in New Issue
Block a user