Skip to content

Commit 141b631

Browse files
authored
added optional unix script to run imagetool (#70)
1 parent 50540f9 commit 141b631

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

imagetool/src/main/bin/imagetool.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
#Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
#
4+
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
5+
#
6+
# imagetool.sh
7+
8+
set -e
9+
10+
#
11+
# Make sure that the JAVA_HOME environment variable is set to point to a
12+
# JDK 8 or higher JVM (and that it isn't OpenJDK).
13+
#
14+
if [ -z "${JAVA_HOME}" ]; then
15+
echo "Please set the JAVA_HOME environment variable to match the location of your Java 8 installation." >&2
16+
exit -1
17+
elif [ ! -d "${JAVA_HOME}" ]; then
18+
echo "Your JAVA_HOME environment variable points to a non-existent directory: ${JAVA_HOME}" >&2
19+
exit -1
20+
fi
21+
22+
if [ -x "${JAVA_HOME}/bin/java" ]; then
23+
JAVA_EXE=${JAVA_HOME}/bin/java
24+
else
25+
echo "Java executable at ${JAVA_HOME}/bin/java either does not exist or is not executable" >&2
26+
exit -1
27+
fi
28+
29+
JVM_OUTPUT=`${JAVA_EXE} -version 2>&1`
30+
case "${JVM_OUTPUT}" in
31+
*OpenJDK*)
32+
echo "JAVA_HOME ${JAVA_HOME} contains OpenJDK, which is not supported" >&2
33+
exit -1
34+
;;
35+
esac
36+
37+
function read_link() {
38+
PREV_DIR=`pwd`
39+
CHASE_LINK=$1
40+
cd `dirname $CHASE_LINK`
41+
CHASE_LINK=`basename $CHASE_LINK`
42+
while [ -L "$CHASE_LINK" ]
43+
do
44+
CHASE_LINK=`readlink $CHASE_LINK`
45+
cd `dirname $CHASE_LINK`
46+
CHASE_LINK=`basename $CHASE_LINK`
47+
done
48+
_DIR=`pwd -P`
49+
RESULT_PATH=$_DIR/$CHASE_LINK
50+
cd $PREV_DIR
51+
echo $RESULT_PATH
52+
}
53+
54+
script_dir=$( dirname "$( read_link "${BASH_SOURCE[0]}" )" )
55+
IMAGETOOL_HOME=`cd "${script_dir}/.." ; pwd`
56+
export IMAGETOOL_HOME
57+
${JAVA_HOME}/bin/java -cp "${IMAGETOOL_HOME}/lib/*" -Djava.util.logging.config.file=${IMAGETOOL_HOME}/bin/logging.properties com.oracle.weblogic.imagetool.cli.CLIDriver $@
58+

imagetool/src/main/bin/setup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ umask 27
99
# Make sure that the JAVA_HOME environment variable is set to point to a
1010
# JDK 8 or higher JVM (and that it isn't OpenJDK).
1111
#
12-
if [ "${JAVA_HOME}" = "" ]; then
13-
echo "Please set the JAVA_HOME environment variable to point to a Java 8 installation" >&2
12+
if [ -z "${JAVA_HOME}" ]; then
13+
echo "Please set the JAVA_HOME environment variable to match the location of your Java 8 installation." >&2
1414
return
1515
elif [ ! -d "${JAVA_HOME}" ]; then
16-
echo "Your JAVA_HOME environment variable to points to a non-existent directory: ${JAVA_HOME}" >&2
16+
echo "Your JAVA_HOME environment variable points to a non-existent directory: ${JAVA_HOME}" >&2
1717
return
1818
fi
1919

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/UpdateImage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
@Command(
3131
name = "update",
32-
description = "Update WebLogic docker image with selected patches",
32+
description = "Update an existing docker image that was previously created with the image tool",
3333
requiredOptionMarker = '*',
3434
abbreviateSynopsis = true
3535
)

0 commit comments

Comments
 (0)