Untitled

 avatar
unknown
powershell
2 years ago
882 B
5
Indexable
$repo = "https://github.com/Alex313031/Thorium-AVX2"

$releaseManifest = Invoke-WebRequest "$repo/releases/latest" -Headers @{"Accept"="application/json"}
$json = $releaseManifest.Content | ConvertFrom-Json
$latestVersion = $json.tag_name
$localVersion = (Get-Content localVersion 2>$null)

Write-Host "Local: $localVersion Latest: $latestVersion"

if ($localVersion -ne $latestVersion)
{ 
	$url = "$repo/releases/download/$latestVersion/thorium_AVX2_mini_installer.exe"
	#aria2c -x4 --continue=true $url
	iwr $url -OutFile thorium_AVX2_mini_installer.exe
	#Start-BitsTransfer $url
	
	try {		
		.\thorium_AVX2_mini_installer.exe
		#Remove-Item "thorium_AVX2_mini_installer.exe"; 
		$latestVersion | Out-File localVersion
		
		Write-Host Done!
	} catch {
		Write-Host Failed to update - Figure it out!:
		Write-Warning $_.Exception.Message
	}
}

timeout 3
Editor is loading...