From db507c82640e1e1f7c954256c5ea7ab6a067530d Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Wed, 2 Nov 2022 18:47:21 +0100 Subject: [PATCH] Framework ready, function next --- README.md | 5 ++++- Winget-AutoUpdate-Install.ps1 | 10 ++++++++++ Winget-AutoUpdate/Winget-Upgrade.ps1 | 20 +++++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8377d6a..aed80bc 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,10 @@ Disable Winget-AutoUpdate update checking. By default, WAU auto updates if new v Use White List instead of Black List. This setting will not create the "excluded_apps.txt" but "included_apps.txt" **-ListPath** -Get Black/White List from Path (URL/UNC/Local) (copy/download to Winget-AutoUpdate installation location if external list is newer). +Get Black/White List from Path (URL/UNC/Local) (download/copy to Winget-AutoUpdate installation location if external list is newer). + +**-ModsPath** +Get Mods from Path (URL/UNC/Local) (download/copy to `mods` in Winget-AutoUpdate installation location if external mods is newer). **-InstallUserContext** Install WAU with system and **user** context executions (From version 1.15.3) diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index 4173e0f..e0a0fa3 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -25,6 +25,9 @@ Use White List instead of Black List. This setting will not create the "exclude_ .PARAMETER ListPath Get Black/White List from Path (URL/UNC/Local) +.PARAMETER ModsPath +Get mods from Path (URL/UNC/Local) + .PARAMETER Uninstall Remove scheduled tasks and scripts. @@ -67,6 +70,9 @@ Configure WAU to bypass the Black/White list when run in user context .EXAMPLE .\Winget-AutoUpdate-Install.ps1 -Silent -ListPath https://www.domain.com/WAULists -StartMenuShortcut +.EXAMPLE +.\Winget-AutoUpdate-Install.ps1 -Silent -ModsPath https://www.domain.com/WAUMods -DesktopShortcut + .EXAMPLE .\Winget-AutoUpdate-Install.ps1 -Silent -UpdatesAtLogon -UpdatesInterval Weekly @@ -80,6 +86,7 @@ param( [Parameter(Mandatory = $False)] [Alias('S')] [Switch] $Silent = $false, [Parameter(Mandatory = $False)] [Alias('Path')] [String] $WingetUpdatePath = "$env:ProgramData\Winget-AutoUpdate", [Parameter(Mandatory = $False)] [Alias('List')] [String] $ListPath, + [Parameter(Mandatory = $False)] [Alias('Mods')] [String] $ModsPath, [Parameter(Mandatory = $False)] [Switch] $DoNotUpdate = $false, [Parameter(Mandatory = $False)] [Switch] $DisableWAUAutoUpdate = $false, [Parameter(Mandatory = $False)] [Switch] $RunOnMetered = $false, @@ -339,6 +346,9 @@ function Install-WingetAutoUpdate { if ($ListPath) { New-ItemProperty $regPath -Name WAU_ListPath -Value $ListPath -Force | Out-Null } + if ($ModsPath) { + New-ItemProperty $regPath -Name WAU_ModsPath -Value $ModsPath -Force | Out-Null + } if ($BypassListForUsers) { New-ItemProperty $regPath -Name WAU_BypassListForUsers -Value 1 -PropertyType DWord -Force | Out-Null } diff --git a/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Winget-AutoUpdate/Winget-Upgrade.ps1 index 75d4517..580dc46 100644 --- a/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -76,7 +76,7 @@ if (Test-Network) { Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath)" $NewList = Test-ListPath $WAUConfig.WAU_ListPath $WAUConfig.WAU_UseWhiteList $WAUConfig.InstallLocation if ($NewList) { - Write-Log "Newer List copied/downloaded to local path: $($WAUConfig.InstallLocation)" "Yellow" + Write-Log "Newer List downloaded/copied to local path: $($WAUConfig.InstallLocation)" "Yellow" } else { if ((Test-Path "$WorkingDir\included_apps.txt") -or (Test-Path "$WorkingDir\excluded_apps.txt")) { @@ -88,6 +88,24 @@ if (Test-Network) { } } } + + #Get External ModsPath if System + if ($WAUConfig.WAU_ModsPath) { + Write-Log "WAU uses External Mods from: $($WAUConfig.WAU_ModsPath)" + $NewMods = Test-ModsPath $WAUConfig.WAU_ModsPath $WAUConfig.InstallLocation + if ($NewMods) { + Write-Log "Newer Mods downloaded/copied to local path: $($WAUConfig.InstallLocation)" "Yellow" + } + else { + if (Test-Path "$WorkingDir\mods\*.ps1") { + Write-Log "Mods is up to date." "Green" + } + else { + Write-Log "Mods doesn't exist!" "Yellow" + #Exit 0 + } + } + } } #Get White or Black list