-
Notifications
You must be signed in to change notification settings - Fork 176
/
install-v1.ps1
59 lines (45 loc) · 2.18 KB
/
install-v1.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
51
52
53
54
55
56
57
58
59
#Requires -Version 5
<#
.SYNOPSIS
Download and install the latest available v1 FOSSA release from GitHub.
#>
[CmdletBinding()]
Param()
$OldEAP = $ErrorActionPreference #Preserve the original value
$ErrorActionPreference = "Stop"
$release_v1_upperbound="v1.1.10"
$releaseVersionSemver = $release_v1_upperbound.TrimStart("v");
$github = "https://github.com"
$extractDir = "$env:ALLUSERSPROFILE\fossa-cli"
Write-host "`n"
Write-Host "-------------------"
Write-Host "Deprecation Warning"
Write-Host "-------------------"
Write-host "`n"
Write-Host "You are installing FOSSA CLI v1, which is no longer in active"
Write-Host "development. FOSSA will not address new defects found in CLI v1."
Write-host "`n"
Write-Host "Please upgrade to the latest FOSSA CLI."
Write-host "`n"
Write-Host "Please upgrade to FOSSA CLI v3 by using install-latest script:"
Write-Host "--------------------------------------------------------------"
Write-Host " Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/fossas/fossa-cli/master/install-latest.ps1'))"
Write-host "`n"
Write-Host "Migration guide for FOSSA CLI v3:"
Write-Host "---------------------------------"
Write-Host " https://github.com/fossas/fossa-cli/blob/master/docs/differences-from-v1.md#how-to-upgrade-to-fossa-3x"
Write-host "`n"
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$downloadPath = "fossas/fossa-cli/releases/download/$($release_v1_upperbound)/fossa-cli_$($releaseVersionSemver)_windows_amd64.zip"
$downloadUri = "$github/$downloadPath"
Write-Verbose "Downloading from: $downloadUri"
$TempDir = Join-Path ([System.IO.Path]::GetTempPath()) "fossa-cli"
if (![System.IO.Directory]::Exists($TempDir)) {[void][System.IO.Directory]::CreateDirectory($TempDir)}
$zipFile = "$TempDir\fossa-cli.zip"
(New-Object System.Net.WebClient).DownloadFile($downloadUri, $zipFile)
Expand-Archive -Path $zipFile -DestinationPath $extractDir -Force
$ErrorActionPreference = $OldEAP
$fossa = "$extractDir\fossa.exe"
Write-Host "Installed fossa-cli at: $fossa"
Write-Host "Get started by running: fossa.exe --help"
Write-Output $fossa