From eecee5589a2133177c6b59e471442bd625b17bb7 Mon Sep 17 00:00:00 2001 From: he3als <65787561+he3als@users.noreply.github.com> Date: Thu, 4 Apr 2024 20:40:30 +0100 Subject: [PATCH] fix(local-build): check if playbook.conf modified --- src/playbook/local-build.cmd | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/playbook/local-build.cmd b/src/playbook/local-build.cmd index f0260327cf..b41c6b168f 100644 --- a/src/playbook/local-build.cmd +++ b/src/playbook/local-build.cmd @@ -114,7 +114,8 @@ $defaultConfig.Keys | ForEach-Object { if ($config.Keys -notcontains $_) { $config = $config + @{ $_ = $defaultConfig.$_ - }; $updateConfig = $true + } + $updateConfig = $true } } if ($updateConfig) {CreateConfig $config} @@ -188,8 +189,10 @@ try { if ($removeWinverRequirement) {$patterns += "", "", ""} if ($removeProductCode) {$patterns += ""} - $newContent = Get-Content "playbook.conf" | Where-Object { $_ -notmatch ($patterns -join '|') } - $newContent | Set-Content "$tempPlaybookConf" -Force + if ($patterns.Count -gt 0) { + $newContent = Get-Content "playbook.conf"| Where-Object { $_ -notmatch ($patterns -join '|') } + $newContent | Set-Content "$tempPlaybookConf" -Force + } if ($removeDependencies -or $liveLog) { $startYML = "$PWD\$ymlPath" @@ -226,13 +229,12 @@ try { $excludeFiles = @( "local-build.cmd", - "playbook.conf", "*.apbx" - ); if (Test-Path $tempStartYML) { $excludeFiles += "custom.yml" } + ) + if (Test-Path $tempStartYML) { $excludeFiles += "custom.yml" } + if (Test-Path $tempPlaybookConf) { $excludeFiles += "playbook.conf" } # make playbook, 7z is faster - $filteredItems = @() - if (Test-Path $apbxPath) { Remove-Item $apbxFileName -Force } (Get-ChildItem -File -Exclude $excludeFiles -Recurse).FullName `