@constellation-network/node-pilot 0.12.3-devnet → 0.12.3
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 +10 -10
- package/dist/checks/check-project.js +3 -21
- package/dist/commands/status.js +1 -1
- package/dist/services/fastforward-service.js +9 -8
- package/dist/services/migration-service.d.ts +1 -1
- package/dist/services/migration-service.js +20 -17
- package/dist/services/shell-service.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -3
- package/projects/hypergraph/docker-compose.yml +0 -4
- package/projects/hypergraph/networks/mainnet/network.env +3 -3
- package/projects/hypergraph/networks/testnet/network.env +3 -3
- package/install-java-21.sh +0 -80
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @constellation-network/node-pilot
|
|
|
21
21
|
$ cpilot COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ cpilot (--version|-v)
|
|
24
|
-
@constellation-network/node-pilot/0.12.3
|
|
24
|
+
@constellation-network/node-pilot/0.12.3 darwin-arm64 node-v22.15.0
|
|
25
25
|
$ cpilot --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ cpilot COMMAND
|
|
@@ -71,7 +71,7 @@ EXAMPLES
|
|
|
71
71
|
$ cpilot clean
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3
|
|
74
|
+
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3/src/commands/clean.ts)_
|
|
75
75
|
|
|
76
76
|
## `cpilot config`
|
|
77
77
|
|
|
@@ -88,7 +88,7 @@ EXAMPLES
|
|
|
88
88
|
$ cpilot config
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3
|
|
91
|
+
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3/src/commands/config.ts)_
|
|
92
92
|
|
|
93
93
|
## `cpilot config get [NAME]`
|
|
94
94
|
|
|
@@ -112,7 +112,7 @@ EXAMPLES
|
|
|
112
112
|
$ cpilot config get gl0:CL_PUBLIC_HTTP_PORT
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3
|
|
115
|
+
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3/src/commands/config/get.ts)_
|
|
116
116
|
|
|
117
117
|
## `cpilot config set NAME VALUE`
|
|
118
118
|
|
|
@@ -135,7 +135,7 @@ EXAMPLES
|
|
|
135
135
|
$ cpilot config set gl0:CL_PUBLIC_HTTP_PORT 9000
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3
|
|
138
|
+
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3/src/commands/config/set.ts)_
|
|
139
139
|
|
|
140
140
|
## `cpilot help [COMMAND]`
|
|
141
141
|
|
|
@@ -172,7 +172,7 @@ EXAMPLES
|
|
|
172
172
|
$ cpilot info
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3
|
|
175
|
+
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3/src/commands/info.ts)_
|
|
176
176
|
|
|
177
177
|
## `cpilot logs LAYER`
|
|
178
178
|
|
|
@@ -198,7 +198,7 @@ EXAMPLES
|
|
|
198
198
|
$ cpilot logs
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3
|
|
201
|
+
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3/src/commands/logs.ts)_
|
|
202
202
|
|
|
203
203
|
## `cpilot restart [LAYER]`
|
|
204
204
|
|
|
@@ -226,7 +226,7 @@ EXAMPLES
|
|
|
226
226
|
$ cpilot restart
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3
|
|
229
|
+
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3/src/commands/restart.ts)_
|
|
230
230
|
|
|
231
231
|
## `cpilot shutdown`
|
|
232
232
|
|
|
@@ -243,7 +243,7 @@ EXAMPLES
|
|
|
243
243
|
$ cpilot shutdown
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3
|
|
246
|
+
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3/src/commands/shutdown.ts)_
|
|
247
247
|
|
|
248
248
|
## `cpilot status`
|
|
249
249
|
|
|
@@ -257,5 +257,5 @@ DESCRIPTION
|
|
|
257
257
|
Display node status and configuration settings
|
|
258
258
|
```
|
|
259
259
|
|
|
260
|
-
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3
|
|
260
|
+
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.12.3/src/commands/status.ts)_
|
|
261
261
|
<!-- commandsstop -->
|
|
@@ -10,28 +10,10 @@ import { clusterService } from "../services/cluster-service.js";
|
|
|
10
10
|
import { dockerService } from "../services/docker-service.js";
|
|
11
11
|
import { shellService } from "../services/shell-service.js";
|
|
12
12
|
import { checkNetwork } from "./check-network.js";
|
|
13
|
-
/*
|
|
14
|
-
* -Xms12g \
|
|
15
|
-
-Xmx12g \
|
|
16
|
-
-XX:+UseZGC \
|
|
17
|
-
-XX:+ZGenerational \
|
|
18
|
-
-XX:ZAllocationSpikeTolerance=5 \
|
|
19
|
-
-XX:ZCollectionInterval=10 \
|
|
20
|
-
-XX:ConcGCThreads=4 \
|
|
21
|
-
-XX:ParallelGCThreads=8 \
|
|
22
|
-
-XX:+UseStringDeduplication \
|
|
23
|
-
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED \
|
|
24
|
-
--add-opens=java.base/java.util=ALL-UNNAMED \
|
|
25
|
-
--add-opens=java.base/java.security=ALL-UNNAMED \
|
|
26
|
-
-XX:+HeapDumpOnOutOfMemoryError \
|
|
27
|
-
-XX:HeapDumpPath=./heap_dumps/ \
|
|
28
|
-
-XX:+ExitOnOutOfMemoryError
|
|
29
|
-
*/
|
|
30
13
|
function getJavaMemoryOptions(network, mem) {
|
|
31
14
|
if (network === 'testnet') {
|
|
32
|
-
const linuxOpt = (os.platform() === 'linux') ? ' -XX:+UseZGC
|
|
33
|
-
|
|
34
|
-
return `-Xms${mem}g -Xmx${mem}g${linuxOpt} -XXConveyGCThreads=4 -XXParallelGCThreads=8 -XX:+UseStringDeduplication --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED`;
|
|
15
|
+
const linuxOpt = (os.platform() === 'linux') ? ' -XX:+UseZGC' : '';
|
|
16
|
+
return `-Xms${mem}g -Xmx${mem}g -XX:+UnlockExperimentalVMOptions${linuxOpt} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heap_dumps/ -XX:+ExitOnOutOfMemoryError`;
|
|
35
17
|
}
|
|
36
18
|
return `-Xms1024M -Xmx${mem}g -Xss256K`;
|
|
37
19
|
}
|
|
@@ -80,7 +62,7 @@ export const checkProject = {
|
|
|
80
62
|
const network = type.toUpperCase();
|
|
81
63
|
const logMethod = type === currentNetwork ? clm.postStep : clm.debug;
|
|
82
64
|
logMethod(`${network}:: ${layersToRun[0]} memory allocation: ${mainLayerMem}GB`);
|
|
83
|
-
configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS: getJavaMemoryOptions(
|
|
65
|
+
configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS: getJavaMemoryOptions(currentNetwork, mainLayerMem) });
|
|
84
66
|
if (subLayerMem) {
|
|
85
67
|
logMethod(`${network}:: ${layersToRun[1]} memory allocation: ${subLayerMem}GB`);
|
|
86
68
|
configStore.setEnvLayerInfo(type, layersToRun[1], { CL_DOCKER_JAVA_OPTS: `-Xms1024M -Xmx${subLayerMem}G -Xss256K` });
|
package/dist/commands/status.js
CHANGED
|
@@ -17,7 +17,7 @@ export default class Status extends Command {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
export async function checkInstallationAndConfigurationStatus() {
|
|
20
|
-
migrationService.runMigrations();
|
|
20
|
+
await migrationService.runMigrations();
|
|
21
21
|
await checkInitialSetup.firstTimeRun();
|
|
22
22
|
await checkProject.projectInstallation();
|
|
23
23
|
await checkProject.checkJavaMemory();
|
|
@@ -5,6 +5,7 @@ import 'json-bigint-patch';
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { clm } from "../clm.js";
|
|
7
7
|
import { configStore } from "../config-store.js";
|
|
8
|
+
import { promptHelper } from "../helpers/prompt-helper.js";
|
|
8
9
|
import { shellService } from "./shell-service.js";
|
|
9
10
|
const CHUNK_SIZE = 20_000;
|
|
10
11
|
export class FastforwardService {
|
|
@@ -27,14 +28,14 @@ export class FastforwardService {
|
|
|
27
28
|
const ffs = new FastforwardService();
|
|
28
29
|
await ffs.runFastForwardSnapshot().catch(async (error) => {
|
|
29
30
|
clm.debug(error);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
clm.error('Failed to fast forward to latest snapshot. Please try again later
|
|
31
|
+
const { projectDir } = configStore.getProjectInfo();
|
|
32
|
+
const dataDir = path.join(projectDir, 'gl0', 'data', 'incremental_snapshot', 'ordinal');
|
|
33
|
+
if (fs.existsSync(dataDir) && fs.readdirSync(dataDir).length > 0) {
|
|
34
|
+
clm.warn('Failed to fast forward to latest snapshot. Skipping...');
|
|
35
|
+
await promptHelper.doYouWishToContinue();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
clm.error('Failed to fast forward to latest snapshot. Please try again later.');
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
async runFastForwardSnapshot() {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
1
2
|
import semver from "semver";
|
|
2
3
|
import packageJson from '../../package.json' with { type: 'json' };
|
|
3
4
|
import { clm } from "../clm.js";
|
|
4
5
|
import { configStore } from "../config-store.js";
|
|
5
|
-
import
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { shellService } from "./shell-service.js";
|
|
8
7
|
export const migrationService = {
|
|
9
|
-
runMigrations() {
|
|
8
|
+
async runMigrations() {
|
|
10
9
|
const migrations = {
|
|
11
|
-
'0.
|
|
10
|
+
'0.8.0': m080,
|
|
11
|
+
'0.12.3': m0123,
|
|
12
12
|
// add more migrations as needed
|
|
13
13
|
};
|
|
14
14
|
const { version = '0.0.0' } = configStore.getProjectInfo();
|
|
@@ -26,22 +26,25 @@ export const migrationService = {
|
|
|
26
26
|
if (migrationVersions.length > 0) {
|
|
27
27
|
clm.preStep(`Migration versions to run: ${migrationVersions}`);
|
|
28
28
|
for (const version of migrationVersions) {
|
|
29
|
-
|
|
29
|
+
// eslint-disable-next-line no-await-in-loop
|
|
30
|
+
await migrations[version]();
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
configStore.setProjectInfo({ version: currentVersion.toString() });
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
|
-
function
|
|
36
|
-
clm.step('Running migration 0.12.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
console.log(result.stderr);
|
|
45
|
-
clm.error(`Failed to install dependencies. Please try again after resolving any errors.`);
|
|
36
|
+
async function m0123() {
|
|
37
|
+
clm.step('Running migration 0.12.3...');
|
|
38
|
+
const { type } = configStore.getNetworkInfo();
|
|
39
|
+
if (type === 'integrationnet') {
|
|
40
|
+
clm.preStep('Installing Node Pilot IntegrationNet version...');
|
|
41
|
+
await shellService.runCommand('sudo npm install -g @constellation-network/node-pilot@intnet');
|
|
42
|
+
clm.postStep('IntegrationNet version installed successfully.');
|
|
43
|
+
clm.warn(`Run ${chalk.cyanBright('cpilot')} again to start using the IntegrationNet version.`);
|
|
44
|
+
process.exit(0);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
47
|
+
async function m080() {
|
|
48
|
+
clm.step('Running migration 0.8.0...');
|
|
49
|
+
configStore.setProjectFlag('javaMemoryChecked', false);
|
|
50
|
+
}
|
|
@@ -60,7 +60,7 @@ export const shellService = {
|
|
|
60
60
|
if (env) {
|
|
61
61
|
nodeEnv = { ...env, ...process.env };
|
|
62
62
|
}
|
|
63
|
-
clm.debug(`START Running command: "${command}" in directory: "${projectDir}"`);
|
|
63
|
+
clm.debug(`START Running command: "${command}" in directory: "${projectDir}"`);
|
|
64
64
|
return new Promise((resolve, reject) => {
|
|
65
65
|
shell.exec(command, { async: true, cwd: projectDir, env: nodeEnv, silent }, (code, stdout, stderr) => {
|
|
66
66
|
if (code === 0) {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constellation-network/node-pilot",
|
|
3
3
|
"description": "An easy deployment and monitoring tool for Constellation nodes.",
|
|
4
|
-
"version": "0.12.3
|
|
4
|
+
"version": "0.12.3",
|
|
5
5
|
"author": "Frank Fox",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cpilot": "bin/run.js"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"version": "oclif readme && git add README.md",
|
|
22
22
|
"start": "./bin/dev.js",
|
|
23
23
|
"debug": "DEBUG=true ./bin/dev.js",
|
|
24
|
-
"pub": "npm publish --access public
|
|
24
|
+
"pub": "npm publish --access public"
|
|
25
25
|
},
|
|
26
26
|
"types": "dist/index.d.ts",
|
|
27
27
|
"engines": {
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"dist",
|
|
70
70
|
"oclif.manifest.json",
|
|
71
71
|
"install-dependencies.sh",
|
|
72
|
-
"install-java-21.sh",
|
|
73
72
|
"projects",
|
|
74
73
|
"scripts",
|
|
75
74
|
"README.md",
|
|
@@ -9,10 +9,6 @@ services:
|
|
|
9
9
|
# - /var/run/docker.sock:/var/run/docker.sock
|
|
10
10
|
gl0:
|
|
11
11
|
image: constellationnetwork/tessellation${CL_DOCKER_CORE_REPO:-}:${DOCKER_IMAGE_VERSION:-latest}
|
|
12
|
-
deploy:
|
|
13
|
-
resources:
|
|
14
|
-
limits:
|
|
15
|
-
memory: ${GL0_MEMORY_LIMIT:-0}
|
|
16
12
|
networks:
|
|
17
13
|
- tessellation-network
|
|
18
14
|
restart: unless-stopped
|
|
@@ -3,6 +3,6 @@ CL_COLLATERAL=25000000000000
|
|
|
3
3
|
CL_L0_PEER_HTTP_PORT=9000
|
|
4
4
|
CL_L0_PEER_HTTP_HOST=52.53.46.33
|
|
5
5
|
CL_L0_PEER_ID=e0c1ee6ec43510f0e16d2969a7a7c074a5c8cdb477c074fe9c32a9aad8cbc8ff1dff60bb81923e0db437d2686a9b65b86c403e6a21fa32b6acc4e61be4d70925
|
|
6
|
-
CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
|
7
|
-
CL_GLOBAL_L0_PEER_HOST=52.53.46.33
|
|
8
|
-
CL_GLOBAL_L0_PEER_ID=e0c1ee6ec43510f0e16d2969a7a7c074a5c8cdb477c074fe9c32a9aad8cbc8ff1dff60bb81923e0db437d2686a9b65b86c403e6a21fa32b6acc4e61be4d70925
|
|
6
|
+
#CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
|
7
|
+
#CL_GLOBAL_L0_PEER_HOST=52.53.46.33
|
|
8
|
+
#CL_GLOBAL_L0_PEER_ID=e0c1ee6ec43510f0e16d2969a7a7c074a5c8cdb477c074fe9c32a9aad8cbc8ff1dff60bb81923e0db437d2686a9b65b86c403e6a21fa32b6acc4e61be4d70925
|
|
@@ -3,6 +3,6 @@ CL_COLLATERAL=0
|
|
|
3
3
|
CL_L0_PEER_HTTP_PORT=9000
|
|
4
4
|
CL_L0_PEER_HTTP_HOST=52.8.132.193
|
|
5
5
|
CL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
|
6
|
-
CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
|
7
|
-
CL_GLOBAL_L0_PEER_HOST=52.8.132.193
|
|
8
|
-
CL_GLOBAL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
|
6
|
+
#CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
|
7
|
+
#CL_GLOBAL_L0_PEER_HOST=52.8.132.193
|
|
8
|
+
#CL_GLOBAL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
package/install-java-21.sh
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Break on any error
|
|
4
|
-
set -e
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
check_java_home() {
|
|
8
|
-
# echo "Checking if JAVA_HOME env is set"
|
|
9
|
-
|
|
10
|
-
if [ -z "$JAVA_HOME" ] || ! grep -q 'JAVA_HOME' "$HOME/.bashrc"; then
|
|
11
|
-
JAVA_HOME_LINE='export JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(which java)")")")"'
|
|
12
|
-
echo "JAVA_HOME is not set. Attempting to set automatically"
|
|
13
|
-
echo "Please ensure the following line is in your ~/.bashrc or ~/.zshrc file:"
|
|
14
|
-
echo "Script will attempt to now add it for you and run it, but this only adds to .bashrc"
|
|
15
|
-
echo $JAVA_HOME_LINE
|
|
16
|
-
echo "$JAVA_HOME_LINE" >> $HOME/.bashrc
|
|
17
|
-
echo "Adding JAVA_HOME to current environment"
|
|
18
|
-
eval $JAVA_HOME_LINE
|
|
19
|
-
echo "JAVA_HOME is now set to: $JAVA_HOME"
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
# Check and install Java 21
|
|
25
|
-
check_java() {
|
|
26
|
-
# echo "Checking for Java 21..."
|
|
27
|
-
if command -v java >/dev/null 2>&1; then
|
|
28
|
-
java_version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
|
|
29
|
-
# echo "Found Java version: $java_version"
|
|
30
|
-
if [[ "$java_version" == 21* ]] || [[ "$java_version" == 1.21* ]]; then
|
|
31
|
-
echo "✅ Java 21 is installed."
|
|
32
|
-
return 0
|
|
33
|
-
else
|
|
34
|
-
echo "⚠️ Java is installed but not version 21. Will attempt to install Java 21."
|
|
35
|
-
fi
|
|
36
|
-
else
|
|
37
|
-
echo "⚠️ Java not found. Will attempt to install Java 21."
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
case "$(uname)" in
|
|
42
|
-
Linux)
|
|
43
|
-
if command -v apt >/dev/null 2>&1; then
|
|
44
|
-
echo "Installing Java 21 using apt..."
|
|
45
|
-
sudo apt install -y openjdk-21-jdk
|
|
46
|
-
elif command -v yum >/dev/null 2>&1; then
|
|
47
|
-
echo "Installing Java 21 using yum..."
|
|
48
|
-
sudo yum install -y java-21-openjdk-devel
|
|
49
|
-
else
|
|
50
|
-
echo "⚠️ Unsupported Linux distribution. Please install Java 21 manually."
|
|
51
|
-
return 1
|
|
52
|
-
fi
|
|
53
|
-
;;
|
|
54
|
-
Darwin)
|
|
55
|
-
if command -v brew >/dev/null 2>&1; then
|
|
56
|
-
echo "Installing Java 21 using Homebrew..."
|
|
57
|
-
brew tap adoptopenjdk/openjdk
|
|
58
|
-
brew install --cask adoptopenjdk21
|
|
59
|
-
else
|
|
60
|
-
echo "⚠️ Homebrew not found. Please install Java 21 manually."
|
|
61
|
-
return 1
|
|
62
|
-
fi
|
|
63
|
-
;;
|
|
64
|
-
MINGW*|MSYS*|CYGWIN*)
|
|
65
|
-
echo "On Windows, please install Java 21 manually from https://adoptopenjdk.net/"
|
|
66
|
-
return 1
|
|
67
|
-
;;
|
|
68
|
-
*)
|
|
69
|
-
echo "⚠️ Unsupported OS: $(uname). Please install Java 21 manually."
|
|
70
|
-
return 1
|
|
71
|
-
;;
|
|
72
|
-
esac
|
|
73
|
-
|
|
74
|
-
echo "✅ Java 21 installation complete."
|
|
75
|
-
return 0
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
check_java
|
|
80
|
-
check_java_home
|