Untitled

mail@pastecode.io avatar
unknown
powershell
a year ago
882 B
1
Indexable
Never
$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