@xaidenlabs/uso 1.1.21 â 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +1 -1
- package/package.json +1 -1
- package/solana-install.exe +0 -0
- package/src/platforms/windows.js +37 -20
package/bin/index.js
CHANGED
package/package.json
CHANGED
|
Binary file
|
package/src/platforms/windows.js
CHANGED
|
@@ -2,6 +2,7 @@ const shell = require('shelljs');
|
|
|
2
2
|
const { log, spinner } = require('../utils/logger');
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
5
6
|
|
|
6
7
|
const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
|
|
7
8
|
log.header("đĒ Windows detected.");
|
|
@@ -41,24 +42,38 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
|
|
|
41
42
|
|
|
42
43
|
if (!hasCl && hasCppTools) {
|
|
43
44
|
log.warn("â ī¸ C++ Build Tools are installed but 'cl.exe' is not in PATH.");
|
|
44
|
-
log.warn("
|
|
45
|
-
|
|
45
|
+
log.warn(" This WILL cause Rust installation to fail with error 0xc0e90002 or similar.");
|
|
46
|
+
log.warn("đ SOLUTION: Close this terminal and open 'Developer Command Prompt for VS 2022' (or similar).");
|
|
47
|
+
log.warn(" Then run `uso init` inside that prompt.");
|
|
48
|
+
// We give a chance to continue, but valid warning is given.
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
|
|
52
|
+
// Use specific temp directory to bypass AppLocker on Desktop
|
|
53
|
+
const tempDir = os.tmpdir();
|
|
54
|
+
const rustInstallerPath = path.join(tempDir, 'rustup-init.exe');
|
|
55
|
+
const solanaInstallerPath = path.join(tempDir, 'solana-install.exe');
|
|
56
|
+
|
|
49
57
|
// 2. Install Rust
|
|
50
58
|
if (shouldInstallRust) {
|
|
51
59
|
log.info("đĻ Installing Rust (rustup-init.exe)...");
|
|
52
|
-
|
|
60
|
+
log.info(` Downloading to: ${rustInstallerPath}`);
|
|
61
|
+
|
|
62
|
+
shell.exec(`powershell -Command "Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe -OutFile '${rustInstallerPath}'"`);
|
|
53
63
|
|
|
54
64
|
// Unblock the file (Robust)
|
|
55
|
-
|
|
65
|
+
log.info("âšī¸ Debug: Attempting to unblock rustup-init.exe...");
|
|
66
|
+
const unblock = shell.exec(`powershell -Command "Unblock-File -Path '${rustInstallerPath}'"`);
|
|
67
|
+
|
|
56
68
|
if (unblock.code !== 0) {
|
|
57
69
|
log.warn("â ī¸ Failed to unblock rustup-init.exe. Trying elevated...");
|
|
58
|
-
shell.exec(
|
|
70
|
+
shell.exec(`powershell -Command "Start-Process powershell -ArgumentList 'Unblock-File -Path \\"${rustInstallerPath}\\"' -Verb RunAs -Wait"`);
|
|
71
|
+
} else {
|
|
72
|
+
log.info("âšī¸ Debug: Successfully unblocked rustup-init.exe");
|
|
59
73
|
}
|
|
60
74
|
|
|
61
|
-
|
|
75
|
+
// Run from temp
|
|
76
|
+
const rustInstall = shell.exec(`powershell -Command "& '${rustInstallerPath}' -y"`);
|
|
62
77
|
|
|
63
78
|
if (rustInstall.code !== 0) {
|
|
64
79
|
log.warn("â ī¸ Rust installer finished with a non-zero code. It might have succeeded if you saw 'Rust is installed now'.");
|
|
@@ -66,8 +81,8 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
|
|
|
66
81
|
log.success("â
Rust installed.");
|
|
67
82
|
}
|
|
68
83
|
|
|
69
|
-
if (fs.existsSync(
|
|
70
|
-
|
|
84
|
+
if (fs.existsSync(rustInstallerPath)) {
|
|
85
|
+
try { fs.unlinkSync(rustInstallerPath); } catch (e) { }
|
|
71
86
|
}
|
|
72
87
|
} else {
|
|
73
88
|
log.info("đĻ Rust is already installed. Skipping.");
|
|
@@ -76,16 +91,20 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
|
|
|
76
91
|
// 3. Install Solana CLI (Agave)
|
|
77
92
|
if (shouldInstallSolana) {
|
|
78
93
|
log.info("âī¸ Installing Solana CLI (Agave)...");
|
|
79
|
-
log.info(
|
|
94
|
+
log.info(` Downloading to: ${solanaInstallerPath}`);
|
|
80
95
|
|
|
81
|
-
const downloadCmd =
|
|
96
|
+
const downloadCmd = `powershell -Command "Invoke-WebRequest -Uri https://release.anza.xyz/stable/solana-install-init-x86_64-pc-windows-msvc.exe -OutFile '${solanaInstallerPath}'"`;
|
|
82
97
|
const dlResult = shell.exec(downloadCmd);
|
|
83
98
|
|
|
84
99
|
// Unblock the file (Robust)
|
|
85
|
-
|
|
100
|
+
log.info("âšī¸ Debug: Attempting to unblock solana-install.exe...");
|
|
101
|
+
const unblockSolana = shell.exec(`powershell -Command "Unblock-File -Path '${solanaInstallerPath}'"`);
|
|
102
|
+
|
|
86
103
|
if (unblockSolana.code !== 0) {
|
|
87
104
|
log.warn("â ī¸ Failed to unblock solana-install.exe via Unblock-File. Trying elevated...");
|
|
88
|
-
shell.exec(
|
|
105
|
+
shell.exec(`powershell -Command "Start-Process powershell -ArgumentList 'Unblock-File -Path \\"${solanaInstallerPath}\\"' -Verb RunAs -Wait"`);
|
|
106
|
+
} else {
|
|
107
|
+
log.info("âšī¸ Debug: Successfully unblocked solana-install.exe");
|
|
89
108
|
}
|
|
90
109
|
|
|
91
110
|
if (dlResult.code !== 0) {
|
|
@@ -94,23 +113,21 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
|
|
|
94
113
|
}
|
|
95
114
|
|
|
96
115
|
// Try regular install first
|
|
97
|
-
// Try regular install first (Silently to catch 1314 error without scaring user)
|
|
98
116
|
log.info(" Running Solana Installer...");
|
|
99
|
-
const installResult = shell.exec(
|
|
117
|
+
const installResult = shell.exec(`"${solanaInstallerPath}" stable`, { silent: true });
|
|
100
118
|
|
|
101
119
|
// Check for Symlink Error (1314) for potential auto-elevation
|
|
102
120
|
if (installResult.code !== 0) {
|
|
103
121
|
const output = installResult.stderr + installResult.stdout;
|
|
104
122
|
|
|
105
|
-
if (output.includes("os error 1314")) {
|
|
106
|
-
log.info("âšī¸ Privilege escalation required
|
|
123
|
+
if (output.includes("os error 1314") || output.includes("blocked by your organization") || output.includes("Device Guard") || output.includes("Application Control policy")) {
|
|
124
|
+
log.info("âšī¸ Privilege escalation required (Symlinks or Device Guard).");
|
|
107
125
|
log.info("đĄī¸ Triggering Run as Administrator (UAC)...");
|
|
108
126
|
log.info("đ Please click 'Yes' in the popup window to allow the installer.");
|
|
109
127
|
|
|
110
|
-
const absPath = path.resolve('solana-install.exe');
|
|
111
128
|
// Use Start-Process with -Verb RunAs to trigger elevation
|
|
112
129
|
// -Wait ensures we actually wait for it to finish
|
|
113
|
-
const elevateCmd = `powershell -Command "Start-Process -FilePath '${
|
|
130
|
+
const elevateCmd = `powershell -Command "Start-Process -FilePath '${solanaInstallerPath}' -ArgumentList 'stable' -Verb RunAs -Wait"`;
|
|
114
131
|
|
|
115
132
|
const elevatedRun = shell.exec(elevateCmd);
|
|
116
133
|
|
|
@@ -134,8 +151,8 @@ const installWindows = async (shouldInstallRust, shouldInstallSolana) => {
|
|
|
134
151
|
log.success("â
Solana CLI installed.");
|
|
135
152
|
}
|
|
136
153
|
|
|
137
|
-
if (fs.existsSync(
|
|
138
|
-
|
|
154
|
+
if (fs.existsSync(solanaInstallerPath)) {
|
|
155
|
+
try { fs.unlinkSync(solanaInstallerPath); } catch (e) { }
|
|
139
156
|
}
|
|
140
157
|
} else {
|
|
141
158
|
log.info("âī¸ Solana CLI is already installed. Skipping.");
|