Skip to content

Commit e137cf8

Browse files
committed
fix: pass custom winget source to Update-App and Confirm-Installation
PR #1135 added a -src parameter to Update-App and Confirm-Installation. Pass $Script:WingetSourceCustom to all call sites in our deadline code (Winget-Upgrade.ps1 overdue path, normal-mode loops, user-context update path) and WAU-UpdateNow.ps1.
1 parent a26e963 commit e137cf8

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

Sources/Winget-AutoUpdate/WAU-UpdateNow.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ if ($machineApps.Count -gt 0) {
102102
foreach ($app in $machineApps) {
103103
Write-ToLog "-> $($app.Name) : $($app.Version) -> $($app.AvailableVersion)"
104104

105-
Update-App $app
105+
Update-App $app -src $Script:WingetSourceCustom
106106

107-
if (Confirm-Installation $app.Id $app.AvailableVersion) {
107+
if (Confirm-Installation $app.Id $app.AvailableVersion $Script:WingetSourceCustom) {
108108
$AppRegPath = Join-Path $DeadlineRegBase $app.Id
109109
if (Test-Path $AppRegPath) {
110110
Remove-Item -Path $AppRegPath -Recurse -Force -ErrorAction SilentlyContinue

Sources/Winget-AutoUpdate/Winget-Upgrade.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ if (Test-Network) {
160160
}
161161
foreach ($app in $userApps) {
162162
Write-ToLog "-> $($app.Name) : $($app.Version) -> $($app.AvailableVersion)"
163-
Update-App $app
163+
Update-App $app -src $Script:WingetSourceCustom
164164
}
165165
try {
166166
Remove-Item -Path $userUpdateJson -Force -ErrorAction Stop
@@ -547,8 +547,8 @@ if (Test-Network) {
547547
$app = $deadlineApps | Where-Object { $_.Id -eq $entry.AppId } | Select-Object -First 1
548548
if ($app -and $app.Version -ne "Unknown") {
549549
Write-ToLog "Forced update (deadline reached): $($app.Name)"
550-
Update-App $app
551-
if (Confirm-Installation $app.Id $app.AvailableVersion) {
550+
Update-App $app -src $Script:WingetSourceCustom
551+
if (Confirm-Installation $app.Id $app.AvailableVersion $Script:WingetSourceCustom) {
552552
$DeadlineAppRegPath = "HKLM:\SOFTWARE\Romanitho\Winget-AutoUpdate\UpdateDeadlines\$($app.Id)"
553553
if (Test-Path $DeadlineAppRegPath) {
554554
Remove-Item -Path $DeadlineAppRegPath -Recurse -Force -ErrorAction SilentlyContinue
@@ -630,12 +630,12 @@ if (Test-Network) {
630630
}
631631
#if app is in "include list", update it
632632
elseif ($toUpdate -contains $app.Id) {
633-
Update-App $app
633+
Update-App $app -src $Script:WingetSourceCustom
634634
}
635635
#if app with wildcard is in "include list", update it
636636
elseif ($toUpdate | Where-Object { $app.Id -like $_ }) {
637637
Write-ToLog "$($app.Name) is wildcard in the include list."
638-
Update-App $app
638+
Update-App $app -src $Script:WingetSourceCustom
639639
}
640640
#else, skip it
641641
else {
@@ -661,7 +661,7 @@ if (Test-Network) {
661661
}
662662
# else, update it
663663
else {
664-
Update-App $app
664+
Update-App $app -src $Script:WingetSourceCustom
665665
}
666666
}
667667
}

0 commit comments

Comments
 (0)