@fredlackey/devutils 0.0.13 → 0.0.15
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/README.md +28 -1
- package/package.json +1 -1
- package/src/cli.js +4 -0
- package/src/commands/update.js +142 -0
- package/src/commands/version.js +100 -0
- package/src/installs/cloudflare-warp.js +900 -0
- package/src/installs/cloudflare-warp.md +1047 -0
- package/src/installs/comet-browser.js +588 -0
- package/src/installs/comet-browser.md +731 -0
- package/src/installs/dbeaver.js +924 -0
- package/src/installs/dbeaver.md +939 -0
- package/src/installs/dependencies.md +11 -3
- package/src/installs/google-antigravity.js +913 -0
- package/src/installs/google-antigravity.md +1075 -0
- package/src/installs/installers.json +423 -5
- package/src/installs/installers.json.tmp +3953 -0
- package/src/installs/kiro.js +864 -0
- package/src/installs/kiro.md +1015 -0
- package/src/installs/moom.js +326 -0
- package/src/installs/moom.md +570 -0
- package/src/installs/nordvpn.js +892 -0
- package/src/installs/nordvpn.md +1052 -0
- package/src/installs/parallels-desktop.js +431 -0
- package/src/installs/parallels-desktop.md +446 -0
|
@@ -0,0 +1,900 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Install Cloudflare WARP VPN client across supported platforms.
|
|
5
|
+
* @module installs/cloudflare-warp
|
|
6
|
+
*
|
|
7
|
+
* Cloudflare WARP is a VPN client that encrypts all traffic leaving your device
|
|
8
|
+
* and routes it through Cloudflare's global network. Built on the WireGuard protocol,
|
|
9
|
+
* WARP provides fast, secure connections while protecting your privacy from ISP
|
|
10
|
+
* snooping and network-level tracking.
|
|
11
|
+
*
|
|
12
|
+
* WARP operates in several modes:
|
|
13
|
+
* - WARP mode (default): Encrypts all traffic (including DNS) and routes it through Cloudflare
|
|
14
|
+
* - 1.1.1.1 mode: Only encrypts DNS traffic to Cloudflare's 1.1.1.1 resolver
|
|
15
|
+
* - WARP+ mode: Premium tier with optimized routing through Cloudflare's Argo network
|
|
16
|
+
*
|
|
17
|
+
* This installer provides:
|
|
18
|
+
* - Cloudflare WARP GUI application via Homebrew cask for macOS
|
|
19
|
+
* - Cloudflare WARP daemon via official APT repository for Ubuntu/Debian
|
|
20
|
+
* - Cloudflare WARP via DNF/YUM for Amazon Linux/RHEL
|
|
21
|
+
* - Cloudflare WARP GUI via Chocolatey for Windows
|
|
22
|
+
* - Windows WARP installation from Git Bash via PowerShell
|
|
23
|
+
*
|
|
24
|
+
* IMPORTANT PLATFORM NOTES:
|
|
25
|
+
* - Raspberry Pi OS: WARP is NOT officially supported on ARM Linux architecture
|
|
26
|
+
* - WSL: Recommended to install WARP on Windows host; WSL traffic is automatically protected
|
|
27
|
+
* - After installation, WARP must be manually connected using the GUI or warp-cli
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
const os = require('../utils/common/os');
|
|
31
|
+
const shell = require('../utils/common/shell');
|
|
32
|
+
const brew = require('../utils/macos/brew');
|
|
33
|
+
const choco = require('../utils/windows/choco');
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The Homebrew cask name for Cloudflare WARP on macOS.
|
|
37
|
+
* @constant {string}
|
|
38
|
+
*/
|
|
39
|
+
const HOMEBREW_CASK_NAME = 'cloudflare-warp';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The Chocolatey package name for Cloudflare WARP on Windows.
|
|
43
|
+
* Note: The package is named 'warp' not 'cloudflare-warp' on Chocolatey.
|
|
44
|
+
* @constant {string}
|
|
45
|
+
*/
|
|
46
|
+
const CHOCO_PACKAGE_NAME = 'warp';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The command used to verify WARP CLI installation on Linux systems.
|
|
50
|
+
* @constant {string}
|
|
51
|
+
*/
|
|
52
|
+
const WARP_CLI_COMMAND = 'warp-cli';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The macOS application path where WARP is installed.
|
|
56
|
+
* Used for verification and to locate the bundled warp-cli.
|
|
57
|
+
* @constant {string}
|
|
58
|
+
*/
|
|
59
|
+
const MACOS_APP_PATH = '/Applications/Cloudflare WARP.app';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The path to warp-cli bundled inside the macOS application.
|
|
63
|
+
* @constant {string}
|
|
64
|
+
*/
|
|
65
|
+
const MACOS_WARP_CLI_PATH = '/Applications/Cloudflare WARP.app/Contents/Resources/warp-cli';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Check if the WARP CLI command is available in the system PATH.
|
|
69
|
+
* This performs a quick check that works across Linux platforms.
|
|
70
|
+
*
|
|
71
|
+
* Note: On macOS, warp-cli is bundled inside the application and not in PATH.
|
|
72
|
+
* Use isWarpAppInstalledMacOS() for macOS verification instead.
|
|
73
|
+
*
|
|
74
|
+
* @returns {boolean} True if the warp-cli command is available, false otherwise
|
|
75
|
+
*/
|
|
76
|
+
function isWarpCliCommandAvailable() {
|
|
77
|
+
return shell.commandExists(WARP_CLI_COMMAND);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Check if Cloudflare WARP application is installed on macOS.
|
|
82
|
+
* Checks for the application bundle in /Applications.
|
|
83
|
+
*
|
|
84
|
+
* @returns {boolean} True if WARP app is installed on macOS, false otherwise
|
|
85
|
+
*/
|
|
86
|
+
function isWarpAppInstalledMacOS() {
|
|
87
|
+
const fs = require('fs');
|
|
88
|
+
try {
|
|
89
|
+
return fs.existsSync(MACOS_APP_PATH);
|
|
90
|
+
} catch {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get the installed version of WARP CLI on Linux systems.
|
|
97
|
+
*
|
|
98
|
+
* Executes 'warp-cli --version' to verify WARP is properly installed
|
|
99
|
+
* and retrieve the version number.
|
|
100
|
+
*
|
|
101
|
+
* @returns {Promise<string|null>} WARP version string, or null if not installed
|
|
102
|
+
*/
|
|
103
|
+
async function getWarpCliVersion() {
|
|
104
|
+
if (!isWarpCliCommandAvailable()) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const result = await shell.exec('warp-cli --version');
|
|
109
|
+
if (result.code === 0 && result.stdout) {
|
|
110
|
+
// Output format: "warp-cli 2024.6.555.0 (a1b2c3d4)"
|
|
111
|
+
// Extract just the version number
|
|
112
|
+
const versionMatch = result.stdout.match(/warp-cli\s+([\d.]+)/);
|
|
113
|
+
return versionMatch ? versionMatch[1] : result.stdout.trim();
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get the installed version of WARP on macOS using the bundled warp-cli.
|
|
120
|
+
*
|
|
121
|
+
* @returns {Promise<string|null>} WARP version string, or null if not installed
|
|
122
|
+
*/
|
|
123
|
+
async function getWarpVersionMacOS() {
|
|
124
|
+
if (!isWarpAppInstalledMacOS()) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Use the bundled warp-cli inside the application
|
|
129
|
+
const result = await shell.exec(`"${MACOS_WARP_CLI_PATH}" --version 2>/dev/null`);
|
|
130
|
+
if (result.code === 0 && result.stdout) {
|
|
131
|
+
const versionMatch = result.stdout.match(/warp-cli\s+([\d.]+)/);
|
|
132
|
+
return versionMatch ? versionMatch[1] : result.stdout.trim();
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Install Cloudflare WARP GUI application on macOS using Homebrew.
|
|
139
|
+
*
|
|
140
|
+
* This installs the full Cloudflare WARP desktop application, which includes
|
|
141
|
+
* the GUI (menu bar icon), background daemon, and bundled warp-cli.
|
|
142
|
+
*
|
|
143
|
+
* Prerequisites:
|
|
144
|
+
* - macOS 10.15 (Catalina) or later
|
|
145
|
+
* - Homebrew package manager installed
|
|
146
|
+
* - Apple Silicon (M1/M2/M3/M4) or Intel processor
|
|
147
|
+
*
|
|
148
|
+
* After installation:
|
|
149
|
+
* 1. Launch Cloudflare WARP from Applications or menu bar
|
|
150
|
+
* 2. Grant VPN configuration permission when prompted
|
|
151
|
+
* 3. Enable WARP by clicking the toggle in the menu bar app
|
|
152
|
+
*
|
|
153
|
+
* NOTE: On first launch, WARP will request permission to add VPN configurations.
|
|
154
|
+
* The warp-cli is bundled inside the application at:
|
|
155
|
+
* /Applications/Cloudflare WARP.app/Contents/Resources/warp-cli
|
|
156
|
+
*
|
|
157
|
+
* @returns {Promise<void>}
|
|
158
|
+
*/
|
|
159
|
+
async function install_macos() {
|
|
160
|
+
console.log('Checking if Cloudflare WARP is already installed...');
|
|
161
|
+
|
|
162
|
+
// Check if WARP application is already installed
|
|
163
|
+
if (isWarpAppInstalledMacOS()) {
|
|
164
|
+
const version = await getWarpVersionMacOS();
|
|
165
|
+
if (version) {
|
|
166
|
+
console.log(`Cloudflare WARP ${version} is already installed, skipping installation.`);
|
|
167
|
+
} else {
|
|
168
|
+
console.log('Cloudflare WARP is already installed, skipping installation.');
|
|
169
|
+
}
|
|
170
|
+
console.log('');
|
|
171
|
+
console.log('To launch Cloudflare WARP:');
|
|
172
|
+
console.log(' open -a "Cloudflare WARP"');
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Also check if the cask is installed (WARP may be installed but app not in expected location)
|
|
177
|
+
const caskInstalled = await brew.isCaskInstalled(HOMEBREW_CASK_NAME);
|
|
178
|
+
if (caskInstalled) {
|
|
179
|
+
console.log('Cloudflare WARP is already installed via Homebrew, skipping installation.');
|
|
180
|
+
console.log('');
|
|
181
|
+
console.log('To launch Cloudflare WARP:');
|
|
182
|
+
console.log(' open -a "Cloudflare WARP"');
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Verify Homebrew is available
|
|
187
|
+
if (!brew.isInstalled()) {
|
|
188
|
+
console.log('Homebrew is not installed. Please install Homebrew first.');
|
|
189
|
+
console.log('Run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"');
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
console.log('Installing Cloudflare WARP via Homebrew...');
|
|
194
|
+
|
|
195
|
+
// Install WARP cask with --quiet to suppress non-essential output
|
|
196
|
+
const result = await shell.exec('brew install --quiet --cask cloudflare-warp');
|
|
197
|
+
|
|
198
|
+
if (result.code !== 0) {
|
|
199
|
+
console.log('Failed to install Cloudflare WARP via Homebrew.');
|
|
200
|
+
console.log(result.stderr || result.stdout);
|
|
201
|
+
console.log('');
|
|
202
|
+
console.log('Troubleshooting:');
|
|
203
|
+
console.log(' 1. Run "brew update" and retry');
|
|
204
|
+
console.log(' 2. Try manual installation: brew install --cask cloudflare-warp');
|
|
205
|
+
console.log(' 3. Or download directly from: https://one.one.one.one/');
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Verify installation succeeded
|
|
210
|
+
if (isWarpAppInstalledMacOS()) {
|
|
211
|
+
const version = await getWarpVersionMacOS();
|
|
212
|
+
if (version) {
|
|
213
|
+
console.log(`Cloudflare WARP ${version} installed successfully.`);
|
|
214
|
+
} else {
|
|
215
|
+
console.log('Cloudflare WARP installed successfully.');
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
console.log('Cloudflare WARP installed successfully.');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
console.log('');
|
|
222
|
+
console.log('To complete setup:');
|
|
223
|
+
console.log(' 1. Launch Cloudflare WARP:');
|
|
224
|
+
console.log(' open -a "Cloudflare WARP"');
|
|
225
|
+
console.log('');
|
|
226
|
+
console.log(' 2. Click "Allow" when prompted to add VPN configurations.');
|
|
227
|
+
console.log('');
|
|
228
|
+
console.log(' 3. Look for the WARP icon in the menu bar and click to enable.');
|
|
229
|
+
console.log('');
|
|
230
|
+
console.log('To verify WARP is working:');
|
|
231
|
+
console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | grep warp');
|
|
232
|
+
console.log(' Expected output: warp=on');
|
|
233
|
+
console.log('');
|
|
234
|
+
console.log('NOTE: The warp-cli is bundled inside the application:');
|
|
235
|
+
console.log(' /Applications/Cloudflare\\ WARP.app/Contents/Resources/warp-cli --help');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Install Cloudflare WARP on Ubuntu/Debian using the official APT repository.
|
|
240
|
+
*
|
|
241
|
+
* This function:
|
|
242
|
+
* 1. Installs prerequisites (curl, gpg, lsb-release)
|
|
243
|
+
* 2. Downloads and installs Cloudflare's GPG key
|
|
244
|
+
* 3. Adds the Cloudflare APT repository
|
|
245
|
+
* 4. Installs the cloudflare-warp package
|
|
246
|
+
*
|
|
247
|
+
* Prerequisites:
|
|
248
|
+
* - Ubuntu 20.04 (Focal), 22.04 (Jammy), or 24.04 (Noble)
|
|
249
|
+
* - Debian 10 (Buster) through 13 (Trixie)
|
|
250
|
+
* - 64-bit (x86_64/amd64) architecture only (ARM is NOT supported)
|
|
251
|
+
* - sudo privileges
|
|
252
|
+
*
|
|
253
|
+
* After installation:
|
|
254
|
+
* 1. Register with Cloudflare: warp-cli registration new
|
|
255
|
+
* 2. Connect to WARP: warp-cli connect
|
|
256
|
+
*
|
|
257
|
+
* @returns {Promise<void>}
|
|
258
|
+
*/
|
|
259
|
+
async function install_ubuntu() {
|
|
260
|
+
console.log('Checking if Cloudflare WARP is already installed...');
|
|
261
|
+
|
|
262
|
+
// Check if WARP is already installed
|
|
263
|
+
const existingVersion = await getWarpCliVersion();
|
|
264
|
+
if (existingVersion) {
|
|
265
|
+
console.log(`Cloudflare WARP ${existingVersion} is already installed, skipping installation.`);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Verify architecture - WARP only supports x86_64 on Linux
|
|
270
|
+
const archResult = await shell.exec('uname -m');
|
|
271
|
+
const arch = archResult.stdout.trim();
|
|
272
|
+
if (arch !== 'x86_64') {
|
|
273
|
+
console.log(`Cloudflare WARP is not available for ${arch} architecture.`);
|
|
274
|
+
console.log('WARP only supports 64-bit (x86_64/amd64) on Linux.');
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Ensure prerequisites are installed
|
|
279
|
+
console.log('Installing prerequisites (curl, gpg, lsb-release)...');
|
|
280
|
+
const prereqResult = await shell.exec(
|
|
281
|
+
'sudo DEBIAN_FRONTEND=noninteractive apt-get update -y && ' +
|
|
282
|
+
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl gpg lsb-release'
|
|
283
|
+
);
|
|
284
|
+
if (prereqResult.code !== 0) {
|
|
285
|
+
console.log('Failed to install prerequisites.');
|
|
286
|
+
console.log(prereqResult.stderr);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Step 1: Add the Cloudflare GPG key
|
|
291
|
+
console.log('Adding Cloudflare GPG key...');
|
|
292
|
+
const gpgResult = await shell.exec(
|
|
293
|
+
'curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | ' +
|
|
294
|
+
'sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg'
|
|
295
|
+
);
|
|
296
|
+
if (gpgResult.code !== 0) {
|
|
297
|
+
console.log('Failed to add Cloudflare GPG key.');
|
|
298
|
+
console.log(gpgResult.stderr);
|
|
299
|
+
console.log('');
|
|
300
|
+
console.log('Troubleshooting:');
|
|
301
|
+
console.log(' 1. Ensure you have internet connectivity');
|
|
302
|
+
console.log(' 2. Try running manually:');
|
|
303
|
+
console.log(' curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg');
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Step 2: Add the Cloudflare repository
|
|
308
|
+
console.log('Adding Cloudflare APT repository...');
|
|
309
|
+
const repoResult = await shell.exec(
|
|
310
|
+
'echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] ' +
|
|
311
|
+
'https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | ' +
|
|
312
|
+
'sudo tee /etc/apt/sources.list.d/cloudflare-client.list'
|
|
313
|
+
);
|
|
314
|
+
if (repoResult.code !== 0) {
|
|
315
|
+
console.log('Failed to add Cloudflare repository.');
|
|
316
|
+
console.log(repoResult.stderr);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Step 3: Update package lists and install WARP
|
|
321
|
+
console.log('Updating package lists...');
|
|
322
|
+
const updateResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get update -y');
|
|
323
|
+
if (updateResult.code !== 0) {
|
|
324
|
+
console.log('Failed to update package lists.');
|
|
325
|
+
console.log(updateResult.stderr);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
console.log('Installing cloudflare-warp package...');
|
|
330
|
+
const installResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get install -y cloudflare-warp');
|
|
331
|
+
if (installResult.code !== 0) {
|
|
332
|
+
console.log('Failed to install Cloudflare WARP.');
|
|
333
|
+
console.log(installResult.stderr);
|
|
334
|
+
console.log('');
|
|
335
|
+
console.log('Troubleshooting:');
|
|
336
|
+
console.log(' 1. Verify the repository was added correctly:');
|
|
337
|
+
console.log(' cat /etc/apt/sources.list.d/cloudflare-client.list');
|
|
338
|
+
console.log(' 2. Check if your distribution is supported');
|
|
339
|
+
console.log(' 3. Try running: sudo apt-get update && sudo apt-get install cloudflare-warp');
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Verify installation succeeded
|
|
344
|
+
const version = await getWarpCliVersion();
|
|
345
|
+
if (version) {
|
|
346
|
+
console.log(`Cloudflare WARP ${version} installed successfully.`);
|
|
347
|
+
} else {
|
|
348
|
+
console.log('Cloudflare WARP installed successfully.');
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
console.log('');
|
|
352
|
+
console.log('To complete setup:');
|
|
353
|
+
console.log(' 1. Register with Cloudflare:');
|
|
354
|
+
console.log(' warp-cli registration new');
|
|
355
|
+
console.log('');
|
|
356
|
+
console.log(' 2. Connect to WARP:');
|
|
357
|
+
console.log(' warp-cli connect');
|
|
358
|
+
console.log('');
|
|
359
|
+
console.log('To verify WARP is working:');
|
|
360
|
+
console.log(' warp-cli status');
|
|
361
|
+
console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | grep warp');
|
|
362
|
+
console.log(' Expected output: warp=on');
|
|
363
|
+
console.log('');
|
|
364
|
+
console.log('If warp-cli is not found, start the service:');
|
|
365
|
+
console.log(' sudo systemctl enable --now warp-svc');
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Handle Raspberry Pi OS installation attempt.
|
|
370
|
+
*
|
|
371
|
+
* Cloudflare WARP client is NOT officially supported on ARM Linux architectures.
|
|
372
|
+
* This includes all Raspberry Pi devices running Raspberry Pi OS (both 32-bit
|
|
373
|
+
* and 64-bit).
|
|
374
|
+
*
|
|
375
|
+
* The documentation mentions an unofficial workaround using wgcf with WireGuard,
|
|
376
|
+
* but per project guidelines, we do not suggest alternatives.
|
|
377
|
+
*
|
|
378
|
+
* @returns {Promise<void>}
|
|
379
|
+
*/
|
|
380
|
+
async function install_raspbian() {
|
|
381
|
+
console.log('Cloudflare WARP is not available for Raspberry Pi OS.');
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Install Cloudflare WARP on Amazon Linux/RHEL using DNF or YUM.
|
|
387
|
+
*
|
|
388
|
+
* This function:
|
|
389
|
+
* 1. Detects the package manager (DNF for AL2023/RHEL8+, YUM for AL2/RHEL7)
|
|
390
|
+
* 2. Adds the Cloudflare repository
|
|
391
|
+
* 3. Installs the cloudflare-warp package
|
|
392
|
+
* 4. Enables and starts the warp-svc service
|
|
393
|
+
*
|
|
394
|
+
* Prerequisites:
|
|
395
|
+
* - Amazon Linux 2023 (AL2023), RHEL 8, CentOS 8, or compatible distributions
|
|
396
|
+
* - 64-bit (x86_64) architecture only
|
|
397
|
+
* - sudo privileges
|
|
398
|
+
*
|
|
399
|
+
* After installation:
|
|
400
|
+
* 1. Register with Cloudflare: warp-cli registration new
|
|
401
|
+
* 2. Connect to WARP: warp-cli connect
|
|
402
|
+
*
|
|
403
|
+
* @returns {Promise<void>}
|
|
404
|
+
*/
|
|
405
|
+
async function install_amazon_linux() {
|
|
406
|
+
console.log('Checking if Cloudflare WARP is already installed...');
|
|
407
|
+
|
|
408
|
+
// Check if WARP is already installed
|
|
409
|
+
const existingVersion = await getWarpCliVersion();
|
|
410
|
+
if (existingVersion) {
|
|
411
|
+
console.log(`Cloudflare WARP ${existingVersion} is already installed, skipping installation.`);
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// Detect package manager (dnf for AL2023/RHEL8+, yum for AL2/RHEL7)
|
|
416
|
+
const hasDnf = shell.commandExists('dnf');
|
|
417
|
+
const hasYum = shell.commandExists('yum');
|
|
418
|
+
const packageManager = hasDnf ? 'dnf' : (hasYum ? 'yum' : null);
|
|
419
|
+
|
|
420
|
+
if (!packageManager) {
|
|
421
|
+
console.log('Neither dnf nor yum package manager found.');
|
|
422
|
+
console.log('This installer supports Amazon Linux 2023 (dnf) and Amazon Linux 2 (yum),');
|
|
423
|
+
console.log('as well as RHEL/CentOS 7, 8, and 9.');
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
console.log(`Detected package manager: ${packageManager}`);
|
|
428
|
+
|
|
429
|
+
// Ensure curl is installed
|
|
430
|
+
if (!shell.commandExists('curl')) {
|
|
431
|
+
console.log('Installing curl...');
|
|
432
|
+
const curlResult = await shell.exec(`sudo ${packageManager} install -y curl`);
|
|
433
|
+
if (curlResult.code !== 0) {
|
|
434
|
+
console.log('Failed to install curl. Please install curl manually and retry.');
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// Step 1: Add the Cloudflare repository
|
|
440
|
+
console.log('Adding Cloudflare repository...');
|
|
441
|
+
const repoResult = await shell.exec(
|
|
442
|
+
'curl -fsSl https://pkg.cloudflareclient.com/cloudflare-warp-ascii.repo | ' +
|
|
443
|
+
'sudo tee /etc/yum.repos.d/cloudflare-warp.repo'
|
|
444
|
+
);
|
|
445
|
+
if (repoResult.code !== 0) {
|
|
446
|
+
console.log('Failed to add Cloudflare repository.');
|
|
447
|
+
console.log(repoResult.stderr);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Step 2: Update package cache and install WARP
|
|
452
|
+
console.log('Updating package cache...');
|
|
453
|
+
const updateResult = await shell.exec(`sudo ${packageManager} update -y`);
|
|
454
|
+
if (updateResult.code !== 0) {
|
|
455
|
+
console.log('Warning: Package cache update had issues, continuing with installation...');
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
console.log('Installing cloudflare-warp package...');
|
|
459
|
+
const installResult = await shell.exec(`sudo ${packageManager} install -y cloudflare-warp`);
|
|
460
|
+
if (installResult.code !== 0) {
|
|
461
|
+
console.log('Failed to install Cloudflare WARP.');
|
|
462
|
+
console.log(installResult.stderr);
|
|
463
|
+
console.log('');
|
|
464
|
+
console.log('Troubleshooting:');
|
|
465
|
+
console.log(' 1. Verify the repository was added:');
|
|
466
|
+
console.log(' cat /etc/yum.repos.d/cloudflare-warp.repo');
|
|
467
|
+
console.log(' 2. Try importing the GPG key manually:');
|
|
468
|
+
console.log(' sudo rpm --import https://pkg.cloudflareclient.com/pubkey.gpg');
|
|
469
|
+
console.log(` 3. Retry: sudo ${packageManager} install cloudflare-warp`);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// Step 3: Enable and start the WARP service
|
|
474
|
+
console.log('Enabling and starting warp-svc service...');
|
|
475
|
+
const serviceResult = await shell.exec('sudo systemctl enable --now warp-svc');
|
|
476
|
+
if (serviceResult.code !== 0) {
|
|
477
|
+
console.log('Warning: Could not enable warp-svc service. You may need to start it manually.');
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Verify installation succeeded
|
|
481
|
+
const version = await getWarpCliVersion();
|
|
482
|
+
if (version) {
|
|
483
|
+
console.log(`Cloudflare WARP ${version} installed successfully.`);
|
|
484
|
+
} else {
|
|
485
|
+
console.log('Cloudflare WARP installed successfully.');
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
console.log('');
|
|
489
|
+
console.log('To complete setup:');
|
|
490
|
+
console.log(' 1. Register with Cloudflare:');
|
|
491
|
+
console.log(' warp-cli registration new');
|
|
492
|
+
console.log('');
|
|
493
|
+
console.log(' 2. Connect to WARP:');
|
|
494
|
+
console.log(' warp-cli connect');
|
|
495
|
+
console.log('');
|
|
496
|
+
console.log('To verify WARP is working:');
|
|
497
|
+
console.log(' warp-cli status');
|
|
498
|
+
console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | grep warp');
|
|
499
|
+
console.log(' Expected output: warp=on');
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Install Cloudflare WARP on Windows using Chocolatey.
|
|
504
|
+
*
|
|
505
|
+
* This installs the Cloudflare WARP GUI application for Windows, which includes
|
|
506
|
+
* the graphical interface (system tray icon), background service, and CLI tools.
|
|
507
|
+
*
|
|
508
|
+
* Prerequisites:
|
|
509
|
+
* - Windows 10 version 1909 or later (64-bit)
|
|
510
|
+
* - Administrator PowerShell or Command Prompt
|
|
511
|
+
* - Chocolatey package manager installed
|
|
512
|
+
*
|
|
513
|
+
* After installation, Cloudflare WARP will be available in the Start Menu
|
|
514
|
+
* and system tray. Launch it to complete the initial setup.
|
|
515
|
+
*
|
|
516
|
+
* @returns {Promise<void>}
|
|
517
|
+
*/
|
|
518
|
+
async function install_windows() {
|
|
519
|
+
console.log('Checking if Cloudflare WARP is already installed...');
|
|
520
|
+
|
|
521
|
+
// Check if WARP package is installed via Chocolatey
|
|
522
|
+
const packageInstalled = await choco.isPackageInstalled(CHOCO_PACKAGE_NAME);
|
|
523
|
+
if (packageInstalled) {
|
|
524
|
+
console.log('Cloudflare WARP is already installed via Chocolatey, skipping installation.');
|
|
525
|
+
console.log('');
|
|
526
|
+
console.log('If WARP is not running, launch it from the Start Menu:');
|
|
527
|
+
console.log(' Search for "Cloudflare WARP" and click to launch.');
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Verify Chocolatey is available
|
|
532
|
+
if (!choco.isInstalled()) {
|
|
533
|
+
console.log('Chocolatey is not installed. Please install Chocolatey first.');
|
|
534
|
+
console.log('');
|
|
535
|
+
console.log('Run the following in an Administrator PowerShell:');
|
|
536
|
+
console.log(" Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))");
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
console.log('Installing Cloudflare WARP via Chocolatey...');
|
|
541
|
+
|
|
542
|
+
// Install WARP (package name is 'warp' on Chocolatey)
|
|
543
|
+
const result = await choco.install(CHOCO_PACKAGE_NAME);
|
|
544
|
+
|
|
545
|
+
if (!result.success) {
|
|
546
|
+
console.log('Failed to install Cloudflare WARP via Chocolatey.');
|
|
547
|
+
console.log(result.output);
|
|
548
|
+
console.log('');
|
|
549
|
+
console.log('Troubleshooting:');
|
|
550
|
+
console.log(' 1. Ensure you are running as Administrator');
|
|
551
|
+
console.log(' 2. Try manual installation: choco install warp -y');
|
|
552
|
+
console.log(' 3. Or download from: https://one.one.one.one/');
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
console.log('Cloudflare WARP installed successfully.');
|
|
557
|
+
console.log('');
|
|
558
|
+
console.log('To complete setup:');
|
|
559
|
+
console.log(' 1. Launch Cloudflare WARP from the Start Menu');
|
|
560
|
+
console.log(' 2. Click the WARP icon in the system tray');
|
|
561
|
+
console.log(' 3. Toggle the switch to enable WARP');
|
|
562
|
+
console.log('');
|
|
563
|
+
console.log('To verify WARP is working:');
|
|
564
|
+
console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | findstr warp');
|
|
565
|
+
console.log(' Expected output: warp=on');
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Install Cloudflare WARP on Ubuntu running in WSL (Windows Subsystem for Linux).
|
|
570
|
+
*
|
|
571
|
+
* IMPORTANT: The recommended approach is to install WARP on the Windows host,
|
|
572
|
+
* NOT inside WSL. When WARP runs on Windows, WSL 2 traffic is automatically
|
|
573
|
+
* protected. Installing WARP inside WSL has known issues because Windows WARP
|
|
574
|
+
* uses WinDivert which operates in Windows user-land, and WSL 2's networking
|
|
575
|
+
* bypasses it.
|
|
576
|
+
*
|
|
577
|
+
* This function installs WARP directly within WSL for users who specifically
|
|
578
|
+
* need it running inside the WSL environment.
|
|
579
|
+
*
|
|
580
|
+
* Prerequisites:
|
|
581
|
+
* - Windows 10 version 2004 or later, or Windows 11
|
|
582
|
+
* - WSL 2 installed with Ubuntu distribution
|
|
583
|
+
* - WARP installed on the Windows host (recommended) OR
|
|
584
|
+
* - Following this installation for WARP inside WSL (not recommended)
|
|
585
|
+
*
|
|
586
|
+
* NOTE: WSL does not use systemd by default, so the warp-svc daemon must be
|
|
587
|
+
* started manually with 'sudo warp-svc &' before running 'warp-cli' commands.
|
|
588
|
+
*
|
|
589
|
+
* @returns {Promise<void>}
|
|
590
|
+
*/
|
|
591
|
+
async function install_ubuntu_wsl() {
|
|
592
|
+
console.log('Detected Ubuntu running in WSL (Windows Subsystem for Linux).');
|
|
593
|
+
console.log('');
|
|
594
|
+
console.log('RECOMMENDATION: Install Cloudflare WARP on the Windows host instead.');
|
|
595
|
+
console.log('The Windows WARP client provides network protection that is visible');
|
|
596
|
+
console.log('to WSL 2 automatically. See: choco install warp -y (in Windows)');
|
|
597
|
+
console.log('');
|
|
598
|
+
|
|
599
|
+
// Check if WARP is already installed
|
|
600
|
+
const existingVersion = await getWarpCliVersion();
|
|
601
|
+
if (existingVersion) {
|
|
602
|
+
console.log(`Cloudflare WARP ${existingVersion} is already installed, skipping installation.`);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// Verify architecture - WARP only supports x86_64 on Linux
|
|
607
|
+
const archResult = await shell.exec('uname -m');
|
|
608
|
+
const arch = archResult.stdout.trim();
|
|
609
|
+
if (arch !== 'x86_64') {
|
|
610
|
+
console.log(`Cloudflare WARP is not available for ${arch} architecture.`);
|
|
611
|
+
console.log('WARP only supports 64-bit (x86_64/amd64) on Linux.');
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// Install WARP using same process as Ubuntu
|
|
616
|
+
console.log('Proceeding with Cloudflare WARP installation inside WSL...');
|
|
617
|
+
console.log('');
|
|
618
|
+
|
|
619
|
+
// Ensure prerequisites are installed
|
|
620
|
+
console.log('Installing prerequisites (curl, gpg, lsb-release)...');
|
|
621
|
+
const prereqResult = await shell.exec(
|
|
622
|
+
'sudo DEBIAN_FRONTEND=noninteractive apt-get update -y && ' +
|
|
623
|
+
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl gpg lsb-release'
|
|
624
|
+
);
|
|
625
|
+
if (prereqResult.code !== 0) {
|
|
626
|
+
console.log('Failed to install prerequisites.');
|
|
627
|
+
console.log(prereqResult.stderr);
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// Add the Cloudflare GPG key
|
|
632
|
+
console.log('Adding Cloudflare GPG key...');
|
|
633
|
+
const gpgResult = await shell.exec(
|
|
634
|
+
'curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | ' +
|
|
635
|
+
'sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg'
|
|
636
|
+
);
|
|
637
|
+
if (gpgResult.code !== 0) {
|
|
638
|
+
console.log('Failed to add Cloudflare GPG key.');
|
|
639
|
+
console.log(gpgResult.stderr);
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// Add the Cloudflare repository
|
|
644
|
+
console.log('Adding Cloudflare APT repository...');
|
|
645
|
+
const repoResult = await shell.exec(
|
|
646
|
+
'echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] ' +
|
|
647
|
+
'https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | ' +
|
|
648
|
+
'sudo tee /etc/apt/sources.list.d/cloudflare-client.list'
|
|
649
|
+
);
|
|
650
|
+
if (repoResult.code !== 0) {
|
|
651
|
+
console.log('Failed to add Cloudflare repository.');
|
|
652
|
+
console.log(repoResult.stderr);
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
// Update package lists and install WARP
|
|
657
|
+
console.log('Updating package lists...');
|
|
658
|
+
const updateResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get update -y');
|
|
659
|
+
if (updateResult.code !== 0) {
|
|
660
|
+
console.log('Failed to update package lists.');
|
|
661
|
+
console.log(updateResult.stderr);
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
console.log('Installing cloudflare-warp package...');
|
|
666
|
+
const installResult = await shell.exec('sudo DEBIAN_FRONTEND=noninteractive apt-get install -y cloudflare-warp');
|
|
667
|
+
if (installResult.code !== 0) {
|
|
668
|
+
console.log('Failed to install Cloudflare WARP.');
|
|
669
|
+
console.log(installResult.stderr);
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Verify installation succeeded
|
|
674
|
+
const version = await getWarpCliVersion();
|
|
675
|
+
if (version) {
|
|
676
|
+
console.log(`Cloudflare WARP ${version} installed successfully.`);
|
|
677
|
+
} else {
|
|
678
|
+
console.log('Cloudflare WARP installed successfully.');
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
console.log('');
|
|
682
|
+
console.log('IMPORTANT for WSL users:');
|
|
683
|
+
console.log('');
|
|
684
|
+
console.log('1. WSL does not use systemd by default. Start the daemon manually:');
|
|
685
|
+
console.log(' sudo warp-svc &');
|
|
686
|
+
console.log(' sleep 3');
|
|
687
|
+
console.log('');
|
|
688
|
+
console.log('2. Register with Cloudflare:');
|
|
689
|
+
console.log(' warp-cli registration new');
|
|
690
|
+
console.log('');
|
|
691
|
+
console.log('3. Connect to WARP:');
|
|
692
|
+
console.log(' warp-cli connect');
|
|
693
|
+
console.log('');
|
|
694
|
+
console.log('4. To auto-start warp-svc when WSL launches, add to ~/.bashrc:');
|
|
695
|
+
console.log(' if ! pgrep -x warp-svc > /dev/null; then');
|
|
696
|
+
console.log(' sudo warp-svc > /dev/null 2>&1 &');
|
|
697
|
+
console.log(' sleep 2');
|
|
698
|
+
console.log(' fi');
|
|
699
|
+
console.log('');
|
|
700
|
+
const currentUser = process.env.USER || process.env.USERNAME || 'youruser';
|
|
701
|
+
console.log('5. For passwordless sudo (optional):');
|
|
702
|
+
console.log(` echo "${currentUser} ALL=(ALL) NOPASSWD: /usr/bin/warp-svc" | sudo tee /etc/sudoers.d/warp-svc`);
|
|
703
|
+
console.log(' sudo chmod 0440 /etc/sudoers.d/warp-svc');
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Install Cloudflare WARP from Git Bash on Windows.
|
|
708
|
+
*
|
|
709
|
+
* Git Bash runs within Windows, so this function installs Cloudflare WARP
|
|
710
|
+
* on the Windows host using Chocolatey via PowerShell interop.
|
|
711
|
+
* Once installed, WARP protects all network traffic from the machine,
|
|
712
|
+
* including Git Bash, because it runs as a system-wide VPN.
|
|
713
|
+
*
|
|
714
|
+
* Prerequisites:
|
|
715
|
+
* - Windows 10 or Windows 11 (64-bit)
|
|
716
|
+
* - Git Bash installed (comes with Git for Windows)
|
|
717
|
+
* - Chocolatey package manager installed on Windows
|
|
718
|
+
*
|
|
719
|
+
* @returns {Promise<void>}
|
|
720
|
+
*/
|
|
721
|
+
async function install_gitbash() {
|
|
722
|
+
console.log('Detected Git Bash on Windows.');
|
|
723
|
+
console.log('Installing Cloudflare WARP on the Windows host...');
|
|
724
|
+
console.log('');
|
|
725
|
+
|
|
726
|
+
// Check if Chocolatey is available via Windows path
|
|
727
|
+
const chocoPath = '/c/ProgramData/chocolatey/bin/choco.exe';
|
|
728
|
+
const chocoResult = await shell.exec(`"${chocoPath}" --version 2>/dev/null`);
|
|
729
|
+
|
|
730
|
+
if (chocoResult.code !== 0) {
|
|
731
|
+
console.log('Chocolatey is not installed on Windows.');
|
|
732
|
+
console.log('Please install Chocolatey first, then run this installer again.');
|
|
733
|
+
console.log('');
|
|
734
|
+
console.log('Or download Cloudflare WARP directly from:');
|
|
735
|
+
console.log(' https://one.one.one.one/');
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// Check if WARP is already installed
|
|
740
|
+
const listResult = await shell.exec(`"${chocoPath}" list --local-only --exact warp 2>/dev/null`);
|
|
741
|
+
if (listResult.code === 0 && listResult.stdout.toLowerCase().includes('warp')) {
|
|
742
|
+
console.log('Cloudflare WARP is already installed, skipping installation.');
|
|
743
|
+
console.log('');
|
|
744
|
+
console.log('If WARP is not running, launch it from the Windows Start Menu.');
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
console.log('Installing Cloudflare WARP via Windows Chocolatey...');
|
|
749
|
+
|
|
750
|
+
const installResult = await shell.exec(`"${chocoPath}" install warp -y`);
|
|
751
|
+
|
|
752
|
+
if (installResult.code !== 0) {
|
|
753
|
+
console.log('Failed to install Cloudflare WARP.');
|
|
754
|
+
console.log(installResult.stdout || installResult.stderr);
|
|
755
|
+
console.log('');
|
|
756
|
+
console.log('Troubleshooting:');
|
|
757
|
+
console.log(' 1. Run Git Bash as Administrator and retry');
|
|
758
|
+
console.log(' 2. Try installing directly from PowerShell:');
|
|
759
|
+
console.log(' choco install warp -y');
|
|
760
|
+
console.log(' 3. Or download from: https://one.one.one.one/');
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
console.log('Cloudflare WARP installed successfully.');
|
|
765
|
+
console.log('');
|
|
766
|
+
console.log('To complete setup:');
|
|
767
|
+
console.log(' 1. Launch Cloudflare WARP from the Windows Start Menu');
|
|
768
|
+
console.log(' 2. Click the WARP icon in the system tray');
|
|
769
|
+
console.log(' 3. Toggle the switch to enable WARP');
|
|
770
|
+
console.log('');
|
|
771
|
+
console.log('Git Bash notes:');
|
|
772
|
+
console.log(' - WARP is a system-wide VPN; all traffic (including Git Bash) is protected');
|
|
773
|
+
console.log(' - Look for the WARP icon in the Windows system tray to verify it is running');
|
|
774
|
+
console.log('');
|
|
775
|
+
console.log('To verify WARP is working:');
|
|
776
|
+
console.log(' curl -s https://www.cloudflare.com/cdn-cgi/trace/ | grep warp');
|
|
777
|
+
console.log(' Expected output: warp=on');
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Check if Cloudflare WARP is installed on the current system.
|
|
782
|
+
*
|
|
783
|
+
* This function checks for WARP installation across all supported platforms:
|
|
784
|
+
* - macOS: Checks for WARP.app via Homebrew cask or application bundle
|
|
785
|
+
* - Windows: Checks for WARP via Chocolatey package
|
|
786
|
+
* - Linux: Checks if warp-cli command exists in PATH
|
|
787
|
+
*
|
|
788
|
+
* @returns {Promise<boolean>} True if WARP is installed, false otherwise
|
|
789
|
+
*/
|
|
790
|
+
async function isInstalled() {
|
|
791
|
+
const platform = os.detect();
|
|
792
|
+
|
|
793
|
+
if (platform.type === 'macos') {
|
|
794
|
+
// Check if WARP app is installed or cask is installed
|
|
795
|
+
if (isWarpAppInstalledMacOS()) {
|
|
796
|
+
return true;
|
|
797
|
+
}
|
|
798
|
+
return brew.isCaskInstalled(HOMEBREW_CASK_NAME);
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
if (platform.type === 'windows' || platform.type === 'gitbash') {
|
|
802
|
+
// Check if WARP package is installed via Chocolatey
|
|
803
|
+
return choco.isPackageInstalled(CHOCO_PACKAGE_NAME);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// Linux and WSL: Check if warp-cli command exists
|
|
807
|
+
return isWarpCliCommandAvailable();
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Check if this installer is supported on the current platform.
|
|
812
|
+
*
|
|
813
|
+
* Cloudflare WARP is NOT available on:
|
|
814
|
+
* - Raspberry Pi OS (ARM architecture not supported)
|
|
815
|
+
*
|
|
816
|
+
* Note: WSL support is limited; recommended to install on Windows host instead.
|
|
817
|
+
*
|
|
818
|
+
* @returns {boolean} True if installation is supported on this platform
|
|
819
|
+
*/
|
|
820
|
+
function isEligible() {
|
|
821
|
+
const platform = os.detect();
|
|
822
|
+
// Exclude raspbian since WARP is not available for ARM Linux
|
|
823
|
+
return ['macos', 'ubuntu', 'debian', 'wsl', 'amazon_linux', 'rhel', 'fedora', 'windows', 'gitbash'].includes(platform.type);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Main installation entry point - detects platform and runs appropriate installer.
|
|
828
|
+
*
|
|
829
|
+
* Detects the current platform and executes the corresponding installer function.
|
|
830
|
+
* Handles platform-specific mappings to ensure all supported platforms have
|
|
831
|
+
* appropriate installation logic.
|
|
832
|
+
*
|
|
833
|
+
* Supported platforms:
|
|
834
|
+
* - macOS: WARP GUI via Homebrew cask
|
|
835
|
+
* - Ubuntu/Debian: WARP daemon via official APT repository
|
|
836
|
+
* - Amazon Linux/RHEL: WARP via DNF/YUM
|
|
837
|
+
* - Windows: WARP GUI via Chocolatey
|
|
838
|
+
* - WSL (Ubuntu): WARP within WSL (not recommended)
|
|
839
|
+
* - Git Bash: WARP on Windows host via PowerShell
|
|
840
|
+
*
|
|
841
|
+
* Unsupported platforms:
|
|
842
|
+
* - Raspberry Pi OS: ARM architecture not supported
|
|
843
|
+
*
|
|
844
|
+
* @returns {Promise<void>}
|
|
845
|
+
*/
|
|
846
|
+
async function install() {
|
|
847
|
+
const platform = os.detect();
|
|
848
|
+
|
|
849
|
+
// Map platform types to their installer functions
|
|
850
|
+
// This mapping handles aliases (e.g., debian maps to ubuntu)
|
|
851
|
+
const installers = {
|
|
852
|
+
'macos': install_macos,
|
|
853
|
+
'ubuntu': install_ubuntu,
|
|
854
|
+
'debian': install_ubuntu,
|
|
855
|
+
'wsl': install_ubuntu_wsl,
|
|
856
|
+
'raspbian': install_raspbian,
|
|
857
|
+
'amazon_linux': install_amazon_linux,
|
|
858
|
+
'rhel': install_amazon_linux,
|
|
859
|
+
'fedora': install_amazon_linux,
|
|
860
|
+
'windows': install_windows,
|
|
861
|
+
'gitbash': install_gitbash
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
const installer = installers[platform.type];
|
|
865
|
+
|
|
866
|
+
if (!installer) {
|
|
867
|
+
// Gracefully handle unsupported platforms without throwing an error
|
|
868
|
+
console.log(`Cloudflare WARP is not available for ${platform.type}.`);
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
await installer();
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
// Export all functions for use as a module and for testing
|
|
876
|
+
module.exports = {
|
|
877
|
+
install,
|
|
878
|
+
isInstalled,
|
|
879
|
+
isEligible,
|
|
880
|
+
install_macos,
|
|
881
|
+
install_ubuntu,
|
|
882
|
+
install_ubuntu_wsl,
|
|
883
|
+
install_raspbian,
|
|
884
|
+
install_amazon_linux,
|
|
885
|
+
install_windows,
|
|
886
|
+
install_gitbash,
|
|
887
|
+
// Export helper functions for potential reuse or testing
|
|
888
|
+
isWarpCliCommandAvailable,
|
|
889
|
+
isWarpAppInstalledMacOS,
|
|
890
|
+
getWarpCliVersion,
|
|
891
|
+
getWarpVersionMacOS
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
// Allow direct execution: node cloudflare-warp.js
|
|
895
|
+
if (require.main === module) {
|
|
896
|
+
install().catch(err => {
|
|
897
|
+
console.error(err.message);
|
|
898
|
+
process.exit(1);
|
|
899
|
+
});
|
|
900
|
+
}
|