-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
62 lines (52 loc) · 2.18 KB
/
install.ps1
File metadata and controls
62 lines (52 loc) · 2.18 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
# HPP Hub CLI installer for Windows PowerShell
# Usage: irm https://raw.githubusercontent.com/hpp-io/hpphub-cli/main/install.ps1 | iex
$ErrorActionPreference = "Stop"
$repo = "hpp-io/hpphub-cli"
$installDir = "$env:LOCALAPPDATA\hpphub"
$binaryName = "hpphub.exe"
# Check Execution Policy
$policy = Get-ExecutionPolicy -Scope CurrentUser
if ($policy -eq "Restricted" -or $policy -eq "AllSigned") {
Write-Host ""
Write-Host " PowerShell execution policy is '$policy'." -ForegroundColor Yellow
Write-Host " hpphub requires 'RemoteSigned' or less restrictive." -ForegroundColor Yellow
Write-Host ""
Write-Host " Run this command first:" -ForegroundColor Cyan
Write-Host " Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned" -ForegroundColor White
Write-Host ""
exit 1
}
Write-Host "Fetching latest release..." -ForegroundColor Cyan
try {
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases/latest"
$tag = $release.tag_name
} catch {
Write-Host "Error: Could not determine latest release" -ForegroundColor Red
exit 1
}
$arch = if ([Environment]::Is64BitOperatingSystem) { "amd64" } else { "386" }
$asset = "hpphub-windows-$arch.exe"
$downloadUrl = "https://github.com/$repo/releases/download/$tag/$asset"
Write-Host "Downloading hpphub $tag for windows/$arch..." -ForegroundColor Cyan
try {
if (-not (Test-Path $installDir)) {
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
}
$outPath = Join-Path $installDir $binaryName
Invoke-WebRequest -Uri $downloadUrl -OutFile $outPath
} catch {
Write-Host "Error: Download failed - $_" -ForegroundColor Red
exit 1
}
# Add to PATH if not already there
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -notlike "*$installDir*") {
[Environment]::SetEnvironmentVariable("Path", "$userPath;$installDir", "User")
Write-Host " Added $installDir to PATH" -ForegroundColor Yellow
}
Write-Host ""
Write-Host " hpphub $tag installed to $outPath" -ForegroundColor Green
Write-Host ""
Write-Host " Restart your terminal, then run:" -ForegroundColor Cyan
Write-Host " hpphub launch openclaw"
Write-Host ""