-
Notifications
You must be signed in to change notification settings - Fork 9
/
install.ps1
40 lines (29 loc) · 1002 Bytes
/
install.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
#!/usr/bin/env pwsh
$ErrorActionPreference = 'Stop'
$DuneRoot = $env:DUNE_ROOT
$BinDir = if ($DuneInstall) {
"$DuneRoot\bin"
}
else {
"$Home\.dune\bin"
}
$DuneZip = "$BinDir\dune.zip"
$DuneExe = "$BinDir\dune.exe"
$Target = 'x86_64-pc-windows-msvc'
# GitHub requires TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$DuneUri = "https://github.com/aalykiot/dune/releases/latest/download/dune-${Target}.zip"
if (!(Test-Path $BinDir)) {
New-Item $BinDir -ItemType Directory | Out-Null
}
curl.exe -Lo $DuneZip $DuneUri
tar.exe xf $DuneZip -C $BinDir
Remove-Item $DuneZip
$User = [EnvironmentVariableTarget]::User
$Path = [Environment]::GetEnvironmentVariable('Path', $User)
if (!(";$Path;".ToLower() -like "*;$BinDir;*".ToLower())) {
[Environment]::SetEnvironmentVariable('Path', "$Path;$BinDir", $User)
$Env:Path += ";$BinDir"
}
Write-Output "Dune was installed successfully to $DuneExe"
Write-Output "Run 'dune --help' to get started"