Apache Solr open-source search software
SOLR-16457: Use pwd -P (#1282)
Kevin Risdena187c9e86ccd
diff --git a/solr/bin/solr b/solr/bin/solrindex 73394d66a56..e29247c18a1 100644--- a/solr/bin/solr+++ b/solr/bin/solr@@ -87,7 +87,7 @@ doneCDPATH='' # Prevent "file or directory not found" for 'cdpath' usersSOLR_TIP=$(dirname "$SOLR_SCRIPT")/..# shellcheck disable=SC2164-SOLR_TIP=$(cd "$SOLR_TIP"; pwd)+SOLR_TIP=$(cd "$SOLR_TIP"; pwd -P)DEFAULT_SERVER_DIR="$SOLR_TIP/server"# If an include wasn't specified in the environment, then search for one...@@ -1511,7 +1511,7 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; thenfiif [[ "$2" == "." || "$2" == "./" || "$2" == ".." || "$2" == "../" ]]; then- SOLR_SERVER_DIR="$(pwd)/$2"+ SOLR_SERVER_DIR="$(pwd -P)/$2"else# see if the arg value is relative to the tip vs full pathif [[ "$2" != /* ]] && [[ -d "$SOLR_TIP/$2" ]]; then@@ -1558,8 +1558,8 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; thenif [ -z "${SOLR_HOME:-}" ]; thenSOLR_HOME="$SOLR_SERVER_DIR/solr"elif [[ $SOLR_HOME != /* ]]; then- if [[ -d "$(pwd)/$SOLR_HOME" ]]; then- SOLR_HOME="$(pwd)/$SOLR_HOME"+ if [[ -d "$(pwd -P)/$SOLR_HOME" ]]; then+ SOLR_HOME="$(pwd -P)/$SOLR_HOME"elif [[ -d "$SOLR_SERVER_DIR/$SOLR_HOME" ]]; thenSOLR_HOME="$SOLR_SERVER_DIR/$SOLR_HOME"SOLR_PID_DIR="$SOLR_HOME"@@ -1660,7 +1660,7 @@ if [ $# -gt 0 ]; thenfiif [[ "$2" == "." || "$2" == "./" || "$2" == ".." || "$2" == "../" ]]; then- SOLR_SERVER_DIR="$(pwd)/$2"+ SOLR_SERVER_DIR="$(pwd -P)/$2"else# see if the arg value is relative to the tip vs full pathif [[ "$2" != /* ]] && [[ -d "$SOLR_TIP/$2" ]]; then@@ -1958,8 +1958,8 @@ fiif [ -z "${SOLR_HOME:-}" ]; thenSOLR_HOME="$SOLR_SERVER_DIR/solr"elif [[ $SOLR_HOME != /* ]]; then- if [[ -d "$(pwd)/$SOLR_HOME" ]]; then- SOLR_HOME="$(pwd)/$SOLR_HOME"+ if [[ -d "$(pwd -P)/$SOLR_HOME" ]]; then+ SOLR_HOME="$(pwd -P)/$SOLR_HOME"elif [[ -d "$SOLR_SERVER_DIR/$SOLR_HOME" ]]; thenSOLR_HOME="$SOLR_SERVER_DIR/$SOLR_HOME"SOLR_PID_DIR="$SOLR_HOME"diff --git a/solr/docker/templates/Dockerfile.body.template b/solr/docker/templates/Dockerfile.body.templateindex 50e2518368e..63ac7334718 100644--- a/solr/docker/templates/Dockerfile.body.template+++ b/solr/docker/templates/Dockerfile.body.template@@ -45,7 +45,6 @@ ENV SOLR_USER="solr" \SOLR_PID_DIR=/var/solr \SOLR_LOGS_DIR=/var/solr/logs \LOG4J_PROPS=/var/solr/log4j2.xml \- SOLR_SERVER_DIR="/opt/solr-${SOLR_VERSION}/server" \SOLR_JETTY_HOST="0.0.0.0"RUN set -ex; \