@constellation-network/node-pilot 0.13.0-testnet → 0.13.0

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 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.13.0-testnet darwin-arm64 node-v22.15.0
24
+ @constellation-network/node-pilot/0.13.0 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.13.0-testnet/src/commands/clean.ts)_
74
+ _See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.13.0/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.13.0-testnet/src/commands/config.ts)_
91
+ _See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.13.0/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.13.0-testnet/src/commands/config/get.ts)_
115
+ _See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.13.0/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.13.0-testnet/src/commands/config/set.ts)_
138
+ _See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.13.0/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.13.0-testnet/src/commands/info.ts)_
175
+ _See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.13.0/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.13.0-testnet/src/commands/logs.ts)_
201
+ _See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.13.0/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.13.0-testnet/src/commands/restart.ts)_
229
+ _See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.13.0/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.13.0-testnet/src/commands/shutdown.ts)_
246
+ _See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.13.0/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.13.0-testnet/src/commands/status.ts)_
260
+ _See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.13.0/src/commands/status.ts)_
261
261
  <!-- commandsstop -->
@@ -12,9 +12,8 @@ import { shellService } from "../services/shell-service.js";
12
12
  import { checkNetwork } from "./check-network.js";
13
13
  function getJavaMemoryOptions(network, mem) {
14
14
  if (network === 'testnet') {
15
- const linuxOpt = (os.platform() === 'linux') ? ' -XX:+UseZGC -XX:+ZGenerational -XX:ZAllocationSpikeTolerance=5 -XX:ZCollectionInterval=10' : '';
16
- // return `-Xms${mem}g -Xmx${mem}g -XX:+UnlockExperimentalVMOptions${linuxOpt} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heap_dumps/ -XX:+ExitOnOutOfMemoryError`;
17
- return `-Xms${mem}g -Xmx${mem}g${linuxOpt} -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`;
18
17
  }
19
18
  return `-Xms1024M -Xmx${mem}g -Xss256K`;
20
19
  }
@@ -63,7 +62,7 @@ export const checkProject = {
63
62
  const network = type.toUpperCase();
64
63
  const logMethod = type === currentNetwork ? clm.postStep : clm.debug;
65
64
  logMethod(`${network}:: ${layersToRun[0]} memory allocation: ${mainLayerMem}GB`);
66
- configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS: getJavaMemoryOptions(type, mainLayerMem) });
65
+ configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS: getJavaMemoryOptions(currentNetwork, mainLayerMem) });
67
66
  if (subLayerMem) {
68
67
  logMethod(`${network}:: ${layersToRun[1]} memory allocation: ${subLayerMem}GB`);
69
68
  configStore.setEnvLayerInfo(type, layersToRun[1], { CL_DOCKER_JAVA_OPTS: `-Xms1024M -Xmx${subLayerMem}G -Xss256K` });
@@ -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();
@@ -9,7 +9,7 @@ export declare const projectHelper: {
9
9
  installProject(name: string, projectFolder: string): Promise<void>;
10
10
  prepareDataFolder(): void;
11
11
  selectProject(): Promise<void>;
12
- upgradeEmbedded(name: string): void;
13
- upgradeHypergraph(): void;
14
- upgradeProject(name: string, projectFolder: string): void;
12
+ upgradeEmbedded(name: string): Promise<void>;
13
+ upgradeHypergraph(): Promise<void>;
14
+ upgradeProject(name: string, projectFolder: string): Promise<void>;
15
15
  };
@@ -170,18 +170,18 @@ export const projectHelper = {
170
170
  }
171
171
  }
172
172
  },
173
- upgradeEmbedded(name) {
173
+ async upgradeEmbedded(name) {
174
174
  const projectFolder = path.resolve(path.dirname(fileURLToPath(import.meta.url)), `../../projects/${name}`);
175
175
  if (!fs.existsSync(projectFolder)) {
176
176
  clm.error(`Project folder not found: ${projectFolder}`);
177
177
  }
178
- this.upgradeProject(name, projectFolder);
178
+ await this.upgradeProject(name, projectFolder);
179
179
  },
180
- upgradeHypergraph() {
181
- this.upgradeEmbedded('hypergraph');
180
+ async upgradeHypergraph() {
181
+ await this.upgradeEmbedded('hypergraph');
182
182
  this.importEnvFiles();
183
183
  },
184
- upgradeProject(name, projectFolder) {
184
+ async upgradeProject(name, projectFolder) {
185
185
  const { projectDir } = configStore.getProjectInfo();
186
186
  clm.debug(`Upgrading project from ${projectFolder} to ${projectDir}`);
187
187
  fs.cpSync(projectFolder, projectDir, { recursive: true });
@@ -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
- // const {projectDir} = configStore.getProjectInfo();
31
- // const dataDir = path.join(projectDir, 'gl0', 'data', 'incremental_snapshot', 'ordinal');
32
- // if (fs.existsSync(dataDir) && fs.readdirSync(dataDir).length > 0) {
33
- // clm.warn('Failed to fast forward to latest snapshot. Skipping...');
34
- // await promptHelper.doYouWishToContinue();
35
- // return;
36
- // }
37
- clm.error('Failed to fast forward to latest snapshot. Please try again later or skip this step when prompted.');
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,3 +1,3 @@
1
1
  export declare const migrationService: {
2
- runMigrations(): void;
2
+ runMigrations(): Promise<void>;
3
3
  };
@@ -1,11 +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";
6
+ import { shellService } from "./shell-service.js";
5
7
  export const migrationService = {
6
- runMigrations() {
8
+ async runMigrations() {
7
9
  const migrations = {
8
- '0.12.5': m0125,
10
+ '0.8.0': m080,
11
+ '0.12.3': m0123,
9
12
  // add more migrations as needed
10
13
  };
11
14
  const { version = '0.0.0' } = configStore.getProjectInfo();
@@ -20,30 +23,28 @@ export const migrationService = {
20
23
  const migrationVersions = Object.keys(migrations)
21
24
  .filter(v => semver.gt(v, version) && semver.lte(v, currentVersion.version))
22
25
  .sort(semver.compare);
23
- // TODO shutdown node if migration is in progress
24
26
  if (migrationVersions.length > 0) {
25
27
  clm.preStep(`Migration versions to run: ${migrationVersions}`);
26
28
  for (const version of migrationVersions) {
27
- migrations[version]();
29
+ // eslint-disable-next-line no-await-in-loop
30
+ await migrations[version]();
28
31
  }
29
32
  }
30
33
  configStore.setProjectInfo({ version: currentVersion.toString() });
31
34
  }
32
35
  };
33
- function m0125() {
34
- clm.step('Running migration 0.12.5...');
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);
45
+ }
46
+ }
47
+ async function m080() {
48
+ clm.step('Running migration 0.8.0...');
35
49
  configStore.setProjectFlag('javaMemoryChecked', false);
36
- // projectHelper.upgradeHypergraph();
37
- // installJava21();
38
50
  }
39
- // function installJava21() {
40
- // const pilotDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), `../..`);
41
- // clm.debug(`Running install-java-21.sh from ${pilotDir}`);
42
- //
43
- // const result = shell.exec('bash install-java-21.sh', {cwd: pilotDir});
44
- //
45
- // if (result.code > 0) {
46
- // console.log(result.stderr);
47
- // clm.error(`Failed to install dependencies. Please try again after resolving any errors.`);
48
- // }
49
- // }
@@ -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}"`); // with env: ${JSON.stringify(nodeEnv)}`);
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) {
@@ -340,5 +340,5 @@
340
340
  ]
341
341
  }
342
342
  },
343
- "version": "0.13.0-testnet"
343
+ "version": "0.13.0"
344
344
  }
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.13.0-testnet",
4
+ "version": "0.13.0",
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 --tag testnet"
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",
@@ -1,6 +1,6 @@
1
1
  FROM ubuntu:22.04
2
2
 
3
- RUN apt update && apt install -y openjdk-21-jre
3
+ RUN apt update && apt install -y openjdk-11-jre
4
4
 
5
5
  RUN apt install -y curl jq wget
6
6
 
@@ -39,7 +39,7 @@ COPY dist/gl0.jar /app/jars/gl0.jar
39
39
  #COPY ./health-check /health-check
40
40
  #RUN chmod +x /health-check/bin/run.sh
41
41
  #RUN chmod +x /health-check/bin/hydrate.sh
42
- RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.27"
42
+ RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.26"
43
43
 
44
44
  # Add entrypoint
45
45
  COPY ./entrypoint.sh /app/entrypoint.sh
@@ -8,7 +8,7 @@ services:
8
8
  # volumes:
9
9
  # - /var/run/docker.sock:/var/run/docker.sock
10
10
  gl0:
11
- image: constellationnetwork/tessellation${CL_DOCKER_CORE_REPO:-}:${DOCKER_IMAGE_VERSION:-test}
11
+ image: constellationnetwork/tessellation${CL_DOCKER_CORE_REPO:-}:${DOCKER_IMAGE_VERSION:-latest}
12
12
  networks:
13
13
  - tessellation-network
14
14
  restart: unless-stopped
@@ -33,7 +33,7 @@ services:
33
33
  # labels:
34
34
  # autoheal: "true"
35
35
  gl1:
36
- image: constellationnetwork/tessellation${CL_DOCKER_CORE_REPO:-}:${DOCKER_IMAGE_VERSION:-test}
36
+ image: constellationnetwork/tessellation${CL_DOCKER_CORE_REPO:-}:${DOCKER_IMAGE_VERSION:-latest}
37
37
  restart: unless-stopped
38
38
  networks:
39
39
  - tessellation-network
@@ -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
@@ -21,57 +21,57 @@ check_java_home() {
21
21
 
22
22
  }
23
23
 
24
- # Check and install Java 21
24
+ # Check and install Java 11
25
25
  check_java() {
26
- # echo "Checking for Java 21..."
26
+ # echo "Checking for Java 11..."
27
27
  if command -v java >/dev/null 2>&1; then
28
28
  java_version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
29
29
  # echo "Found Java version: $java_version"
30
- if [[ "$java_version" == 21* ]] || [[ "$java_version" == 1.21* ]]; then
31
- echo "✅ Java 21 is installed."
30
+ if [[ "$java_version" == 11* ]] || [[ "$java_version" == 1.11* ]]; then
31
+ echo "✅ Java 11 is installed."
32
32
  return 0
33
33
  else
34
- echo "⚠️ Java is installed but not version 21. Will attempt to install Java 21."
34
+ echo "⚠️ Java is installed but not version 11. Will attempt to install Java 11."
35
35
  fi
36
36
  else
37
- echo "⚠️ Java not found. Will attempt to install Java 21."
37
+ echo "⚠️ Java not found. Will attempt to install Java 11."
38
38
  fi
39
39
 
40
-
40
+
41
41
  case "$(uname)" in
42
42
  Linux)
43
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
44
+ echo "Installing Java 11 using apt..."
45
+ sudo apt install -y openjdk-11-jdk
46
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
47
+ echo "Installing Java 11 using yum..."
48
+ sudo yum install -y java-11-openjdk-devel
49
49
  else
50
- echo "⚠️ Unsupported Linux distribution. Please install Java 21 manually."
50
+ echo "⚠️ Unsupported Linux distribution. Please install Java 11 manually."
51
51
  return 1
52
52
  fi
53
53
  ;;
54
54
  Darwin)
55
55
  if command -v brew >/dev/null 2>&1; then
56
- echo "Installing Java 21 using Homebrew..."
56
+ echo "Installing Java 11 using Homebrew..."
57
57
  brew tap adoptopenjdk/openjdk
58
- brew install --cask adoptopenjdk21
58
+ brew install --cask adoptopenjdk11
59
59
  else
60
- echo "⚠️ Homebrew not found. Please install Java 21 manually."
60
+ echo "⚠️ Homebrew not found. Please install Java 11 manually."
61
61
  return 1
62
62
  fi
63
63
  ;;
64
64
  MINGW*|MSYS*|CYGWIN*)
65
- echo "On Windows, please install Java 21 manually from https://adoptopenjdk.net/"
65
+ echo "On Windows, please install Java 11 manually from https://adoptopenjdk.net/"
66
66
  return 1
67
67
  ;;
68
68
  *)
69
- echo "⚠️ Unsupported OS: $(uname). Please install Java 21 manually."
69
+ echo "⚠️ Unsupported OS: $(uname). Please install Java 11 manually."
70
70
  return 1
71
71
  ;;
72
72
  esac
73
-
74
- echo "✅ Java 21 installation complete."
73
+
74
+ echo "✅ Java 11 installation complete."
75
75
  return 0
76
76
  }
77
77
 
@@ -1,110 +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
- check_system_update() {
79
- echo ""
80
- echo "Checking for system updates..."
81
- echo ""
82
-
83
- if [ "$(uname)" = "Linux" ]; then
84
- sudo apt-get update && sudo apt-get upgrade -y
85
- echo "System packages updated."
86
- fi
87
- }
88
-
89
- check_system_update
90
- check_java
91
- check_java_home
92
-
93
- if [ -f /var/run/reboot-required ]; then
94
- echo ""
95
- echo "⚠️ A system reboot is required to complete updates. Please reboot your system."
96
- echo ""
97
- echo "Then run 'cpilot' to get started"
98
- echo ""
99
- echo "Would you like to reboot now? (y/n)"
100
- read -r response
101
- if [[ ! "$response" =~ ^[Yy]$ ]]; then
102
- echo "Reboot skipped. Please reboot manually to proceed."
103
- else
104
- sudo reboot
105
- fi
106
- else
107
- echo ""
108
- echo "Run 'cpilot' to get started"
109
- fi
110
-