From 52ad20adad316afe626693d80fe242a2d3ebde46 Mon Sep 17 00:00:00 2001 From: romanitho <96626929+Romanitho@users.noreply.github.com> Date: Wed, 21 Feb 2024 23:26:51 +0100 Subject: [PATCH 1/4] Adding support for wildcard in app id --- .../WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 index 00e1803..1d95dd3 100644 --- a/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -292,14 +292,20 @@ if (Test-Network) { if ($UseWhiteList) { #For each app, notify and update foreach ($app in $outdated) { - if (($toUpdate -contains $app.Id) -and $($app.Version) -ne "Unknown") { - Update-App $app - } - #if current app version is unknown - elseif ($($app.Version) -eq "Unknown") { + #if current app version is unknown, skip it + if ($($app.Version) -eq "Unknown") { Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray" } - #if app is in "excluded list" + #if app is in "include list", update it + elseif ($toUpdate -contains $app.Id) { + Update-App $app + } + #if app with wildcard is in "include list", update it + elseif ($toUpdate | Where-Object { $app.Id -like $_ }) { + Write-ToLog "$($app.Name) is wildcard in the include list." + Update-App $app + } + #else, skip it else { Write-ToLog "$($app.Name) : Skipped upgrade because it is not in the included app list" "Gray" } @@ -309,17 +315,22 @@ if (Test-Network) { else { #For each app, notify and update foreach ($app in $outdated) { - if (-not ($toSkip -contains $app.Id) -and $($app.Version) -ne "Unknown") { - Update-App $app - } - #if current app version is unknown - elseif ($($app.Version) -eq "Unknown") { + #if current app version is unknown, skip it + if ($($app.Version) -eq "Unknown") { Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray" } - #if app is in "excluded list" - else { + #if app is in "excluded list", skip it + elseif ($toSkip -contains $app.Id) { Write-ToLog "$($app.Name) : Skipped upgrade because it is in the excluded app list" "Gray" } + #if app with wiladcard is in "excluded list", skip it + elseif ($toSkip | Where-Object { $app.Id -like $_ }) { + Write-ToLog "$($app.Name) : Skipped upgrade because it is *wildcard* in the excluded app list" "Gray" + } + # else, update it + else { + Update-App $app + } } } From 0f0191b5c61bcbb38f95fe913a2686afbbea17d8 Mon Sep 17 00:00:00 2001 From: romanitho <96626929+Romanitho@users.noreply.github.com> Date: Wed, 21 Feb 2024 23:37:41 +0100 Subject: [PATCH 2/4] Update default list to latest changes (and as example) --- Sources/WAU/excluded_apps.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Sources/WAU/excluded_apps.txt b/Sources/WAU/excluded_apps.txt index f40e6eb..32e98fb 100644 --- a/Sources/WAU/excluded_apps.txt +++ b/Sources/WAU/excluded_apps.txt @@ -5,8 +5,5 @@ Microsoft.Office Microsoft.OneDrive Microsoft.Teams Microsoft.Teams.Classic -Mozilla.Firefox -Mozilla.Firefox.DeveloperEdition -Mozilla.Firefox.ESR -TeamViewer.TeamViewer -TeamViewer.TeamViewer.Host +Mozilla.Firefox* +TeamViewer.TeamViewer* From 3f7732b6845e833c683468fad51f874b3db17d4c Mon Sep 17 00:00:00 2001 From: romanitho <96626929+Romanitho@users.noreply.github.com> Date: Wed, 21 Feb 2024 23:41:47 +0100 Subject: [PATCH 3/4] spelling --- Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 index 1d95dd3..6511b42 100644 --- a/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -323,7 +323,7 @@ if (Test-Network) { elseif ($toSkip -contains $app.Id) { Write-ToLog "$($app.Name) : Skipped upgrade because it is in the excluded app list" "Gray" } - #if app with wiladcard is in "excluded list", skip it + #if app with wildcard is in "excluded list", skip it elseif ($toSkip | Where-Object { $app.Id -like $_ }) { Write-ToLog "$($app.Name) : Skipped upgrade because it is *wildcard* in the excluded app list" "Gray" } From 872fd5311931cf37c26f01cd44f394eb555bdce1 Mon Sep 17 00:00:00 2001 From: romanitho <96626929+Romanitho@users.noreply.github.com> Date: Thu, 22 Feb 2024 08:43:35 +0100 Subject: [PATCH 4/4] Update Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 573eb1b..c583fb1 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Add (or remove) the apps' ID you want to disable autoupdate to 'excluded_apps.tx - #### Or AllowList You can update only pre-selected apps. To do so, create an "included_apps.txt" with the apps' ID of the apps you want to auto-update and run the `Winget-AutoUpdate-Install.ps1` with `-UseWhiteList` parameter. Related post: https://github.com/Romanitho/Winget-AutoUpdate/issues/36 -> You can use WiGui to create these lists: https://github.com/Romanitho/Winget-Install-GUI +> The lists can contain Wildcard (*). For instance ```Mozilla.Firefox*``` will take care of all Firefox channels. (From v1.19.2-7) ### Notification Level You can choose which notification will be displayed: Full, Success only or none. Use `-NotificationLevel` parameter when you run `Winget-AutoUpdate-Install.ps1`.