Created
March 12, 2018 20:47
-
-
Save jpda/aa900fd7ac119fe5b83927e7957bb923 to your computer and use it in GitHub Desktop.
chromium win64 updater
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [string]$InstallDir = "drive:\path\to\folder\chrome-win32", | |
| [switch]$Verbose = $false | |
| ) | |
| $rootDir = $InstallDir | |
| $latest = Invoke-WebRequest -Uri "https://www.googleapis.com/storage/v1/b/chromium-browser-snapshots/o/Win_x64%2FLAST_CHANGE" -Verbose:$Verbose | |
| $data = ConvertFrom-Json -InputObject $latest.Content | |
| $build = $data.metadata.'cr-commit-position-number' | |
| Write-Host Latest is $build, looking for your version... | |
| $manifest = gci $rootDir\*.build-number | select BaseName | |
| $update = $TRUE | |
| if($manifest){ | |
| Write-Host Found yours, $manifest.BaseName | |
| #$update = $manifest -lt $build.BaseName | |
| } | |
| Write-Host Update: $update | |
| if($update -eq $FALSE) {return;} | |
| $tempFile = "{0}/chrome-{1}.zip" -f $env:TEMP, $build | |
| $ProgressPreference = 'SilentlyContinue' | |
| invoke-webrequest -uri "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Win_x64%2F$build%2Fchrome-win32.zip?alt=media" -OutFile $tempFile -Verbose:$Verbose | |
| $ProgressPreference = 'Continue' | |
| Write-Host Downloaded, expanding to $rootDir\.. | |
| Remove-Item -Path $rootDir\* -Recurse -Exclude *.build-number -Force -Verbose:$Verbose | |
| Expand-Archive -Path $tempFile -DestinationPath $rootDir\.. -Force -Verbose:$Verbose | |
| Remove-Item -Path $rootDir\*.build-number -Force | |
| New-Item -Path $rootDir\$build.build-number -Force | |
| Remove-Item -Path $tempFile -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment