Repository navigation
Expand file tree
/
Copy pathinstall.ps1
More file actions
67 lines (57 loc) · 2.99 KB
/
Copy pathinstall.ps1
File metadata and controls
67 lines (57 loc) · 2.99 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Rustboard installer — Windows PowerShell
# Usage (run in an elevated or user PowerShell):
# irm https://raw.githubusercontent.com/meliani/Rustboard/main/install.ps1 | iex
#
# Or specify a custom install directory:
# $env:RUSTBOARD_DIR = "$HOME\.rustboard\bin"; irm https://raw.githubusercontent.com/meliani/Rustboard/main/install.ps1 | iex
$ErrorActionPreference = "Stop"
$Repo = "meliani/Rustboard"
$InstDir = if ($env:RUSTBOARD_DIR) { $env:RUSTBOARD_DIR } else { "$env:LOCALAPPDATA\Rustboard\bin" }
$Bins = @("rustboard-core", "rustboard-cli")
$Suffix = "windows-x86_64"
function Write-Info { param($m) Write-Host "[rustboard] $m" -ForegroundColor Cyan }
function Write-Ok { param($m) Write-Host "[rustboard] $m" -ForegroundColor Green }
function Write-Fail { param($m) Write-Host "[rustboard] $m" -ForegroundColor Red; exit 1 }
# ── resolve latest release ────────────────────────────────────────────────────
Write-Info "Fetching latest release from GitHub..."
try {
$release = Invoke-RestMethod "https://api.github.com/repos/$Repo/releases/latest"
} catch {
Write-Fail "Could not fetch release info: $_"
}
$Tag = $release.tag_name
if (-not $Tag) { Write-Fail "Could not determine latest release tag." }
Write-Info "Latest release: $Tag"
# ── download & install ────────────────────────────────────────────────────────
if (-not (Test-Path $InstDir)) {
New-Item -ItemType Directory -Path $InstDir -Force | Out-Null
}
foreach ($Bin in $Bins) {
$Asset = "${Bin}-${Suffix}.exe"
$Url = "https://github.com/$Repo/releases/download/$Tag/$Asset"
$Dest = Join-Path $InstDir "${Bin}.exe"
Write-Info "Downloading $Asset..."
try {
Invoke-WebRequest -Uri $Url -OutFile $Dest -UseBasicParsing
} catch {
Write-Fail "Failed to download $Asset from $Url`n$_"
}
Write-Ok "Installed: $Dest"
}
# ── add to user PATH if needed ────────────────────────────────────────────────
$UserPath = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($UserPath -notlike "*$InstDir*") {
[Environment]::SetEnvironmentVariable("PATH", "$UserPath;$InstDir", "User")
Write-Ok "Added $InstDir to your user PATH (restart terminal to apply)"
} else {
Write-Info "$InstDir is already in PATH"
}
# ── summary ───────────────────────────────────────────────────────────────────
Write-Ok "Rustboard $Tag installed to $InstDir"
Write-Host ""
Write-Host " Run the dashboard:"
Write-Host " rustboard-core.exe config\services.yaml"
Write-Host ""
Write-Host " Use the CLI:"
Write-Host " rustboard-cli.exe list"
Write-Host ""