From 4c17c799fc2d3d3e0ac4387fd548a9c1a4873941 Mon Sep 17 00:00:00 2001 From: Erik Hatcher Date: Thu, 22 Jan 2015 17:13:20 +0000 Subject: [PATCH] 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 --- solr/bin/solr | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/solr/bin/solr b/solr/bin/solr index ebe4c184bcd..ad7f4a148b6 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -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 \