fix(chrome installers): Check for existence

- Don't launch Chrome installers if they're already
    installed
 - Heuristic for Canary is a path check
 - Heuristic for dev channel is path check + reg key
This commit is contained in:
Iristyle
2013-04-03 12:28:08 -04:00
parent 2f854eaadf
commit 8d03388413
4 changed files with 49 additions and 8 deletions

View File

@@ -2,9 +2,25 @@ $package = 'Chrome.Canary'
try {
$url = 'https://dl.google.com/tag/s/appguid%3D%7B4ea16ac7-fd5a-47c3-875b-dbf4a2008c20%7D%26iid%3D%7B0281A7E2-6043-D983-8BBA-7FD622493C9D%7D%26lang%3Den%26browser%3D4%26usagestats%3D1%26appname%3DGoogle%2520Chrome%2520Canary%26needsadmin%3Dfalse/update2/installers/ChromeSetup.exe'
function Get-CurrentDirectory
{
$thisName = $MyInvocation.MyCommand.Name
[IO.Path]::GetDirectoryName((Get-Content function:$thisName).File)
}
Install-ChocolateyPackage 'ChromeSetup' 'exe' '' $url
. (Join-Path (Get-CurrentDirectory) 'ChromeHelpers.ps1')
$installedPath = Get-ChromePath -Canary
if (Test-Path $installedPath)
{
Write-Host "Chrome Canary already installed at $installedPath"
}
else
{
$url = 'https://dl.google.com/tag/s/appguid%3D%7B4ea16ac7-fd5a-47c3-875b-dbf4a2008c20%7D%26iid%3D%7B0281A7E2-6043-D983-8BBA-7FD622493C9D%7D%26lang%3Den%26browser%3D4%26usagestats%3D1%26appname%3DGoogle%2520Chrome%2520Canary%26needsadmin%3Dfalse/update2/installers/ChromeSetup.exe'
Install-ChocolateyPackage 'ChromeSetup' 'exe' '' $url
}
Write-ChocolateySuccess $package
} catch {