Find .conf file next to symlink to jar that's using the launch script

See gh-8988
This commit is contained in:
Ali Shahbour
2017-04-25 10:51:31 +03:00
committed by Andy Wilkinson
parent b59bc20f58
commit 56a5888008
4 changed files with 28 additions and 2 deletions

View File

@@ -32,7 +32,13 @@ WORKING_DIR="$(pwd)"
cd "$(dirname "$0")" || exit 1
[[ -z "$jarfile" ]] && jarfile=$(pwd)/$(basename "$0")
while [[ -L "$jarfile" ]]; do
[[ "$jarfile" =~ init\.d ]] && init_script=$(basename "$jarfile")
if [[ "$jarfile" =~ init\.d ]]; then
init_script=$(basename "$jarfile")
else
# while looping check if their is any configuration file
configfile="${jarfile%.*}.conf"
[[ -r ${configfile} ]] && source "${configfile}"
fi
jarfile=$(readlink "$jarfile")
cd "$(dirname "$jarfile")" || exit 1
jarfile=$(pwd)/$(basename "$jarfile")
@@ -45,7 +51,6 @@ configfile="$(basename "${jarfile%.*}.conf")"
# Initialize CONF_FOLDER location defaulting to jarfolder
[[ -z "$CONF_FOLDER" ]] && CONF_FOLDER="{{confFolder:${jarfolder}}}"
# shellcheck source=/dev/null
[[ -r "${CONF_FOLDER}/${configfile}" ]] && source "${CONF_FOLDER}/${configfile}"