Merge pull request #672 from Romanitho/msi-prerequisites
[MSI Prerequisites] Check for msi version as well during WAU updatepull/675/head
commit
471b836805
|
@ -13,13 +13,14 @@ function Update-WAU {
|
||||||
|
|
||||||
#Run WAU update
|
#Run WAU update
|
||||||
try {
|
try {
|
||||||
|
#Try WAU.zip (v1)
|
||||||
|
|
||||||
#Force to create a zip file
|
#Force to create a zip file
|
||||||
$ZipFile = "$WorkingDir\WAU_update.zip"
|
$ZipFile = "$WorkingDir\WAU_update.zip"
|
||||||
New-Item $ZipFile -ItemType File -Force | Out-Null
|
New-Item $ZipFile -ItemType File -Force | Out-Null
|
||||||
|
|
||||||
#Download the zip
|
#Download the zip
|
||||||
Write-ToLog "Downloading the GitHub Repository version $WAUAvailableVersion" "Cyan"
|
Write-ToLog "Downloading the GitHub Repository Zip version $WAUAvailableVersion" "Cyan"
|
||||||
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUAvailableVersion)/WAU.zip" -OutFile $ZipFile
|
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUAvailableVersion)/WAU.zip" -OutFile $ZipFile
|
||||||
|
|
||||||
#Extract Zip File
|
#Extract Zip File
|
||||||
|
@ -66,6 +67,31 @@ function Update-WAU {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
catch {
|
||||||
|
|
||||||
|
#Try WAU.msi (v2)
|
||||||
|
try {
|
||||||
|
#Download the msi
|
||||||
|
Write-ToLog "Downloading the GitHub Repository MSI version $WAUAvailableVersion" "Cyan"
|
||||||
|
$MsiFile = "$env:temp\WAU.msi"
|
||||||
|
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUAvailableVersion)/WAU.msi" -OutFile $MsiFile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Update WAU and run
|
||||||
|
Write-ToLog "Updating WAU..." "Yellow"
|
||||||
|
Start-Process msiexec.exe -ArgumentList "/i $MsiFile /qn /L*v ""$WorkingDir\logs\WAU-Installer.log"" RUN_WAU=YES" -Wait
|
||||||
|
|
||||||
|
#Send success Notif
|
||||||
|
Write-ToLog "WAU Update completed. Rerunning WAU..." "Green"
|
||||||
|
$Title = $NotifLocale.local.outputs.output[3].title -f "Winget-AutoUpdate"
|
||||||
|
$Message = $NotifLocale.local.outputs.output[3].message -f $WAUAvailableVersion
|
||||||
|
$MessageType = "success"
|
||||||
|
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Button1Action $OnClickAction -Button1Text $Button1Text
|
||||||
|
|
||||||
|
Exit 0
|
||||||
|
}
|
||||||
|
|
||||||
catch {
|
catch {
|
||||||
|
|
||||||
#Send Error Notif
|
#Send Error Notif
|
||||||
|
@ -76,5 +102,6 @@ function Update-WAU {
|
||||||
Write-ToLog "WAU Update failed" "Red"
|
Write-ToLog "WAU Update failed" "Red"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue