Apache Lucene open-source search software
SOLR-11084 Issue with starting script with solr.home (-s) == solr
Erick Erickson7109820e01e1
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex a7b394efaf2..57536a59818 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -98,6 +98,8 @@ Bug Fixes* SOLR-11228: Exclude static html files in the partials directory from authentication and authorization checks. The UIwill open correctly with kerberos enabled (Ishan Chattopadhyaya, Varun Thacker)+* SOLR-11084: Issue with starting script with solr.home (-s) == solr (Leil Ireson, Amrit Sarkar via Erick Erickson)+Optimizations----------------------diff --git a/solr/bin/solr b/solr/bin/solrindex eeb6da4c049..c80c4fef4cc 100755--- a/solr/bin/solr+++ b/solr/bin/solr@@ -338,7 +338,8 @@ function print_usage() {echo " while reusing the same server directory set using the -d parameter. If set, the"echo " specified directory should contain a solr.xml file, unless solr.xml exists in Zookeeper."echo " This parameter is ignored when running examples (-e), as the solr.solr.home depends"- echo " on which example is run. The default value is server/solr."+ echo " on which example is run. The default value is server/solr. If passed relative dir,"+ echo " validation with current dir will be done, before trying default server/<dir>"echo ""echo " -t <dir> Sets the solr.data.home system property, where Solr will store data (index)."echo " If not set, Solr uses solr.solr.home for config and data."@@ -481,23 +482,23 @@ function print_usage() {print_short_zk_usage ""echo " Be sure to check the Solr logs in case of errors."echo ""- echo " -z zkHost Optional Zookeeper connection string for all commands. If specified it"+ echo " -z zkHost Optional Zookeeper connection string for all commands. If specified it"echo " overrides the 'ZK_HOST=...'' defined in solr.in.sh."echo ""echo " upconfig uploads a configset from the local machine to Zookeeper. (Backcompat: -upconfig)"echo ""echo " downconfig downloads a configset from Zookeeper to the local machine. (Backcompat: -downconfig)"echo ""- echo " -n configName Name of the configset in Zookeeper that will be the destination of"+ echo " -n configName Name of the configset in Zookeeper that will be the destination of"echo " 'upconfig' and the source for 'downconfig'."echo ""- echo " -d confdir The local directory the configuration will be uploaded from for"+ echo " -d confdir The local directory the configuration will be uploaded from for"echo " 'upconfig' or downloaded to for 'downconfig'. If 'confdir' is a child of"echo " ...solr/server/solr/configsets' then the configs will be copied from/to"echo " that directory. Otherwise it is interpreted as a simple local path."echo ""echo " cp copies files or folders to/from Zookeeper or Zokeeper -> Zookeeper"- echo " -r Recursively copy <src> to <dst>. Command will fail if <src> has children and "+ echo " -r Recursively copy <src> to <dst>. Command will fail if <src> has children and "echo " -r is not specified. Optional"echo ""echo " <src>, <dest> : [file:][/]path/to/local/file or zk:/path/to/zk/node"@@ -527,9 +528,9 @@ function print_usage() {echo " Wildcards are supported when copying from local, trailing only and must be quoted."echo ""echo " rm deletes files or folders on Zookeeper"- echo " -r Recursively delete if <path> is a directory. Command will fail if <path>"+ echo " -r Recursively delete if <path> is a directory. Command will fail if <path>"echo " has children and -r is not specified. Optional"- echo " <path> : [zk:]/path/to/zk/node. <path> may not be the root ('/')"+ echo " <path> : [zk:]/path/to/zk/node. <path> may not be the root ('/')"echo ""echo " mv moves (renames) znodes on Zookeeper"echo " <src>, <dest> : Zookeeper nodes, the 'zk:' prefix is optional."@@ -1328,14 +1329,15 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; thenecho -e "\nSolr server directory $SOLR_SERVER_DIR not found!\n"exit 1fi+if [ -z "$SOLR_HOME" ]; thenSOLR_HOME="$SOLR_SERVER_DIR/solr"- else- if [[ $SOLR_HOME != /* ]] && [[ -d "$SOLR_SERVER_DIR/$SOLR_HOME" ]]; then+ elif [[ $SOLR_HOME != /* ]]; then+ if [[ -d "`pwd`/$SOLR_HOME" ]]; then+ SOLR_HOME="$(pwd)/$SOLR_HOME"+ elif [[ -d "$SOLR_SERVER_DIR/$SOLR_HOME" ]]; thenSOLR_HOME="$SOLR_SERVER_DIR/$SOLR_HOME"SOLR_PID_DIR="$SOLR_HOME"- elif [[ $SOLR_HOME != /* ]] && [[ -d "`pwd`/$SOLR_HOME" ]]; then- SOLR_HOME="$(pwd)/$SOLR_HOME"fifi@@ -1674,12 +1676,12 @@ fiif [ -z "$SOLR_HOME" ]; thenSOLR_HOME="$SOLR_SERVER_DIR/solr"-else- if [[ $SOLR_HOME != /* ]] && [[ -d "$SOLR_SERVER_DIR/$SOLR_HOME" ]]; then+elif [[ $SOLR_HOME != /* ]]; then+ if [[ -d "`pwd`/$SOLR_HOME" ]]; then+ SOLR_HOME="$(pwd)/$SOLR_HOME"+ elif [[ -d "$SOLR_SERVER_DIR/$SOLR_HOME" ]]; thenSOLR_HOME="$SOLR_SERVER_DIR/$SOLR_HOME"SOLR_PID_DIR="$SOLR_HOME"- elif [[ $SOLR_HOME != /* ]] && [[ -d "`pwd`/$SOLR_HOME" ]]; then- SOLR_HOME="$(pwd)/$SOLR_HOME"fifidiff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmdindex 9a2ca9b45f0..ce2350b2938 100644--- a/solr/bin/solr.cmd+++ b/solr/bin/solr.cmd@@ -310,7 +310,8 @@ goto done@echo while reusing the same server directory set using the -d parameter. If set, the@echo specified directory should contain a solr.xml file, unless solr.xml exists in Zookeeper.@echo This parameter is ignored when running examples (-e), as the solr.solr.home depends-@echo on which example is run. The default value is server/solr.+@echo on which example is run. The default value is server/solr. If passed a relative dir+@echo validation with the current dir will be done before trying the default server/<dir>@echo.@echo -t dir Sets the solr.data.home system property, used as root for ^<instance_dir^>/data directories.@echo If not set, Solr uses solr.solr.home for both config and data.@@ -1426,7 +1427,6 @@ if "!CREATE_PORT!"=="" (goto err)-if "!CREATE_CONFDIR!"=="_default" (echo WARNING: Using _default configset. Data driven schema functionality is enabled by default, which isecho NOT RECOMMENDED for production use.