commit
3bfb717df7
|
@ -18,37 +18,44 @@ Function Update-App ($app) {
|
||||||
|
|
||||||
#Run Winget Upgrade command
|
#Run Winget Upgrade command
|
||||||
& $Winget upgrade --id $($app.Id) --all --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
|
& $Winget upgrade --id $($app.Id) --all --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
|
||||||
|
|
||||||
|
#Set mods to apply as an upgrade
|
||||||
|
$ModsMode = "Upgrade"
|
||||||
|
|
||||||
#Check if application updated properly
|
#Check if application updated properly
|
||||||
$CheckOutdated = Get-WingetOutdatedApps
|
$CheckOutdated = Get-WingetOutdatedApps
|
||||||
$FailedToUpgrade = $false
|
$FailedToUpgrade = $false
|
||||||
#Check if mods exist
|
|
||||||
$ModsInstall, $ModsUpgrade = Test-Mods $($app.Id)
|
|
||||||
foreach ($CheckApp in $CheckOutdated) {
|
foreach ($CheckApp in $CheckOutdated) {
|
||||||
if ($($CheckApp.Id) -eq $($app.Id)) {
|
if ($($CheckApp.Id) -eq $($app.Id)) {
|
||||||
|
|
||||||
#If app failed to upgrade, run Install command
|
#If app failed to upgrade, run Install command
|
||||||
& $Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
|
& $Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
|
||||||
|
|
||||||
|
#Set mods to apply as an install
|
||||||
|
$ModsMode = "Install"
|
||||||
|
|
||||||
#Check if application installed properly
|
#Check if application installed properly
|
||||||
$CheckOutdated2 = Get-WingetOutdatedApps
|
$CheckOutdated2 = Get-WingetOutdatedApps
|
||||||
foreach ($CheckApp2 in $CheckOutdated2) {
|
foreach ($CheckApp2 in $CheckOutdated2) {
|
||||||
if ($($CheckApp2.Id) -eq $($app.Id)) {
|
if ($($CheckApp2.Id) -eq $($app.Id)) {
|
||||||
$FailedToUpgrade = $true
|
$FailedToUpgrade = $true
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if ($ModsInstall) {
|
|
||||||
Write-Log "Modifications for $($app.Id) after install are being applied..." "Yellow"
|
|
||||||
& "$ModsInstall"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
if ($ModsUpgrade) {
|
|
||||||
Write-Log "Modifications for $($app.Id) after upgrade are being applied..." "Yellow"
|
if ($FailedToUpgrade -eq $false) {
|
||||||
& "$ModsUpgrade"
|
|
||||||
}
|
#Check if mods exist for install/upgrade
|
||||||
|
$ModsInstall, $ModsUpgrade = Test-Mods $($app.Id)
|
||||||
|
|
||||||
|
if (($ModsUpgrade) -and ($ModsMode -eq "Upgrade")) {
|
||||||
|
Write-Log "Modifications for $($app.Id) after upgrade are being applied..." "Yellow"
|
||||||
|
& "$ModsUpgrade"
|
||||||
|
}
|
||||||
|
elseif (($ModsInstall) -and ($ModsMode -eq "Install")) {
|
||||||
|
Write-Log "Modifications for $($app.Id) after install are being applied..." "Yellow"
|
||||||
|
& "$ModsInstall"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue