From a74167dd2ed5a735ea08f46cd49e9e26c00be4f3 Mon Sep 17 00:00:00 2001 From: Matthias Steffens Date: Tue, 10 Oct 2023 18:02:31 +0200 Subject: [PATCH] #1108 Removes again the --help option from install_solr_docker.sh as this is not a user-facing script but just used as part of automatic testing --- bin/install_solr_docker.sh | 48 +++++++------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/bin/install_solr_docker.sh b/bin/install_solr_docker.sh index 3bbc8fb61..2873579b0 100755 --- a/bin/install_solr_docker.sh +++ b/bin/install_solr_docker.sh @@ -9,43 +9,7 @@ script_name="$(basename "$0")" # Define variables and their default values version="9.3.0" -# Define colors -DEFAULT='\033[0;33m' # Purple color for default values -OPTION='\033[1;32m' # Green -NC='\033[0m' # No Color - -# Print command line help to stderr -displayHelp() { - echo "Usage: $script_name [OPTIONS]" >&2 - echo - echo -e "This script will install Solr version 9.3.0, unless" - echo -e "option ${OPTION}--version${NC} is specified with another Solr version." - echo - echo "Options:" - echo - echo -e " ${OPTION}--help${NC} (${OPTION}-h${NC}) Print out help" - echo - echo -e " DEFAULT" - echo -e " ${OPTION}--version${NC} Solr version (${DEFAULT}$version${NC})" - echo - echo "Examples:" - echo - echo -e " $script_name" - echo -e " $script_name ${OPTION}--help${NC}" - echo -e " $script_name ${OPTION}--version${NC} ${DEFAULT}7.7.2${NC}" - echo - exit 1 -} - -# Display command line help if '-h' or '--help' is given as first option -if [ $# -gt 0 ]; then - if [[ $1 == "-h" || $1 == "--help" ]]; then - displayHelp - exit 0 - fi -fi - -# Parse any other command line options +# Parse command line options while [ $# -gt 0 ]; do if [[ $1 == "--"* ]]; then # only deal with long options if [[ -n "$2" && $2 != "-"* ]]; then # ignore options without a value @@ -62,18 +26,22 @@ while [ $# -gt 0 ]; do shift done +# Download Solr version if [[ "$version" =~ ^[1-8]\.[0-9]+\.[0-9]+$ ]]; then SOLR_VERSION="$version" ant download-solr -DsolrVersion=$SOLR_VERSION -DdownloadDir=./downloads -elif [[ "$version" =~ ^(9|[1-9][0-9]+)\.[0-9]+\.[0-9]+$ ]]; then +elif [[ "$version" =~ ^(9|[1-9][0-9]+)\.[0-9]+\.[0-9]+$ ]]; then # new archive URL for versions >9.0.0 SOLR_VERSION="$version" - wget -q "https://archive.apache.org/dist/solr/solr/$SOLR_VERSION/solr-$SOLR_VERSION.tgz" -O - | tar -xz + SOLR_URL="https://archive.apache.org/dist/solr/solr/$SOLR_VERSION/solr-$SOLR_VERSION.tgz" + echo "Getting: $SOLR_URL" + wget -q $SOLR_URL -O - | tar -xz else echo "Unrecognized version number" - echo -e "The ${OPTION}--version${NC} option requires a 3-digit version number, e.g.: 9.3.0" + echo -e "The --version option requires a 3-digit version number, e.g.: 9.3.0" exit 1 fi +# Configure & start Solr cd solr-$SOLR_VERSION ./bin/solr start -force ./bin/solr create -c opus4 -force