parent
fb73eee55d
commit
002921c645
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<app>
|
<app>
|
||||||
<name>Winget-AutoUpdate (WAU)</name>
|
<name>Winget-AutoUpdate (WAU)</name>
|
||||||
<version>1.6.2</version>
|
<version>1.6.3</version>
|
||||||
<author>Romanitho</author>
|
<author>Romanitho</author>
|
||||||
<info>https://github.com/Romanitho/Winget-AutoUpdate</info>
|
<info>https://github.com/Romanitho/Winget-AutoUpdate</info>
|
||||||
</app>
|
</app>
|
||||||
|
|
|
@ -4,12 +4,12 @@ function Get-WAUUpdateStatus{
|
||||||
|
|
||||||
#Check if AutoUpdate is enabled
|
#Check if AutoUpdate is enabled
|
||||||
if ($true -eq [System.Convert]::ToBoolean($UpdateStatus.app.WAUautoupdate)){
|
if ($true -eq [System.Convert]::ToBoolean($UpdateStatus.app.WAUautoupdate)){
|
||||||
Write-Log "WAU AutoUpdate is enabled" "Green"
|
Write-Log "WAU AutoUpdate is Enabled. Current version : $WAUCurrentVersion" "Green"
|
||||||
$Script:WAUautoupdate = $true
|
$Script:WAUautoupdate = $true
|
||||||
|
|
||||||
#Check if pre-release versions are enabled
|
#Check if pre-release versions are enabled
|
||||||
if ($true -eq [System.Convert]::ToBoolean($UpdateStatus.app.WAUprerelease)){
|
if ($true -eq [System.Convert]::ToBoolean($UpdateStatus.app.WAUprerelease)){
|
||||||
Write-Log "WAU AutoUpdate Pre-release enabled" "Cyan"
|
Write-Log "WAU AutoUpdate Pre-release versions is Enabled" "Cyan"
|
||||||
$Script:WAUprerelease = $true
|
$Script:WAUprerelease = $true
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -17,7 +17,7 @@ function Get-WAUUpdateStatus{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Write-Log "WAU AutoUpdate is Disabled" "Grey"
|
Write-Log "WAU AutoUpdate is Disabled. Current version : $WAUCurrentVersion" "Grey"
|
||||||
$Script:WAUautoupdate = $false
|
$Script:WAUautoupdate = $false
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,33 +14,32 @@ function Update-WAU {
|
||||||
New-Item $ZipFile -ItemType File -Force | Out-Null
|
New-Item $ZipFile -ItemType File -Force | Out-Null
|
||||||
|
|
||||||
#Download the zip
|
#Download the zip
|
||||||
Write-Log "Starting downloading the GitHub Repository version $WAUAvailableVersion"
|
Write-Log "Downloading the GitHub Repository version $WAUAvailableVersion" "Cyan"
|
||||||
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/archive/refs/tags/v$($WAUAvailableVersion).zip/" -OutFile $ZipFile
|
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/archive/refs/tags/v$($WAUAvailableVersion).zip/" -OutFile $ZipFile
|
||||||
Write-Log "Download finished" "Green"
|
|
||||||
|
|
||||||
#Extract Zip File
|
#Extract Zip File
|
||||||
Write-Log "Starting unzipping the WAU GitHub Repository"
|
Write-Log "Unzipping the WAU GitHub Repository" "Cyan"
|
||||||
$location = "$WorkingDir\WAU_update"
|
$location = "$WorkingDir\WAU_update"
|
||||||
Expand-Archive -Path $ZipFile -DestinationPath $location -Force
|
Expand-Archive -Path $ZipFile -DestinationPath $location -Force
|
||||||
Get-ChildItem -Path $location -Recurse | Unblock-File
|
Get-ChildItem -Path $location -Recurse | Unblock-File
|
||||||
Write-Log "Unzip finished" "Green"
|
Write-Log "Updating WAU" "Yellow"
|
||||||
$TempPath = (Resolve-Path "$location\*\Winget-AutoUpdate\")[0].Path
|
$TempPath = (Resolve-Path "$location\*\Winget-AutoUpdate\")[0].Path
|
||||||
if ($TempPath){
|
if ($TempPath){
|
||||||
Copy-Item -Path "$TempPath\*" -Destination "$WorkingDir\" -Exclude "icons" -Recurse -Force
|
Copy-Item -Path "$TempPath\*" -Destination "$WorkingDir\" -Exclude "icons" -Recurse -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
#Remove update zip file
|
#Remove update zip file and update temp folder
|
||||||
Write-Log "Cleaning temp files"
|
Write-Log "Done. Cleaning temp files" "Cyan"
|
||||||
Remove-Item -Path $ZipFile -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $ZipFile -Force -ErrorAction SilentlyContinue
|
||||||
#Remove update folder
|
|
||||||
Remove-Item -Path $location -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $location -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
#Set new version to about.xml
|
#Set new version to 'about.xml'
|
||||||
[xml]$XMLconf = Get-content "$WorkingDir\config\about.xml" -Encoding UTF8 -ErrorAction SilentlyContinue
|
[xml]$XMLconf = Get-content "$WorkingDir\config\about.xml" -Encoding UTF8 -ErrorAction SilentlyContinue
|
||||||
$XMLconf.app.version = $WAUAvailableVersion
|
$XMLconf.app.version = $WAUAvailableVersion
|
||||||
$XMLconf.Save("$WorkingDir\config\about.xml")
|
$XMLconf.Save("$WorkingDir\config\about.xml")
|
||||||
|
|
||||||
#Send success Notif
|
#Send success Notif
|
||||||
|
Write-Log "WAU Update completed." "Green"
|
||||||
$Title = $NotifLocale.local.outputs.output[3].title -f "Winget-AutoUpdate"
|
$Title = $NotifLocale.local.outputs.output[3].title -f "Winget-AutoUpdate"
|
||||||
$Message = $NotifLocale.local.outputs.output[3].message -f $WAUAvailableVersion
|
$Message = $NotifLocale.local.outputs.output[3].message -f $WAUAvailableVersion
|
||||||
$MessageType = "success"
|
$MessageType = "success"
|
||||||
|
@ -59,6 +58,6 @@ function Update-WAU {
|
||||||
$MessageType = "error"
|
$MessageType = "error"
|
||||||
$Balise = "Winget-AutoUpdate"
|
$Balise = "Winget-AutoUpdate"
|
||||||
Start-NotifTask $Title $Message $MessageType $Balise
|
Start-NotifTask $Title $Message $MessageType $Balise
|
||||||
Write-Log "WAU Update failed"
|
Write-Log "WAU Update failed" "Red"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,13 +25,13 @@ if (Test-Network){
|
||||||
#Get Available Version
|
#Get Available Version
|
||||||
Get-WAUAvailableVersion
|
Get-WAUAvailableVersion
|
||||||
#Compare
|
#Compare
|
||||||
if ($WAUAvailableVersion -gt $WAUCurrentVersion){
|
if ([version]$WAUAvailableVersion -gt [version]$WAUCurrentVersion){
|
||||||
#If new version is available, update it
|
#If new version is available, update it
|
||||||
Write-Log "WAU Current version: $WAUCurrentVersion - Available version: $WAUAvailableVersion" "Yellow"
|
Write-Log "WAU Available version: $WAUAvailableVersion" "Yellow"
|
||||||
Update-WAU
|
Update-WAU
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Write-Log "WAU Current version : $WAUCurrentVersion - Up to date." "Green"
|
Write-Log "WAU is up to date." "Green"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ if (Test-Network){
|
||||||
$toSkip = Get-ExcludedApps
|
$toSkip = Get-ExcludedApps
|
||||||
|
|
||||||
#Get outdated Winget packages
|
#Get outdated Winget packages
|
||||||
Write-Log "Checking available updates..." "yellow"
|
Write-Log "Checking application updates on Winget Repository..." "yellow"
|
||||||
$outdated = Get-WingetOutdatedApps
|
$outdated = Get-WingetOutdatedApps
|
||||||
|
|
||||||
#Log list of app to update
|
#Log list of app to update
|
||||||
|
|
Loading…
Reference in New Issue