-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
70 lines (59 loc) · 3.58 KB
/
Copy pathinstall.ps1
File metadata and controls
70 lines (59 loc) · 3.58 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
68
69
70
# MemCloud Windows Installer
$ErrorActionPreference = "Stop"
Write-Host "╔══════════════════════════════════════════════════════════════╗" -ForegroundColor Magenta
Write-Host "║ ║" -ForegroundColor Magenta
Write-Host "║ ☁ M E M C L O U D I N S T A L L E R ⚡ ║" -ForegroundColor Magenta
Write-Host "║ ║" -ForegroundColor Magenta
Write-Host "║ 'Turning nearby devices into your personal RAM farm.' ║" -ForegroundColor Magenta
Write-Host "║ ║" -ForegroundColor Magenta
Write-Host "╚══════════════════════════════════════════════════════════════╝" -ForegroundColor Magenta
Write-Host ""
function Log-Info { param([string]$msg); Write-Host "➤ $msg" -ForegroundColor Cyan }
function Log-Success { param([string]$msg); Write-Host "✔ $msg" -ForegroundColor Green }
function Log-Error { param([string]$msg); Write-Host "✖ $msg" -ForegroundColor Red }
Log-Info "Initializing MemCloud deployment sequence..."
# 1. Fetch Latest Version
Log-Info "Fetching latest release version..."
try {
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/vibhanshu2001/memcloud/releases/latest"
$version = $release.tag_name
Log-Info "Detected latest version: $version"
} catch {
Log-Error "Failed to fetch latest version. Using fallback v0.1.0"
$version = "v0.1.0"
}
# 2. Determine Paths
$installDir = "$env:USERPROFILE\.memcloud\bin"
if (!(Test-Path -Path $installDir)) {
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
}
$zipUrl = "https://github.com/vibhanshu2001/memcloud/releases/download/$version/memcloud-x86_64-pc-windows-msvc.zip"
$zipPath = "$env:TEMP\memcloud.zip"
# 3. Download
Log-Info "Downloading from $zipUrl..."
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath
# 4. Extract
Log-Info "Extracting to $installDir..."
Expand-Archive -Path $zipPath -DestinationPath $installDir -Force
# 5. Clean up
Remove-Item $zipPath -Force
# 6. Add to PATH if needed
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -notlike "*$installDir*") {
Log-Info "Adding $installDir to User PATH..."
[Environment]::SetEnvironmentVariable("Path", "$userPath;$installDir", "User")
Log-Success "Added to PATH (Restart terminal to take effect)"
} else {
Log-Info "$installDir is already in your PATH."
}
Write-Host ""
Log-Success "MemCloud successfully installed! 🚀"
Write-Host ""
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
Write-Host " ✨ You're Ready to Begin:" -ForegroundColor Green
Write-Host " Start daemon: memcli node start --name 'MyDevice'" -ForegroundColor Cyan
Write-Host " Check status: memcli node status" -ForegroundColor Cyan
Write-Host " Stop daemon: memcli node stop" -ForegroundColor Cyan
Write-Host ""
Write-Host " Restart your terminal if 'memcli' is not found." -ForegroundColor Yellow
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"