File tree Expand file tree Collapse file tree 12 files changed +123
-122
lines changed
java/org/elasticsearch/license/licensor/tools
resources/META-INF/services Expand file tree Collapse file tree 12 files changed +123
-122
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4- # or more contributor license agreements. Licensed under the Elastic License
5- # 2.0; you may not use this file except in compliance with the Elastic License
6- # 2.0.
7-
8- CDPATH=" "
9- SCRIPT=" $0 "
10-
11- # SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
12- while [ -h " $SCRIPT " ] ; do
13- ls=` ls -ld " $SCRIPT " `
14- # Drop everything prior to ->
15- link=` expr " $ls " : ' .*-> \(.*\)$' `
16- if expr " $link " : ' /.*' > /dev/null; then
17- SCRIPT=" $link "
18- else
19- SCRIPT=` dirname " $SCRIPT " ` /" $link "
20- fi
21- done
22-
23- # determine license home
24- LICENSE_HOME=` dirname " $SCRIPT " ` /..
25-
26- # make LICENSE_HOME absolute
27- LICENSE_HOME=` cd " $LICENSE_HOME " ; pwd`
28-
29- # setup classpath
30- LICENSE_CLASSPATH=$LICENSE_CLASSPATH :$LICENSE_HOME /lib/*
31-
32- if [ -x " $JAVA_HOME /bin/java" ]; then
33- JAVA=$JAVA_HOME /bin/java
34- else
35- JAVA=` which java`
36- fi
37-
38- exec " $JAVA " $JAVA_OPTS -Xmx64m -Xms16m -cp " $LICENSE_CLASSPATH " -Des.path.home=" ` pwd` " org.elasticsearch.license.licensor.tools.KeyPairGeneratorTool " $@ "
39-
3+ source " ` dirname " $0 " ` " /license-cli
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4+ # or more contributor license agreements. Licensed under the Elastic License
5+ # 2.0; you may not use this file except in compliance with the Elastic License
6+ # 2.0.
7+
8+ CDPATH=" "
9+ SCRIPT=" $0 "
10+
11+ # SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
12+ while [ -h " $SCRIPT " ] ; do
13+ ls=` ls -ld " $SCRIPT " `
14+ # Drop everything prior to ->
15+ link=` expr " $ls " : ' .*-> \(.*\)$' `
16+ if expr " $link " : ' /.*' > /dev/null; then
17+ SCRIPT=" $link "
18+ else
19+ SCRIPT=` dirname " $SCRIPT " ` /" $link "
20+ fi
21+ done
22+
23+ # determine license home
24+ LICENSE_HOME=` dirname " $SCRIPT " ` /..
25+ # make LICENSE_HOME absolute
26+ LICENSE_HOME=` cd " $LICENSE_HOME " ; pwd`
27+
28+ # setup classpath
29+ LICENSE_CLASSPATH=$LICENSE_CLASSPATH :$LICENSE_HOME /lib/*
30+
31+ if [ -x " $JAVA_HOME /bin/java" ]; then
32+ JAVA=$JAVA_HOME /bin/java
33+ else
34+ JAVA=` which java`
35+ fi
36+
37+ JAVA_OPTS=" $JAVA_OPTS -Xmx64m -Xms16m"
38+ CLI_NAME=$( basename $0 )
39+
40+ exec \
41+ " $JAVA " \
42+ $JAVA_OPTS \
43+ -Dcli.name=" $CLI_NAME " \
44+ -Des.path.home=" ` pwd` " \
45+ -cp " $LICENSE_CLASSPATH " \
46+ org.elasticsearch.launcher.CliToolLauncher \
47+ " $@ "
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4- # or more contributor license agreements. Licensed under the Elastic License
5- # 2.0; you may not use this file except in compliance with the Elastic License
6- # 2.0.
7-
8- CDPATH=" "
9- SCRIPT=" $0 "
10-
11- # SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
12- while [ -h " $SCRIPT " ] ; do
13- ls=` ls -ld " $SCRIPT " `
14- # Drop everything prior to ->
15- link=` expr " $ls " : ' .*-> \(.*\)$' `
16- if expr " $link " : ' /.*' > /dev/null; then
17- SCRIPT=" $link "
18- else
19- SCRIPT=` dirname " $SCRIPT " ` /" $link "
20- fi
21- done
22-
23- # determine license home
24- LICENSE_HOME=` dirname " $SCRIPT " ` /..
25-
26- # make LICENSE_HOME absolute
27- LICENSE_HOME=` cd " $LICENSE_HOME " ; pwd`
28-
29- # setup classpath
30- LICENSE_CLASSPATH=$LICENSE_CLASSPATH :$LICENSE_HOME /lib/*
31-
32- if [ -x " $JAVA_HOME /bin/java" ]; then
33- JAVA=$JAVA_HOME /bin/java
34- else
35- JAVA=` which java`
36- fi
37-
38- exec " $JAVA " $JAVA_OPTS -Xmx64m -Xms16m -cp " $LICENSE_CLASSPATH " -Des.path.home=" ` pwd` " org.elasticsearch.license.licensor.tools.LicenseGeneratorTool " $@ "
3+ source " ` dirname " $0 " ` " /license-cli
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4- # or more contributor license agreements. Licensed under the Elastic License
5- # 2.0; you may not use this file except in compliance with the Elastic License
6- # 2.0.
7-
8- CDPATH=" "
9- SCRIPT=" $0 "
10-
11- # SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
12- while [ -h " $SCRIPT " ] ; do
13- ls=` ls -ld " $SCRIPT " `
14- # Drop everything prior to ->
15- link=` expr " $ls " : ' .*-> \(.*\)$' `
16- if expr " $link " : ' /.*' > /dev/null; then
17- SCRIPT=" $link "
18- else
19- SCRIPT=` dirname " $SCRIPT " ` /" $link "
20- fi
21- done
22-
23- # determine license home
24- LICENSE_HOME=` dirname " $SCRIPT " ` /..
25-
26- # make LICENSE_HOME absolute
27- LICENSE_HOME=` cd " $LICENSE_HOME " ; pwd`
28-
29- # setup classpath
30- LICENSE_CLASSPATH=$LICENSE_CLASSPATH :$LICENSE_HOME /lib/*
31-
32- if [ -x " $JAVA_HOME /bin/java" ]; then
33- JAVA=$JAVA_HOME /bin/java
34- else
35- JAVA=` which java`
36- fi
37-
38- exec " $JAVA " $JAVA_OPTS -Xmx64m -Xms16m -cp " $LICENSE_CLASSPATH " -Des.path.home=" ` pwd` " org.elasticsearch.license.licensor.tools.LicenseVerificationTool " $@ "
39-
3+ source " ` dirname " $0 " ` " /license-cli
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ apply plugin: 'elasticsearch.build'
33dependencies {
44 api project(' :x-pack:plugin:core' )
55 api project(' :server' )
6+ api project(' :distribution:tools:cli-launcher' )
67 testImplementation project(' :test:framework' )
78}
89
Original file line number Diff line number Diff line change @@ -36,10 +36,6 @@ public KeyPairGeneratorTool() {
3636 this .privateKeyPathOption = parser .accepts ("privateKeyPath" , "private key path" ).withRequiredArg ().required ();
3737 }
3838
39- public static void main (String [] args ) throws Exception {
40- exit (new KeyPairGeneratorTool ().main (args , Terminal .DEFAULT ));
41- }
42-
4339 @ Override
4440 protected void printAdditionalHelp (Terminal terminal ) {
4541 terminal .println ("This tool generates and saves a key pair to the provided publicKeyPath" );
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+ * or more contributor license agreements. Licensed under the Elastic License
4+ * 2.0; you may not use this file except in compliance with the Elastic License
5+ * 2.0.
6+ */
7+
8+ package org .elasticsearch .license .licensor .tools ;
9+
10+ import org .elasticsearch .cli .CliToolProvider ;
11+ import org .elasticsearch .cli .Command ;
12+
13+ public class KeyPairGeneratorToolProvider implements CliToolProvider {
14+ @ Override
15+ public String name () {
16+ return "key-pair-generator" ;
17+ }
18+
19+ @ Override
20+ public Command create () {
21+ return new KeyPairGeneratorTool ();
22+ }
23+ }
Original file line number Diff line number Diff line change @@ -45,10 +45,6 @@ public LicenseGeneratorTool() {
4545 licenseFileOption = parser .accepts ("licenseFile" , "license json spec file" ).withRequiredArg ();
4646 }
4747
48- public static void main (String [] args ) throws Exception {
49- exit (new LicenseGeneratorTool ().main (args , Terminal .DEFAULT ));
50- }
51-
5248 @ Override
5349 protected void printAdditionalHelp (Terminal terminal ) {
5450 terminal .println ("This tool generate elasticsearch license(s) for the provided" );
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+ * or more contributor license agreements. Licensed under the Elastic License
4+ * 2.0; you may not use this file except in compliance with the Elastic License
5+ * 2.0.
6+ */
7+
8+ package org .elasticsearch .license .licensor .tools ;
9+
10+ import org .elasticsearch .cli .CliToolProvider ;
11+ import org .elasticsearch .cli .Command ;
12+
13+ public class LicenseGeneratorToolProvider implements CliToolProvider {
14+ @ Override
15+ public String name () {
16+ return "license-generator" ;
17+ }
18+
19+ @ Override
20+ public Command create () {
21+ return new LicenseGeneratorTool ();
22+ }
23+ }
Original file line number Diff line number Diff line change @@ -44,10 +44,6 @@ public LicenseVerificationTool() {
4444 licenseFileOption = parser .accepts ("licenseFile" , "license json spec file" ).withRequiredArg ();
4545 }
4646
47- public static void main (String [] args ) throws Exception {
48- exit (new LicenseVerificationTool ().main (args , Terminal .DEFAULT ));
49- }
50-
5147 @ Override
5248 protected void execute (Terminal terminal , OptionSet options ) throws Exception {
5349 Path publicKeyPath = parsePath (publicKeyPathOption .value (options ));
You can’t perform that action at this time.
0 commit comments