-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
50 lines (38 loc) · 1.3 KB
/
install.ps1
File metadata and controls
50 lines (38 loc) · 1.3 KB
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
#!/usr/bin/env pwsh
$ErrorActionPreferece = 'Stop'
if ($v) {
$Version = "v${v}"
}
if ($Args.Length -eq 1) {
$Version = $Args.Get(0)
}
$LunaticInstall = $env:LUNATIC_INSTALL
Write-Output "HELLO WORLD ${LunaticInstall}"
$BinDir = if ($LunaticInstall) {
"${LunaticInstall}\bin"
} else {
"${Home}\.lunatic\bin"
}
$LunaticZip = "$BinDir\lunatic.zip"
$LunaticExe = "$BinDir\lunatic.exe"
$Target = "windows-amd64"
$DownloadUrl = if (!$Version) {
"https://github.com/lunatic-solutions/lunatic/releases/latest/download/lunatic-${Target}.zip"
} else {
"https://github.com/lunatic-solutions/lunatic/releases/download/${Version}/lunatic-${Target}.zip"
}
if (!(Test-Path $BinDir)) {
New-Item $BinDir -ItemType Directory | Out-Null
}
curl.exe -Lo $LunaticZip $DownloadUrl
tar.exe xf $LunaticZip -C $BinDir
Remove-Item $LunaticZip
$User = [System.EnvironmentVariableTarget]::User
$Path = [System.Environment]::GetEnvironmentVariable('Path', $User)
if (!(";${Path};".ToLower() -like "*;${BinDir};*".ToLower())) {
[System.Environment]::SetEnvironmentVariable('Path', "${Path};${BinDir}", $User)
$Env:Path += ";${BinDir}"
}
Write-Output "Lunatic was installed successfully to ${LunaticExe}"
Write-Output "Run 'lunatic --help' to get started"
Write-Output "Stuck? Join our Discord https://discord.gg/fZR5wxNp"