-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Romanitho/white-list
White list option
- Loading branch information
Showing
7 changed files
with
147 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0"?> | ||
<app> | ||
<name>Winget-AutoUpdate (WAU)</name> | ||
<version>1.6.3</version> | ||
<version>1.7.0</version> | ||
<author>Romanitho</author> | ||
<info>https://github.com/Romanitho/Winget-AutoUpdate</info> | ||
</app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function Get-IncludedApps{ | ||
if (Test-Path "$WorkingDir\included_apps.txt"){ | ||
return Get-Content -Path "$WorkingDir\included_apps.txt" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function Get-WAUConfig{ | ||
|
||
[xml]$WAUConfig = Get-Content "$WorkingDir\config\config.xml" -Encoding UTF8 -ErrorAction SilentlyContinue | ||
|
||
#Check if WAU is configured for Black or White List | ||
if ($true -eq [System.Convert]::ToBoolean($WAUConfig.app.UseWAUWhiteList)){ | ||
Write-Log "WAU uses White List config" | ||
$Script:UseWhiteList = $true | ||
} | ||
else{ | ||
Write-Log "WAU uses Black List config" | ||
$Script:UseWhiteList = $false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Function Update-App ($app) { | ||
|
||
#Send available update notification | ||
Write-Log "Updating $($app.Name) from $($app.Version) to $($app.AvailableVersion)..." "Cyan" | ||
$Title = $NotifLocale.local.outputs.output[2].title -f $($app.Name) | ||
$Message = $NotifLocale.local.outputs.output[2].message -f $($app.Version), $($app.AvailableVersion) | ||
$MessageType = "info" | ||
$Balise = $($app.Name) | ||
Start-NotifTask $Title $Message $MessageType $Balise | ||
|
||
#Winget upgrade | ||
Write-Log "########## WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID '$($App.Id)' ##########" "Gray" | ||
#Run Winget Upgrade command | ||
& $Winget upgrade --id $($app.Id) --all --accept-package-agreements --accept-source-agreements -h | Tee-Object -file $LogFile -Append | ||
|
||
#Check if application updated properly | ||
$CheckOutdated = Get-WingetOutdatedApps | ||
$FailedToUpgrade = $false | ||
foreach ($CheckApp in $CheckOutdated){ | ||
if ($($CheckApp.Id) -eq $($app.Id)) { | ||
#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 | ||
#Check if application installed properly | ||
$CheckOutdated2 = Get-WingetOutdatedApps | ||
foreach ($CheckApp2 in $CheckOutdated2){ | ||
if ($($CheckApp2.Id) -eq $($app.Id)) { | ||
$FailedToUpgrade = $true | ||
} | ||
} | ||
} | ||
} | ||
Write-Log "########## WINGET UPGRADE PROCESS FINISHED FOR APPLICATION ID '$($App.Id)' ##########" "Gray" | ||
|
||
#Notify installation | ||
if ($FailedToUpgrade -eq $false){ | ||
#Send success updated app notification | ||
Write-Log "$($app.Name) updated to $($app.AvailableVersion) !" "Green" | ||
|
||
#Send Notif | ||
$Title = $NotifLocale.local.outputs.output[3].title -f $($app.Name) | ||
$Message = $NotifLocale.local.outputs.output[3].message -f $($app.AvailableVersion) | ||
$MessageType = "success" | ||
$Balise = $($app.Name) | ||
Start-NotifTask $Title $Message $MessageType $Balise | ||
|
||
$InstallOK += 1 | ||
} | ||
else { | ||
#Send failed updated app notification | ||
Write-Log "$($app.Name) update failed." "Red" | ||
|
||
#Send Notif | ||
$Title = $NotifLocale.local.outputs.output[4].title -f $($app.Name) | ||
$Message = $NotifLocale.local.outputs.output[4].message | ||
$MessageType = "error" | ||
$Balise = $($app.Name) | ||
Start-NotifTask $Title $Message $MessageType $Balise | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters