SOLR-7013: use unzip if jar is not available (merged from r1653943)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1653945 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2015-01-22 17:13:20 +00:00
parent 8c7f42d6f8
commit 4c17c799fc
1 changed files with 15 additions and 1 deletions

View File

@ -49,6 +49,20 @@ SOLR_SCRIPT="$0"
verbose=false
THIS_OS=`uname -s`
hasLsof=$(which lsof)
hasJar=$(which jar 2>/dev/null)
hasUnzip=$(which unzip 2>/dev/null)
if [ ${hasJar} ]; then
unzipCommand="$hasJar xf"
else
if [ ${hasUnzip} ]; then
unzipCommand="$hasUnzip"
else
echo -e "This script requires extracting a WAR file with either the jar or unzip utility, please install these utilities or contact your administrator for assistance."
exit 1
fi
fi
stop_all=false
# for now, we don't support running this script from cygwin due to problems
@ -356,7 +370,7 @@ function run_tool() {
# Extract the solr.war if it hasn't been done already (so we can access the SolrCLI class)
if [[ -e $DEFAULT_SERVER_DIR/webapps/solr.war && ! -d "$DEFAULT_SERVER_DIR/solr-webapp/webapp" ]]; then
(mkdir -p $DEFAULT_SERVER_DIR/solr-webapp/webapp && cd $DEFAULT_SERVER_DIR/solr-webapp/webapp && jar xf $DEFAULT_SERVER_DIR/webapps/solr.war)
(mkdir -p $DEFAULT_SERVER_DIR/solr-webapp/webapp && cd $DEFAULT_SERVER_DIR/solr-webapp/webapp && "$unzipCommand" $DEFAULT_SERVER_DIR/webapps/solr.war)
fi
"$JAVA" $SOLR_SSL_OPTS -Dsolr.install.dir=$SOLR_TIP -Dlog4j.configuration=file:$DEFAULT_SERVER_DIR/scripts/cloud-scripts/log4j.properties \