You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by eh...@apache.org on 2015/01/22 18:12:34 UTC

svn commit: r1653944 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/bin/ solr/bin/solr

Author: ehatcher
Date: Thu Jan 22 17:12:33 2015
New Revision: 1653944

URL: http://svn.apache.org/r1653944
Log:
SOLR-7013: use unzip if jar is not available (merged from r1653943)

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/bin/   (props changed)
    lucene/dev/branches/branch_5x/solr/bin/solr

Modified: lucene/dev/branches/branch_5x/solr/bin/solr
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/bin/solr?rev=1653944&r1=1653943&r2=1653944&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/bin/solr (original)
+++ lucene/dev/branches/branch_5x/solr/bin/solr Thu Jan 22 17:12:33 2015
@@ -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 \