wingetautoupdate/Winget-AutoUpdate/functions/Get-WAUUpdateStatus.ps1

29 lines
953 B
PowerShell
Raw Normal View History

2022-04-13 16:50:06 +00:00
#Function to get WAU Update configurations
2022-03-22 13:39:01 +00:00
function Get-WAUUpdateStatus{
2022-03-26 15:02:00 +00:00
2022-03-22 13:39:01 +00:00
[xml]$UpdateStatus = Get-Content "$WorkingDir\config\config.xml" -Encoding UTF8 -ErrorAction SilentlyContinue
2022-03-26 15:02:00 +00:00
#Check if AutoUpdate is enabled
2022-03-26 21:27:11 +00:00
if ($true -eq [System.Convert]::ToBoolean($UpdateStatus.app.WAUautoupdate)){
2022-04-13 16:50:06 +00:00
2022-03-27 10:20:33 +00:00
Write-Log "WAU AutoUpdate is Enabled. Current version : $WAUCurrentVersion" "Green"
2022-03-26 15:02:00 +00:00
$Script:WAUautoupdate = $true
#Check if pre-release versions are enabled
2022-03-26 21:27:11 +00:00
if ($true -eq [System.Convert]::ToBoolean($UpdateStatus.app.WAUprerelease)){
2022-03-27 10:20:33 +00:00
Write-Log "WAU AutoUpdate Pre-release versions is Enabled" "Cyan"
2022-03-26 15:02:00 +00:00
$Script:WAUprerelease = $true
}
else{
$Script:WAUprerelease = $false
}
2022-04-13 16:50:06 +00:00
2022-03-22 13:39:01 +00:00
}
else{
2022-04-13 16:50:06 +00:00
2022-03-27 10:20:33 +00:00
Write-Log "WAU AutoUpdate is Disabled. Current version : $WAUCurrentVersion" "Grey"
2022-03-26 15:02:00 +00:00
$Script:WAUautoupdate = $false
2022-04-13 16:50:06 +00:00
2022-03-22 13:39:01 +00:00
}
}