Apache Lucene open-source search software
SOLR-9508: Install script should check existence of tools, and add option to NOT start service
Jan Høydahlb894ab292d3f
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 0c069d91c51..bf81f39a77a 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -149,6 +149,9 @@ Other Changes* SOLR-9538: Relocate (BinaryResponse|JSON|Smile)Writer tests to org.apache.solr.responsewhich is the package of the classes they test. (Jonny Marks via Christine Poerschke)+* SOLR-9508: Install script install_solr_service.sh now checks existence of tools.+ New option -n to avoid starting service after installation (janhoy)+================== 6.2.1 ==================Bug Fixesdiff --git a/solr/bin/install_solr_service.sh b/solr/bin/install_solr_service.shold mode 100644new mode 100755index 3a8fb88bcab..73c0712a756--- a/solr/bin/install_solr_service.sh+++ b/solr/bin/install_solr_service.sh@@ -27,7 +27,7 @@ print_usage() {fiecho ""- echo "Usage: install_solr_service.sh path_to_solr_distribution_archive OPTIONS"+ echo "Usage: install_solr_service.sh <path_to_solr_distribution_archive> [OPTIONS]"echo ""echo " The first argument to the script must be a path to a Solr distribution archive, such as solr-5.0.0.tgz"echo " (only .tgz or .zip are supported formats for the archive)"@@ -48,10 +48,17 @@ print_usage() {echo ""echo " -f Upgrade Solr. Overwrite symlink and init script of previous installation."echo ""+ echo " -n Do not start Solr service after install, and do not abort on missing Java"+ echo ""echo " NOTE: Must be run as the root user"echo ""} # end print_usage+print_error() {+ echo $1+ exit 1+}+proc_version=`cat /etc/*-release 2>/dev/null`if [[ $? -gt 0 ]]; thenif [ -f "/proc/version" ]; then@@ -104,6 +111,7 @@ elseexit 1fi+SOLR_START=trueif [ $# -gt 1 ]; thenshiftwhile true; do@@ -152,6 +160,10 @@ if [ $# -gt 1 ]; thenSOLR_UPGRADE="YES"shift 1;;+ -n)+ SOLR_START=false+ shift 1+ ;;-help|-usage)print_usage ""exit 0@@ -172,6 +184,19 @@ if [ $# -gt 1 ]; thendonefi+# Test for availability of needed tools+if [[ $is_tar ]] ; then+ tar --version &>/dev/null || print_error "Script requires the 'tar' command"+else+ unzip -hh &>/dev/null || print_error "Script requires the 'unzip' command"+fi+if [[ $SOLR_START == "true" ]] ; then+ service --version &>/dev/null || print_error "Script requires the 'service' command"+ java -version &>/dev/null || print_error "Solr requires java, please install or set JAVA_HOME properly"+fi+lsof -h &>/dev/null || echo "We recommend installing the 'lsof' command for more stable start/stop of Solr"++if [ -z "$SOLR_EXTRACT_DIR" ]; thenSOLR_EXTRACT_DIR=/optfi@@ -334,6 +359,10 @@ echo "Service $SOLR_SERVICE installed."echo "Customize Solr startup configuration in /etc/default/$SOLR_SERVICE.in.sh"# start service-service "$SOLR_SERVICE" start-sleep 5-service "$SOLR_SERVICE" status+if [[ $SOLR_START == "true" ]] ; then+ service "$SOLR_SERVICE" start+ sleep 5+ service "$SOLR_SERVICE" status+else+ echo "Not starting Solr service (option -n given). Start manually with 'service $SOLR_SERVICE start'"+fi