From 11ee64ec57759635fcf153f9286523afd166ad74 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Sun, 8 Jan 2023 03:30:43 +0100 Subject: [PATCH] Separate local White/Black list checking --- Winget-AutoUpdate/Winget-Upgrade.ps1 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Winget-AutoUpdate/Winget-Upgrade.ps1 index 38703cb..18a8f19 100644 --- a/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -84,12 +84,15 @@ if (Test-Network) { Write-Log "Newer List downloaded/copied to local path: $($WAUConfig.InstallLocation.TrimEnd(" ", "\"))" "Yellow" } else { - if ((Test-Path "$WorkingDir\included_apps.txt") -or (Test-Path "$WorkingDir\excluded_apps.txt")) { - Write-Log "List is up to date." "Green" + if ($WAUConfig.WAU_UseWhiteList -and (Test-Path "$WorkingDir\included_apps.txt")) { + Write-Log "List (white) is up to date." "Green" + } + elseif (!$WAUConfig.WAU_UseWhiteList -and (Test-Path "$WorkingDir\excluded_apps.txt")) { + Write-Log "List (black) is up to date." "Green" } else { - Write-Log "Critical: List doesn't exist, exiting..." "Red" - New-Item "$WorkingDir\logs\error.txt" -Value "List doesn't exist!" -Force + Write-Log "Critical: White/Black List doesn't exist, exiting..." "Red" + New-Item "$WorkingDir\logs\error.txt" -Value "White/Black List doesn't exist!" -Force Exit 1 } }