/
chocolateyInstall.ps1
50 lines (41 loc) · 1.84 KB
/
chocolateyInstall.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$ErrorActionPreference = 'Stop'
# This is the general install script for Mozilla products (Firefox and Thunderbird).
# This file must be identical for all Choco packages for Mozilla products in this repository.
$toolsPath = Split-Path $MyInvocation.MyCommand.Definition
. $toolsPath\helpers.ps1
$packageName = 'Firefox'
$softwareName = 'Mozilla Firefox'
$alreadyInstalled = (AlreadyInstalled -product $softwareName -version '58.0.1')
if (Get-32bitOnlyInstalled -product $softwareName) {
Write-Output $(
'Detected the 32-bit version of Firefox on a 64-bit system. ' +
'This package will continue to install the 32-bit version of Firefox ' +
'unless the 32-bit version is uninstalled.'
)
}
if ($alreadyInstalled -and ($env:ChocolateyForce -ne $true)) {
Write-Output $(
"Firefox is already installed. " +
'No need to download an re-install again.'
)
} else {
$locale = 'en-US' #https://github.com/chocolatey/chocolatey-coreteampackages/issues/933
$locale = GetLocale -localeFile "$toolsPath\LanguageChecksums.csv" -product $softwareName
$checksums = GetChecksums -language $locale -checksumFile "$toolsPath\LanguageChecksums.csv"
$packageArgs = @{
packageName = $packageName
fileType = 'exe'
softwareName = "$softwareName*"
Checksum = $checksums.Win32
ChecksumType = 'sha512'
Url = "https://download-installer.cdn.mozilla.net/pub/firefox/releases/58.0.1/win32/${locale}/Firefox%20Setup%2058.0.1.exe"
silentArgs = '-ms'
validExitCodes = @(0)
}
if (!(Get-32bitOnlyInstalled($softwareName)) -and (Get-OSArchitectureWidth 64)) {
$packageArgs.Checksum64 = $checksums.Win64
$packageArgs.ChecksumType64 = 'sha512'
$packageArgs.Url64 = "https://download-installer.cdn.mozilla.net/pub/firefox/releases/58.0.1/win64/${locale}/Firefox%20Setup%2058.0.1.exe"
}
Install-ChocolateyPackage @packageArgs
}