diff --git a/bin/ignite.sh b/bin/ignite.sh index 8ef040cdb711b..0ba839f9f389e 100755 --- a/bin/ignite.sh +++ b/bin/ignite.sh @@ -1,4 +1,10 @@ -#!/bin/bash +#!/usr/bin/env bash +set -o nounset +set -o errexit +set -o pipefail +set -o errtrace +set -o functrace + # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -23,7 +29,7 @@ # # Import common functions. # -if [ "${IGNITE_HOME}" = "" ]; +if [ "${IGNITE_HOME:-}" = "" ]; then IGNITE_HOME_TMP="$(dirname "$(cd "$(dirname "$0")"; "pwd")")"; else IGNITE_HOME_TMP=${IGNITE_HOME}; fi @@ -45,7 +51,7 @@ checkJava # setIgniteHome -if [ "${DEFAULT_CONFIG}" == "" ]; then +if [ "${DEFAULT_CONFIG:-}" == "" ]; then DEFAULT_CONFIG=config/default-config.xml fi @@ -80,7 +86,7 @@ fi # Mac OS specific support to display correct name in the dock. osname=`uname` -if [ "${DOCK_OPTS}" == "" ]; then +if [ "${DOCK_OPTS:-}" == "" ]; then DOCK_OPTS="-Xdock:name=Ignite Node" fi @@ -134,7 +140,7 @@ fi # # Set main class to start service (grid node by default). # -if [ "${MAIN_CLASS}" = "" ]; then +if [ "${MAIN_CLASS:-}" = "" ]; then MAIN_CLASS=org.apache.ignite.startup.cmdline.CommandLineStartup fi @@ -147,7 +153,7 @@ fi # # Final JVM_OPTS for Java 9+ compatibility # -javaMajorVersion "${JAVA_HOME}/bin/java" +javaMajorVersion "${JAVA}" if [ $version -eq 8 ] ; then JVM_OPTS="\ diff --git a/bin/include/functions.sh b/bin/include/functions.sh index 7bdcefd8cf4dd..4edf0e60df7b2 100755 --- a/bin/include/functions.sh +++ b/bin/include/functions.sh @@ -1,4 +1,10 @@ -#!/bin/bash +#!/usr/bin/env bash +set -o nounset +set -o errexit +set -o pipefail +set -o errtrace +set -o functrace + # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -96,7 +102,7 @@ setIgniteHome() { # # Set IGNITE_HOME, if needed. # - if [ "${IGNITE_HOME}" = "" ]; then + if [ "${IGNITE_HOME:-}" = "" ]; then export IGNITE_HOME=${IGNITE_HOME_TMP} fi diff --git a/bin/include/parseargs.sh b/bin/include/parseargs.sh index 1efb48edd0793..759994d8cb1ab 100755 --- a/bin/include/parseargs.sh +++ b/bin/include/parseargs.sh @@ -1,4 +1,10 @@ -#!/bin/bash +#!/usr/bin/env bash +set -o nounset +set -o errexit +set -o pipefail +set -o errtrace +set -o functrace + # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -55,9 +61,9 @@ done # # Set 'file.encoding' to UTF-8 default if not specified otherwise # -case "${JVM_OPTS}" in +case "${JVM_OPTS:-}" in *-Dfile.encoding=*) ;; *) - JVM_OPTS="${JVM_OPTS} -Dfile.encoding=UTF-8";; + JVM_OPTS="${JVM_OPTS:-} -Dfile.encoding=UTF-8";; esac diff --git a/bin/include/setenv.sh b/bin/include/setenv.sh index 4b82cf9c9ba3f..7290ccd8e73e0 100755 --- a/bin/include/setenv.sh +++ b/bin/include/setenv.sh @@ -1,4 +1,10 @@ -#!/bin/bash +#!/usr/bin/env bash +set -o nounset +set -o errexit +set -o pipefail +set -o errtrace +set -o functrace + # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -27,7 +33,7 @@ # # Check IGNITE_HOME. # -if [ "${IGNITE_HOME}" = "" ]; then +if [ "${IGNITE_HOME:-}" = "" ]; then echo $0", ERROR: Ignite installation folder is not found." echo "Please create IGNITE_HOME variable pointing to location of" echo "Ignite installation folder." @@ -62,12 +68,12 @@ IFS=$(echo -en "\n\b") for file in ${IGNITE_HOME}/libs/* do if [ -d ${file} ] && [ "${file}" != "${IGNITE_HOME}"/libs/optional ]; then - IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/* + IGNITE_LIBS=${IGNITE_LIBS:-}${SEP}${file}/* fi done IFS=$SAVEIFS -if [ "${USER_LIBS}" != "" ]; then - IGNITE_LIBS=${USER_LIBS}${SEP}${IGNITE_LIBS} +if [ "${USER_LIBS:-}" != "" ]; then + IGNITE_LIBS=${USER_LIBS:-}${SEP}${IGNITE_LIBS} fi