fix kc.sh to work with cygwin environments

This commit is contained in:
Knut Sander 2022-05-20 17:34:05 +02:00 committed by Pedro Igor
parent bb6b5abfa1
commit 2cbbde499b

View file

@ -2,6 +2,7 @@
case "`uname`" in
CYGWIN*)
IS_CYGWIN="true"
CFILE=`cygpath "$0"`
RESOLVED_NAME=`readlink -f "$CFILE"`
;;
@ -23,7 +24,19 @@ fi
GREP="grep"
DIRNAME=`dirname "$RESOLVED_NAME"`
SERVER_OPTS="-Dkc.home.dir='$DIRNAME'/../ -Djboss.server.config.dir='$DIRNAME'/../conf -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dquarkus-log-max-startup-records=10000"
abs_path () {
if [ -z $IS_CYGWIN ] ; then
echo "$DIRNAME/$1"
else
cygpath -w "$DIRNAME/$1"
fi
}
SERVER_OPTS="-Dkc.home.dir='$(abs_path '..')'"
SERVER_OPTS="$SERVER_OPTS -Djboss.server.config.dir='$(abs_path '../conf')'"
SERVER_OPTS="$SERVER_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
SERVER_OPTS="$SERVER_OPTS -Dquarkus-log-max-startup-records=10000"
CLASSPATH_OPTS="'"`abs_path "../lib/quarkus-run.jar"`"'"
DEBUG_MODE="${DEBUG:-false}"
DEBUG_PORT="${DEBUG_PORT:-8787}"
@ -84,7 +97,7 @@ fi
# Set debug settings if not already set
if [ "$DEBUG_MODE" = "true" ]; then
DEBUG_OPT=`echo $JAVA_OPTS | $GREP "\-agentlib:jdwp"`
DEBUG_OPT=`echo "$JAVA_OPTS" | $GREP "\-agentlib:jdwp"`
if [ "x$DEBUG_OPT" = "x" ]; then
JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=$DEBUG_PORT,server=y,suspend=$DEBUG_SUSPEND"
else
@ -92,12 +105,10 @@ if [ "$DEBUG_MODE" = "true" ]; then
fi
fi
CLASSPATH_OPTS="'$DIRNAME'/../lib/quarkus-run.jar"
JAVA_RUN_OPTS="$JAVA_OPTS $SERVER_OPTS -cp $CLASSPATH_OPTS io.quarkus.bootstrap.runner.QuarkusEntryPoint ${CONFIG_ARGS#?}"
if [[ (! $CONFIG_ARGS = *"--optimized"*) ]] && [[ ! "$CONFIG_ARGS" == " build"* ]] && [[ ! "$CONFIG_ARGS" == *"-h" ]] && [[ ! "$CONFIG_ARGS" == *"--help"* ]]; then
eval "$JAVA" -Dkc.config.build-and-exit=true $JAVA_RUN_OPTS
eval "'$JAVA'" -Dkc.config.build-and-exit=true $JAVA_RUN_OPTS
EXIT_CODE=$?
JAVA_RUN_OPTS="-Dkc.config.built=true $JAVA_RUN_OPTS"
if [ $EXIT_CODE != 0 ]; then
@ -105,4 +116,4 @@ if [[ (! $CONFIG_ARGS = *"--optimized"*) ]] && [[ ! "$CONFIG_ARGS" == " build"*
fi
fi
eval exec "${JAVA}" ${JAVA_RUN_OPTS}
eval exec "'$JAVA'" $JAVA_RUN_OPTS