-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall.ps1
More file actions
237 lines (192 loc) · 12.1 KB
/
Copy pathinstall.ps1
File metadata and controls
237 lines (192 loc) · 12.1 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# ═══════════════════════════════════════════════════════════════════
# COLDSTAR AUTO-INSTALLER (Windows/PowerShell)
# One-command installation for all dependencies
# ═══════════════════════════════════════════════════════════════════
$ErrorActionPreference = "Stop"
Write-Host ""
Write-Host "╔════════════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
Write-Host "║ COLDSTAR - AUTO INSTALLER ║" -ForegroundColor Cyan
Write-Host "║ Installing all dependencies automatically... ║" -ForegroundColor Cyan
Write-Host "╚════════════════════════════════════════════════════════════════╝" -ForegroundColor Cyan
Write-Host ""
# ═══════════════════════════════════════════════════════════════════
# STEP 1: Check/Install Python
# ═══════════════════════════════════════════════════════════════════
Write-Host "━━━━ Step 1: Checking Python... ━━━━" -ForegroundColor Yellow
$pythonInstalled = $false
try {
$pythonVersion = python --version 2>&1
if ($pythonVersion -match "Python 3\.([7-9]|[1-9][0-9])") {
Write-Host "✓ Python already installed: $pythonVersion" -ForegroundColor Green
$pythonInstalled = $true
}
} catch {
# Python not found
}
if (-not $pythonInstalled) {
Write-Host "⚠ Python not found. Installing Python..." -ForegroundColor Yellow
# Check if winget is available
if (Get-Command winget -ErrorAction SilentlyContinue) {
Write-Host " Using winget to install Python..." -ForegroundColor Cyan
try {
winget install Python.Python.3.12 --silent --accept-source-agreements --accept-package-agreements
Write-Host "✓ Python installed successfully!" -ForegroundColor Green
# Refresh environment variables
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
} catch {
Write-Host "❌ Failed to install Python via winget" -ForegroundColor Red
Write-Host "Please install Python manually from: https://www.python.org/downloads/" -ForegroundColor Red
exit 1
}
} else {
Write-Host "❌ winget not available. Please install Python manually:" -ForegroundColor Red
Write-Host " Download from: https://www.python.org/downloads/" -ForegroundColor Yellow
Write-Host " Or install winget (Windows Package Manager) first" -ForegroundColor Yellow
exit 1
}
}
Write-Host ""
# ═══════════════════════════════════════════════════════════════════
# STEP 2: Check/Install Rust
# ═══════════════════════════════════════════════════════════════════
Write-Host "━━━━ Step 2: Checking Rust/Cargo... ━━━━" -ForegroundColor Yellow
$rustInstalled = $false
try {
$cargoVersion = cargo --version 2>&1
Write-Host "✓ Rust/Cargo already installed: $cargoVersion" -ForegroundColor Green
$rustInstalled = $true
} catch {
# Rust not found
}
if (-not $rustInstalled) {
Write-Host "⚠ Rust not found. Installing Rust..." -ForegroundColor Yellow
# Check if winget is available for Rust installation
if (Get-Command winget -ErrorAction SilentlyContinue) {
Write-Host " Using winget to install Rust..." -ForegroundColor Cyan
try {
winget install Rustlang.Rustup --silent --accept-source-agreements --accept-package-agreements
Write-Host "✓ Rustup installed successfully!" -ForegroundColor Green
# Refresh environment variables
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
# Add cargo to current session path
$env:Path += ";$env:USERPROFILE\.cargo\bin"
} catch {
Write-Host "❌ Failed to install Rust via winget" -ForegroundColor Red
Write-Host "Trying alternative installation method..." -ForegroundColor Yellow
# Download and run rustup-init.exe
$rustupUrl = "https://win.rustup.rs/x86_64"
$rustupPath = "$env:TEMP\rustup-init.exe"
Write-Host " Downloading rustup-init.exe..." -ForegroundColor Cyan
Invoke-WebRequest -Uri $rustupUrl -OutFile $rustupPath
Write-Host " Running rustup installer..." -ForegroundColor Cyan
Start-Process -FilePath $rustupPath -ArgumentList "-y" -Wait -NoNewWindow
# Add cargo to path
$env:Path += ";$env:USERPROFILE\.cargo\bin"
Write-Host "✓ Rust installed successfully!" -ForegroundColor Green
}
} else {
# Fallback to direct download
Write-Host " Downloading rustup installer..." -ForegroundColor Cyan
$rustupUrl = "https://win.rustup.rs/x86_64"
$rustupPath = "$env:TEMP\rustup-init.exe"
Invoke-WebRequest -Uri $rustupUrl -OutFile $rustupPath
Write-Host " Running rustup installer..." -ForegroundColor Cyan
Start-Process -FilePath $rustupPath -ArgumentList "-y" -Wait -NoNewWindow
# Add cargo to path
$env:Path += ";$env:USERPROFILE\.cargo\bin"
Write-Host "✓ Rust installed successfully!" -ForegroundColor Green
}
}
Write-Host ""
# ═══════════════════════════════════════════════════════════════════
# STEP 3: Install Python Dependencies
# ═══════════════════════════════════════════════════════════════════
Write-Host "━━━━ Step 3: Installing Python dependencies... ━━━━" -ForegroundColor Yellow
# Check if pip is available
try {
python -m pip --version | Out-Null
Write-Host "✓ pip is available" -ForegroundColor Green
} catch {
Write-Host " Installing pip..." -ForegroundColor Cyan
python -m ensurepip --upgrade
}
# Install Python packages
if (Test-Path "local_requirements.txt") {
Write-Host " Installing from local_requirements.txt..." -ForegroundColor Cyan
python -m pip install -r local_requirements.txt --quiet
Write-Host "✓ Python dependencies installed" -ForegroundColor Green
} elseif (Test-Path "requirements.txt") {
Write-Host " Installing from requirements.txt..." -ForegroundColor Cyan
python -m pip install -r requirements.txt --quiet
Write-Host "✓ Python dependencies installed" -ForegroundColor Green
} else {
Write-Host " No requirements file found, installing common dependencies..." -ForegroundColor Cyan
python -m pip install solana solders --quiet
Write-Host "✓ Common dependencies installed" -ForegroundColor Green
}
Write-Host ""
# ═══════════════════════════════════════════════════════════════════
# STEP 4: Build Rust Components
# ═══════════════════════════════════════════════════════════════════
Write-Host "━━━━ Step 4: Building Rust components... ━━━━" -ForegroundColor Yellow
# Check for secure_signer directory
if (Test-Path "secure_signer") {
Write-Host " Building secure_signer..." -ForegroundColor Cyan
Push-Location secure_signer
cargo build --release
Pop-Location
Write-Host "✓ secure_signer built successfully!" -ForegroundColor Green
}
# Check for rust_signer directory (alternative name)
if (Test-Path "rust_signer") {
Write-Host " Building rust_signer..." -ForegroundColor Cyan
Push-Location rust_signer
cargo build --release
Pop-Location
Write-Host "✓ rust_signer built successfully!" -ForegroundColor Green
}
Write-Host ""
# ═══════════════════════════════════════════════════════════════════
# STEP 5: Verify Installation
# ═══════════════════════════════════════════════════════════════════
Write-Host "━━━━ Step 5: Verifying installation... ━━━━" -ForegroundColor Yellow
$allGood = $true
# Check Python
try {
$pythonVer = python --version
Write-Host "✓ Python: $pythonVer" -ForegroundColor Green
} catch {
Write-Host "❌ Python verification failed" -ForegroundColor Red
$allGood = $false
}
# Check Rust
try {
$cargoVer = cargo --version
Write-Host "✓ Cargo: $cargoVer" -ForegroundColor Green
} catch {
Write-Host "❌ Cargo verification failed" -ForegroundColor Red
$allGood = $false
}
Write-Host ""
# ═══════════════════════════════════════════════════════════════════
# COMPLETION
# ═══════════════════════════════════════════════════════════════════
if ($allGood) {
Write-Host "╔════════════════════════════════════════════════════════════════╗" -ForegroundColor Green
Write-Host "║ ✓ INSTALLATION COMPLETE! ║" -ForegroundColor Green
Write-Host "╚════════════════════════════════════════════════════════════════╝" -ForegroundColor Green
Write-Host ""
Write-Host "You can now run the application with:" -ForegroundColor Cyan
Write-Host " python main.py" -ForegroundColor Yellow
Write-Host ""
Write-Host "Or run the quickstart script:" -ForegroundColor Cyan
Write-Host " .\quickstart.ps1" -ForegroundColor Yellow
Write-Host ""
} else {
Write-Host "╔════════════════════════════════════════════════════════════════╗" -ForegroundColor Red
Write-Host "║ ⚠ INSTALLATION HAD ERRORS ║" -ForegroundColor Red
Write-Host "╚════════════════════════════════════════════════════════════════╝" -ForegroundColor Red
Write-Host ""
Write-Host "Please check the errors above and try again." -ForegroundColor Yellow
exit 1
}