minor changes

pull/35/head v1.6.3
Romain 2022-03-27 12:20:33 +02:00
parent fb73eee55d
commit 002921c645
4 changed files with 16 additions and 17 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<app>
<name>Winget-AutoUpdate (WAU)</name>
<version>1.6.2</version>
<version>1.6.3</version>
<author>Romanitho</author>
<info>https://github.com/Romanitho/Winget-AutoUpdate</info>
</app>

View File

@ -4,12 +4,12 @@ function Get-WAUUpdateStatus{
#Check if AutoUpdate is enabled
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
#Check if pre-release versions are enabled
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
}
else{
@ -17,7 +17,7 @@ function Get-WAUUpdateStatus{
}
}
else{
Write-Log "WAU AutoUpdate is Disabled" "Grey"
Write-Log "WAU AutoUpdate is Disabled. Current version : $WAUCurrentVersion" "Grey"
$Script:WAUautoupdate = $false
}
}

View File

@ -14,33 +14,32 @@ function Update-WAU {
New-Item $ZipFile -ItemType File -Force | Out-Null
#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
Write-Log "Download finished" "Green"
#Extract Zip File
Write-Log "Starting unzipping the WAU GitHub Repository"
Write-Log "Unzipping the WAU GitHub Repository" "Cyan"
$location = "$WorkingDir\WAU_update"
Expand-Archive -Path $ZipFile -DestinationPath $location -Force
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
if ($TempPath){
Copy-Item -Path "$TempPath\*" -Destination "$WorkingDir\" -Exclude "icons" -Recurse -Force
}
#Remove update zip file
Write-Log "Cleaning temp files"
#Remove update zip file and update temp folder
Write-Log "Done. Cleaning temp files" "Cyan"
Remove-Item -Path $ZipFile -Force -ErrorAction SilentlyContinue
#Remove update folder
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
$XMLconf.app.version = $WAUAvailableVersion
$XMLconf.Save("$WorkingDir\config\about.xml")
#Send success Notif
Write-Log "WAU Update completed." "Green"
$Title = $NotifLocale.local.outputs.output[3].title -f "Winget-AutoUpdate"
$Message = $NotifLocale.local.outputs.output[3].message -f $WAUAvailableVersion
$MessageType = "success"
@ -59,6 +58,6 @@ function Update-WAU {
$MessageType = "error"
$Balise = "Winget-AutoUpdate"
Start-NotifTask $Title $Message $MessageType $Balise
Write-Log "WAU Update failed"
Write-Log "WAU Update failed" "Red"
}
}

View File

@ -25,13 +25,13 @@ if (Test-Network){
#Get Available Version
Get-WAUAvailableVersion
#Compare
if ($WAUAvailableVersion -gt $WAUCurrentVersion){
if ([version]$WAUAvailableVersion -gt [version]$WAUCurrentVersion){
#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
}
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
#Get outdated Winget packages
Write-Log "Checking available updates..." "yellow"
Write-Log "Checking application updates on Winget Repository..." "yellow"
$outdated = Get-WingetOutdatedApps
#Log list of app to update