mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-25 15:31:31 -06:00
Remove redundant update checking code in Get-WinUtilUpdates
This commit is contained in:
parent
20d64fdbcd
commit
af2fd17afb
@ -98,14 +98,11 @@ function Get-WinUtilUpdates {
|
|||||||
$RemoteWinUtilVersion = (([regex]($VersionExtractionRegEx)).Match($RawWinUtilScript).Groups[2].Value)
|
$RemoteWinUtilVersion = (([regex]($VersionExtractionRegEx)).Match($RawWinUtilScript).Groups[2].Value)
|
||||||
$LocalWinUtilVersion = (([regex]($VersionExtractionRegEx)).Match((Get-Content $WinUtilScriptPath)).Groups[2].Value)
|
$LocalWinUtilVersion = (([regex]($VersionExtractionRegEx)).Match((Get-Content $WinUtilScriptPath)).Groups[2].Value)
|
||||||
|
|
||||||
# If WinUtil has been modified since the last time it was launched, download a fresh copy of the script.
|
# Check if WinUtil needs an update and either download a fresh copy or notify the user its already up-to-date.
|
||||||
if ([version]$RemoteWinUtilVersion -ne [version]$LocalWinUtilVersion) {
|
if ([version]$RemoteWinUtilVersion -ne [version]$LocalWinUtilVersion) {
|
||||||
Write-Host "WinUtil is out-of-date. Downloading WinUtil '$($RemoteWinUtilVersion)'..." -ForegroundColor DarkYellow
|
Write-Host "WinUtil is out-of-date. Downloading WinUtil '$($RemoteWinUtilVersion)'..." -ForegroundColor DarkYellow
|
||||||
Invoke-RestMethod $WinUtilReleaseURL -OutFile $WinUtilScriptPath
|
Invoke-RestMethod $WinUtilReleaseURL -OutFile $WinUtilScriptPath
|
||||||
}
|
} else {
|
||||||
|
|
||||||
# If WinUtil has not been modified, skip updating the script and let the user know it is already up-to-date.
|
|
||||||
if ([version]$RemoteWinUtilVersion -eq [version]$LocalWinUtilVersion) {
|
|
||||||
Write-Host "WinUtil is already up-to-date. Skipped update checking." -ForegroundColor Yellow
|
Write-Host "WinUtil is already up-to-date. Skipped update checking." -ForegroundColor Yellow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user