commit
dbdfb1e09c
|
@ -55,7 +55,7 @@ Same process as new installation : download, unzip and run `install.bat`.
|
||||||
|
|
||||||
### Automatic Update
|
### Automatic Update
|
||||||
A new Auto-Update process has been released from version 1.5.0. By default, WAU AutoUpdate is enabled. It will not overwrite the configurations, icons (if personalised), excluded_apps list,...
|
A new Auto-Update process has been released from version 1.5.0. By default, WAU AutoUpdate is enabled. It will not overwrite the configurations, icons (if personalised), excluded_apps list,...
|
||||||
To disable WAU AutoUpdate, run the `winget-install-and-update.ps1` with `-DisableWAUAutoUpdate` parameter
|
To disable WAU AutoUpdate, run the `Winget-AutoUpdate-Install.ps1` with `-DisableWAUAutoUpdate` parameter
|
||||||
|
|
||||||
## Uninstall WAU
|
## Uninstall WAU
|
||||||
Simply uninstall it from your programs:
|
Simply uninstall it from your programs:
|
||||||
|
@ -152,6 +152,13 @@ If you want to run a script that removes the shortcut from **%PUBLIC%\Desktop**
|
||||||
|
|
||||||
You can find more information on [Winget-Install Repo](https://github.com/Romanitho/Winget-Install#custom-mods), as it's a related feature
|
You can find more information on [Winget-Install Repo](https://github.com/Romanitho/Winget-Install#custom-mods), as it's a related feature
|
||||||
|
|
||||||
|
### Winget native parameters
|
||||||
|
Another finess is the **AppID** followed by the `-override` suffix as a **text file** (.txt) that you can place under the **mods** folder.
|
||||||
|
> Example:
|
||||||
|
> **Canneverbe.CDBurnerXP-override.txt** with the content `ADDLOCAL=All REMOVE=Desktop_Shortcut /qn`
|
||||||
|
|
||||||
|
This will use the content from the text file as a native **winget --override** parameter when upgrading (as proposed by [Nesovj](https://github.com/Nesovj) in [Mod for --override argument #244](https://github.com/Romanitho/Winget-AutoUpdate/discussions/244#discussion-4637666)).
|
||||||
|
|
||||||
## Help
|
## Help
|
||||||
In some cases, you need to "unblock" the `install.bat` file (Windows Defender SmartScreen). Right click, properties and unblock. Then, you'll be able to run it.
|
In some cases, you need to "unblock" the `install.bat` file (Windows Defender SmartScreen). Right click, properties and unblock. Then, you'll be able to run it.
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ $Balise = "Winget-AutoUpdate (WAU)"
|
||||||
$UserRun = $True
|
$UserRun = $True
|
||||||
|
|
||||||
if ($Logs) {
|
if ($Logs) {
|
||||||
if ((Test-Path "$WorkingDir\logs\updates.log")) {
|
if (Test-Path "$WorkingDir\logs\updates.log") {
|
||||||
Invoke-Item "$WorkingDir\logs\updates.log"
|
Invoke-Item "$WorkingDir\logs\updates.log"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -81,8 +81,15 @@ else {
|
||||||
While (Test-WAUisRunning) {
|
While (Test-WAUisRunning) {
|
||||||
Start-Sleep 3
|
Start-Sleep 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Test if there was a list_/winget_error
|
||||||
|
if (Test-Path "$WorkingDir\logs\*_error.txt") {
|
||||||
|
$MessageType = "error"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$MessageType = "success"
|
||||||
|
}
|
||||||
$Message = $NotifLocale.local.outputs.output[9].message
|
$Message = $NotifLocale.local.outputs.output[9].message
|
||||||
$MessageType = "success"
|
|
||||||
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss
|
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|
|
@ -71,6 +71,11 @@ if (Test-Network) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Delete previous list_/winget_error (if they exist) if System
|
||||||
|
if (Test-Path "$WorkingDir\logs\*_error.txt") {
|
||||||
|
Remove-Item "$WorkingDir\logs\*_error.txt" -Force
|
||||||
|
}
|
||||||
|
|
||||||
#Get External ListPath if System
|
#Get External ListPath if System
|
||||||
if ($WAUConfig.WAU_ListPath) {
|
if ($WAUConfig.WAU_ListPath) {
|
||||||
Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath)"
|
Write-Log "WAU uses External Lists from: $($WAUConfig.WAU_ListPath)"
|
||||||
|
@ -83,8 +88,9 @@ if (Test-Network) {
|
||||||
Write-Log "List is up to date." "Green"
|
Write-Log "List is up to date." "Green"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Log "List doesn't exist!" "Red"
|
Write-Log "Critical: List doesn't exist, exiting..." "Red"
|
||||||
Exit 0
|
New-Item "$WorkingDir\logs\list_error.txt" -Force
|
||||||
|
Exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,6 +131,14 @@ if (Test-Network) {
|
||||||
Write-Log "Checking application updates on Winget Repository..." "yellow"
|
Write-Log "Checking application updates on Winget Repository..." "yellow"
|
||||||
$outdated = Get-WingetOutdatedApps
|
$outdated = Get-WingetOutdatedApps
|
||||||
|
|
||||||
|
#If something is wrong with the winget source, exit
|
||||||
|
if ($outdated -like "Problem:*") {
|
||||||
|
Write-Log "Critical: An error occured, exiting..." "red"
|
||||||
|
Write-Log "$outdated" "red"
|
||||||
|
New-Item "$WorkingDir\logs\winget_error.txt" -Value "$outdated" -Force
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
#Log list of app to update
|
#Log list of app to update
|
||||||
foreach ($app in $outdated) {
|
foreach ($app in $outdated) {
|
||||||
#List available updates
|
#List available updates
|
||||||
|
|
|
@ -11,9 +11,9 @@ function Get-WingetOutdatedApps {
|
||||||
#Get list of available upgrades on winget format
|
#Get list of available upgrades on winget format
|
||||||
$upgradeResult = & $Winget upgrade --source winget | Out-String
|
$upgradeResult = & $Winget upgrade --source winget | Out-String
|
||||||
|
|
||||||
#Start Convertion of winget format to an array. Check if "-----" exists
|
#Start Convertion of winget format to an array. Check if "-----" exists (Winget Error Handling)
|
||||||
if (!($upgradeResult -match "-----")) {
|
if (!($upgradeResult -match "-----")) {
|
||||||
return
|
return "Problem:`n$upgradeResult"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Split winget output to lines
|
#Split winget output to lines
|
||||||
|
|
|
@ -4,6 +4,7 @@ function Test-Mods ($app) {
|
||||||
|
|
||||||
#Takes care of a null situation
|
#Takes care of a null situation
|
||||||
$ModsPreInstall = $null
|
$ModsPreInstall = $null
|
||||||
|
$ModsOverride = $null
|
||||||
$ModsUpgrade = $null
|
$ModsUpgrade = $null
|
||||||
$ModsInstall = $null
|
$ModsInstall = $null
|
||||||
$ModsInstalled = $null
|
$ModsInstalled = $null
|
||||||
|
@ -13,6 +14,9 @@ function Test-Mods ($app) {
|
||||||
if (Test-Path "$Mods\$app-preinstall.ps1") {
|
if (Test-Path "$Mods\$app-preinstall.ps1") {
|
||||||
$ModsPreInstall = "$Mods\$app-preinstall.ps1"
|
$ModsPreInstall = "$Mods\$app-preinstall.ps1"
|
||||||
}
|
}
|
||||||
|
if (Test-Path "$Mods\$app-override.txt") {
|
||||||
|
$ModsOverride = Get-Content "$Mods\$app-override.txt" -Raw
|
||||||
|
}
|
||||||
if (Test-Path "$Mods\$app-install.ps1") {
|
if (Test-Path "$Mods\$app-install.ps1") {
|
||||||
$ModsInstall = "$Mods\$app-install.ps1"
|
$ModsInstall = "$Mods\$app-install.ps1"
|
||||||
$ModsUpgrade = "$Mods\$app-install.ps1"
|
$ModsUpgrade = "$Mods\$app-install.ps1"
|
||||||
|
@ -25,6 +29,6 @@ function Test-Mods ($app) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ModsPreInstall, $ModsUpgrade, $ModsInstall, $ModsInstalled
|
return $ModsPreInstall, $ModsOverride, $ModsUpgrade, $ModsInstall, $ModsInstalled
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) {
|
||||||
$ExternalMods = "$ModsPath"
|
$ExternalMods = "$ModsPath"
|
||||||
|
|
||||||
#Get File Names Locally
|
#Get File Names Locally
|
||||||
$InternalModsNames = Get-ChildItem -Path $LocalMods -Name -Recurse -Include *.ps1
|
$InternalModsNames = Get-ChildItem -Path $LocalMods -Name -Recurse -Include *.ps1, *.txt
|
||||||
|
|
||||||
# If path is URL
|
# If path is URL
|
||||||
if ($ExternalMods -like "http*") {
|
if ($ExternalMods -like "http*") {
|
||||||
|
@ -35,8 +35,8 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) {
|
||||||
|
|
||||||
#Loop through all links
|
#Loop through all links
|
||||||
$WebResponse.Links | Select-Object -ExpandProperty href | ForEach-Object {
|
$WebResponse.Links | Select-Object -ExpandProperty href | ForEach-Object {
|
||||||
#Check for .ps1 in listing/HREF:s in an index page pointing to .ps1
|
#Check for .ps1/.txt in listing/HREF:s in an index page pointing to .ps1/.txt
|
||||||
if ($_ -like "*.ps1") {
|
if (($_ -like "*.ps1") -or ($_ -like "*.txt")) {
|
||||||
try {
|
try {
|
||||||
$dateExternalMod = ""
|
$dateExternalMod = ""
|
||||||
$dateLocalMod =""
|
$dateLocalMod =""
|
||||||
|
@ -67,9 +67,9 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) {
|
||||||
}
|
}
|
||||||
# If path is UNC or local
|
# If path is UNC or local
|
||||||
else {
|
else {
|
||||||
if (Test-Path -Path $ExternalMods"\*.ps1") {
|
if ((Test-Path -Path $ExternalMods"\*.ps1") -or (Test-Path -Path $ExternalMods"\*.txt")) {
|
||||||
#Get File Names Externally
|
#Get File Names Externally
|
||||||
$ExternalModsNames = Get-ChildItem -Path $ExternalMods -Name -Recurse -Include *.ps1
|
$ExternalModsNames = Get-ChildItem -Path $ExternalMods -Name -Recurse -Include *.ps1, *.txt
|
||||||
#Delete Local Mods that don't exist Externally
|
#Delete Local Mods that don't exist Externally
|
||||||
foreach ($Mod in $InternalModsNames){
|
foreach ($Mod in $InternalModsNames){
|
||||||
If($Mod -notin $ExternalModsNames ){
|
If($Mod -notin $ExternalModsNames ){
|
||||||
|
|
|
@ -17,7 +17,10 @@ Function Update-App ($app) {
|
||||||
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Balise $Balise -Button1Action $ReleaseNoteURL -Button1Text $Button1Text
|
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Balise $Balise -Button1Action $ReleaseNoteURL -Button1Text $Button1Text
|
||||||
|
|
||||||
#Check if mods exist for preinstall/install/upgrade
|
#Check if mods exist for preinstall/install/upgrade
|
||||||
$ModsPreInstall, $ModsUpgrade, $ModsInstall, $ModsInstalled = Test-Mods $($app.Id)
|
$ModsPreInstall, $ModsOverride, $ModsUpgrade, $ModsInstall, $ModsInstalled = Test-Mods $($app.Id)
|
||||||
|
|
||||||
|
#Winget upgrade
|
||||||
|
Write-Log "########## WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID '$($App.Id)' ##########" "Gray"
|
||||||
|
|
||||||
#If PreInstall script exist
|
#If PreInstall script exist
|
||||||
if ($ModsPreInstall) {
|
if ($ModsPreInstall) {
|
||||||
|
@ -25,12 +28,15 @@ Function Update-App ($app) {
|
||||||
& "$ModsPreInstall"
|
& "$ModsPreInstall"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Winget upgrade
|
|
||||||
Write-Log "########## WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID '$($App.Id)' ##########" "Gray"
|
|
||||||
|
|
||||||
#Run Winget Upgrade command
|
#Run Winget Upgrade command
|
||||||
Write-Log "-> Running: Winget upgrade --id $($app.Id) --accept-package-agreements --accept-source-agreements -h"
|
if ($ModsOverride) {
|
||||||
& $Winget upgrade --id $($app.Id) --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
|
Write-Log "-> Running (overriding default): Winget upgrade --id $($app.Id) --accept-package-agreements --accept-source-agreements --override $ModsOverride"
|
||||||
|
& $Winget upgrade --id $($app.Id) --accept-package-agreements --accept-source-agreements --override $ModsOverride | Tee-Object -file $LogFile -Append
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Log "-> Running: Winget upgrade --id $($app.Id) --accept-package-agreements --accept-source-agreements -h"
|
||||||
|
& $Winget upgrade --id $($app.Id) --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
|
||||||
|
}
|
||||||
|
|
||||||
if ($ModsUpgrade) {
|
if ($ModsUpgrade) {
|
||||||
Write-Log "Modifications for $($app.Id) during upgrade are being applied..." "Yellow"
|
Write-Log "Modifications for $($app.Id) during upgrade are being applied..." "Yellow"
|
||||||
|
@ -47,15 +53,22 @@ Function Update-App ($app) {
|
||||||
#Test for a Pending Reboot (Component Based Servicing/WindowsUpdate/CCM_ClientUtilities)
|
#Test for a Pending Reboot (Component Based Servicing/WindowsUpdate/CCM_ClientUtilities)
|
||||||
$PendingReboot = Test-PendingReboot
|
$PendingReboot = Test-PendingReboot
|
||||||
if ($PendingReboot -eq $true) {
|
if ($PendingReboot -eq $true) {
|
||||||
Write-Log "-> A Pending Reboot lingers and probably prohibited $($app.Name) from upgrading...`n...an install for $($app.Name) is NOT executed!" "Red"
|
Write-Log "-> A Pending Reboot lingers and probably prohibited $($app.Name) from upgrading...`n-> ...an install for $($app.Name) is NOT executed!" "Red"
|
||||||
$FailedToUpgrade = $true
|
$FailedToUpgrade = $true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
#If app failed to upgrade, run Install command
|
#If app failed to upgrade, run Install command
|
||||||
Write-Log "-> An upgrade for $($app.Name) failed, now trying an install instead..." "Yellow"
|
Write-Log "-> An upgrade for $($app.Name) failed, now trying an install instead..." "Yellow"
|
||||||
Write-Log "-> Running: Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements -h"
|
|
||||||
& $Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
|
if ($ModsOverride) {
|
||||||
|
Write-Log "-> Running (overriding default): Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements --override $ModsOverride"
|
||||||
|
& $Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements --override $ModsOverride | Tee-Object -file $LogFile -Append
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Log "-> Running: Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements -h"
|
||||||
|
& $Winget install --id $($app.Id) --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append
|
||||||
|
}
|
||||||
|
|
||||||
if ($ModsInstall) {
|
if ($ModsInstall) {
|
||||||
Write-Log "Modifications for $($app.Id) during install are being applied..." "Yellow"
|
Write-Log "Modifications for $($app.Id) during install are being applied..." "Yellow"
|
||||||
|
|
Loading…
Reference in New Issue