diff --git a/README.md b/README.md index 1afbe7b7..21b185ad 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,9 @@ You can use [Winget-Install](https://github.com/Romanitho/Winget-AutoUpdate/blob **Mods for WAU** allows you to craft a script to do whatever you like via `_WAU-mods.ps1` in the **mods** folder.
This script executes **if the network is active/any version of Winget is installed/WAU is running as SYSTEM**.
If **ExitCode** is **1** from `_WAU-mods.ps1` then **Re-run WAU**. + +Likewise `_WAU-mods-postsys.ps1` can be used to do things at the end of the **SYSTEM context WAU** process before the user run. + ## Custom scripts (Mods feature for Apps) The Mods feature allows you to run additional scripts when upgrading or installing an app. Just put the scripts in question with the **AppID** followed by the `-preinstall`, `-upgrade`, `-install`, `-installed` or `-notinstalled` suffix in the **mods** folder. diff --git a/Sources/Winget-AutoUpdate/Winget-Install.ps1 b/Sources/Winget-AutoUpdate/Winget-Install.ps1 index 28a23176..aa3572d5 100644 --- a/Sources/Winget-AutoUpdate/Winget-Install.ps1 +++ b/Sources/Winget-AutoUpdate/Winget-Install.ps1 @@ -69,7 +69,7 @@ $realPath = if ($scriptItem.LinkType) { . "$realPath\functions\Get-WingetCmd.ps1" . "$realPath\functions\Write-ToLog.ps1" . "$realPath\functions\Confirm-Installation.ps1" - +. "$realPath\functions\Compare-SemVer.ps1" #Check if App exists in Winget Repository function Confirm-Exist ($AppID) { @@ -225,7 +225,7 @@ function Uninstall-App ($AppID, $AppArgs) { #Uninstall App Write-ToLog "-> Uninstalling $AppID..." "Yellow" - $WingetArgs = "uninstall --id $AppID -e --accept-source-agreements -h" -split " " + $WingetArgs = "uninstall --id $AppID -e --accept-source-agreements -h $AppArgs" -split " " Write-ToLog "-> Running: `"$Winget`" $WingetArgs" & "$Winget" $WingetArgs | Where-Object { $_ -notlike " *" } | Tee-Object -file $LogFile -Append diff --git a/Sources/Winget-AutoUpdate/functions/Test-Mods.ps1 b/Sources/Winget-AutoUpdate/functions/Test-Mods.ps1 index bcede835..a3c6938e 100644 --- a/Sources/Winget-AutoUpdate/functions/Test-Mods.ps1 +++ b/Sources/Winget-AutoUpdate/functions/Test-Mods.ps1 @@ -22,10 +22,10 @@ function Test-Mods ($app) { $ModsPreInstall = "$Mods\$app-preinstall.ps1" } if (Test-Path "$Mods\$app-override.txt") { - $ModsOverride = Get-Content "$Mods\$app-override.txt" -Raw + $ModsOverride = (Get-Content "$Mods\$app-override.txt" -Raw).Trim() } if (Test-Path "$Mods\$app-custom.txt") { - $ModsCustom = Get-Content "$Mods\$app-custom.txt" -Raw + $ModsCustom = (Get-Content "$Mods\$app-custom.txt" -Raw).Trim() } if (Test-Path "$Mods\$app-install.ps1") { $ModsInstall = "$Mods\$app-install.ps1"