-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.ps1
More file actions
51 lines (40 loc) · 1.42 KB
/
install.ps1
File metadata and controls
51 lines (40 loc) · 1.42 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
50
51
#!/usr/bin/env pwsh
# Copyright 2019-2025 the Deno authors. All rights reserved. MIT license.
# Copyright 2025 runreal. All rights reserved. MIT license.
# Adopted from https://github.com/denoland/deno_install
$ErrorActionPreference = 'Stop'
if ($v) {
$Version = "v${v}"
}
if ($Args.Length -eq 1) {
$Version = $Args.Get(0)
}
$RunrealInstall = $env:RUNREAL_INSTALL
$BinDir = if ($RunrealInstall) {
"${RunrealInstall}\bin"
} else {
"${Home}\.runreal\bin"
}
$RunrealExe = "$BinDir\runreal.exe"
$Target = 'win-x64'
$Version = if (!$Version) {
curl.exe --ssl-revoke-best-effort -s "https://api.github.com/repos/runreal/cli/releases/latest" |
ConvertFrom-Json |
Select-Object -ExpandProperty tag_name
} else {
$Version
}
Write-Output "Installing runreal ${Version} for ${Target}"
$DownloadUrl = "https://github.com/runreal/cli/releases/download/${Version}/runreal-${Target}.exe"
if (!(Test-Path $BinDir)) {
New-Item $BinDir -ItemType Directory | Out-Null
}
curl.exe --ssl-revoke-best-effort -Lo $RunrealExe $DownloadUrl
$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 "runreal was installed successfully to ${RunrealExe}"
Write-Output "Run 'runreal --help' to get started"