From eb001e59b3ecd46eeb7bfa75836f11ca3e6f5bb4 Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Fri, 1 Aug 2025 19:42:04 -0700 Subject: [PATCH] Refine build cleanup and script variable handling Updates the build process to remove any existing Apps.iso during cleanup, ensuring a fresh build without stale artifacts. Clarifies in the app script template that configuration variables are treated as strings. The examples are updated to reflect this, preventing potential errors in custom scripts when checking for boolean-like values. --- FFUDevelopment/Apps/Orchestration/Invoke-AppsScript.ps1 | 7 ++++--- FFUDevelopment/BuildFFUVM.ps1 | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/FFUDevelopment/Apps/Orchestration/Invoke-AppsScript.ps1 b/FFUDevelopment/Apps/Orchestration/Invoke-AppsScript.ps1 index 669a77e..16e6054 100644 --- a/FFUDevelopment/Apps/Orchestration/Invoke-AppsScript.ps1 +++ b/FFUDevelopment/Apps/Orchestration/Invoke-AppsScript.ps1 @@ -38,6 +38,8 @@ else { # Example of how to use the AppsScriptVariables hashtable to control script execution +# Note: The UI saves the values as strings, so if you type true for a value, it'll save to the config file as a string, not boolean + # Example: Check if a variable named 'foo' is set to string 'bar' and run a script accordingly # if ($AppsScriptVariables['foo'] -eq 'bar') { # Write-Host "Foo would have installed" @@ -46,8 +48,8 @@ else { # Write-Host "Foo would not have installed" # } -# Example: Check if a variable named 'foo' is set to boolean $true and run a script accordingly -# if ($AppsScriptVariables[Teams] -eq $true) { +# Example: Check if a variable named 'Teams' is set to string 'true' and run a script accordingly +# if ($AppsScriptVariables['Teams'] -eq 'true') { # Write-Host "Teams would have been installed" # } # else { @@ -55,5 +57,4 @@ else { # } # Your code below here - Write-Host 'Invoke-AppsScript.ps1 finished' \ No newline at end of file diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 0ce5c66..b37c639 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -3501,7 +3501,13 @@ function Get-FFUEnvironment { Remove-Item -Path $KBPath -Recurse -Force -ErrorAction SilentlyContinue WriteLog 'Removal complete' } - Writelog 'Removing dirty.txt file' + # Remove existing Apps.iso + if (Test-Path -Path $AppsISO) { + WriteLog "Removing $AppsISO" + Remove-Item -Path $AppsISO -Force -ErrorAction SilentlyContinue + WriteLog 'Removal complete' + } + WriteLog 'Removing dirty.txt file' Remove-Item -Path "$FFUDevelopmentPath\dirty.txt" -Force WriteLog "Cleanup complete" }