Skip to content

Commit 829d98d

Browse files
authored
Merge pull request #886 from KnifMelti/hotfix/trimraw
Get-Content TRIM for -override/-custom
2 parents 9affe62 + 5b00ea4 commit 829d98d

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ You can use [Winget-Install](https://github.com/Romanitho/Winget-AutoUpdate/blob
184184
**Mods for WAU** allows you to craft a script to do whatever you like via `_WAU-mods.ps1` in the **mods** folder.<br>
185185
This script executes **if the network is active/any version of Winget is installed/WAU is running as SYSTEM**.<br>
186186
If **ExitCode** is **1** from `_WAU-mods.ps1` then **Re-run WAU**.
187+
188+
Likewise `_WAU-mods-postsys.ps1` can be used to do things at the end of the **SYSTEM context WAU** process before the user run.
189+
187190
## Custom scripts (Mods feature for Apps)
188191
The Mods feature allows you to run additional scripts when upgrading or installing an app.
189192
Just put the scripts in question with the **AppID** followed by the `-preinstall`, `-upgrade`, `-install`, `-installed` or `-notinstalled` suffix in the **mods** folder.

Sources/Winget-AutoUpdate/Winget-Install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ $realPath = if ($scriptItem.LinkType) {
6969
. "$realPath\functions\Get-WingetCmd.ps1"
7070
. "$realPath\functions\Write-ToLog.ps1"
7171
. "$realPath\functions\Confirm-Installation.ps1"
72-
72+
. "$realPath\functions\Compare-SemVer.ps1"
7373

7474
#Check if App exists in Winget Repository
7575
function Confirm-Exist ($AppID) {
@@ -225,7 +225,7 @@ function Uninstall-App ($AppID, $AppArgs) {
225225

226226
#Uninstall App
227227
Write-ToLog "-> Uninstalling $AppID..." "Yellow"
228-
$WingetArgs = "uninstall --id $AppID -e --accept-source-agreements -h" -split " "
228+
$WingetArgs = "uninstall --id $AppID -e --accept-source-agreements -h $AppArgs" -split " "
229229
Write-ToLog "-> Running: `"$Winget`" $WingetArgs"
230230
& "$Winget" $WingetArgs | Where-Object { $_ -notlike " *" } | Tee-Object -file $LogFile -Append
231231

Sources/Winget-AutoUpdate/functions/Test-Mods.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ function Test-Mods ($app) {
2222
$ModsPreInstall = "$Mods\$app-preinstall.ps1"
2323
}
2424
if (Test-Path "$Mods\$app-override.txt") {
25-
$ModsOverride = Get-Content "$Mods\$app-override.txt" -Raw
25+
$ModsOverride = (Get-Content "$Mods\$app-override.txt" -Raw).Trim()
2626
}
2727
if (Test-Path "$Mods\$app-custom.txt") {
28-
$ModsCustom = Get-Content "$Mods\$app-custom.txt" -Raw
28+
$ModsCustom = (Get-Content "$Mods\$app-custom.txt" -Raw).Trim()
2929
}
3030
if (Test-Path "$Mods\$app-install.ps1") {
3131
$ModsInstall = "$Mods\$app-install.ps1"

0 commit comments

Comments
 (0)