From: Duarte Meneses Date: Wed, 13 Jun 2018 09:35:56 +0000 (+0200) Subject: Support edition aliases in start script X-Git-Tag: 7.5~979 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=323edff58d259c3f49ba74ab2294276cbfee78a5;p=sonarqube.git Support edition aliases in start script --- diff --git a/scripts/editions.sh b/scripts/editions.sh index 7ccad91acd5..ce8d0d07fe6 100755 --- a/scripts/editions.sh +++ b/scripts/editions.sh @@ -2,49 +2,40 @@ set -euo pipefail -DEFAULT_EDITION="oss" -EDITIONS="oss" +DEFAULT_EDITION="community" +EDITIONS="community" toLower() { echo "$1" | tr '[:upper:]' '[:lower:]' } -checkEditionArgument() { - local editionArg="$1" - local lowerEditionArg=$(toLower $editionArg) - - if [ "$lowerEditionArg" = "$DEFAULT_EDITION" ]; then - return - fi - +checkEdition() { for t in $EDITIONS; do - if [ "$lowerEditionArg" = "$t" ]; then + if [ "$1" = "$t" ]; then return fi done - echo "Unsupported edition $editionArg" + echo "Unsupported edition $1" exit 1 } + +resolveAliases() { + local lowerEditionAlias=$(toLower "$1") + + case "$lowerEditionAlias" in + oss ) + echo community ;; + * ) + echo "$lowerEditionAlias" ;; + esac +} + distributionDirOf() { - local edition="$1" - - if [ "$edition" = "oss" ]; then - echo "sonar-application/build/distributions/" - else - echo "unsupported edition $edition" - exit 1 - fi + echo "sonar-application/build/distributions/" } baseFileNameOf() { - local edition="$1" - - if [ "$edition" = "oss" ]; then - echo "sonar-application" - else - echo "unsupported edition $edition" - exit 1 - fi + echo "sonar-application" } diff --git a/scripts/start.sh b/scripts/start.sh index 6e6b1ffabb5..941b0ba1c97 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -2,8 +2,12 @@ ############################### # usage: start.sh [ -e ARG ] [ -p ARG ] [ -l ARG ] # -e ARG: edition to run -# valid values are 'oss' (Open Source), 'dev' (Developer), 'ent' (Enterprise) and 'dce' (Data Center) (case insensitive) -# default value is 'oss'. +# valid values are (case insensitive): +# 'community', 'oss', +# 'developer', 'dev', +# 'enterprise', 'ent', +# 'datacenter', 'dc', 'dce'. +# default value is 'community'. # -p ARG: name(s) of patch separated by colon (name of patch is filename without extension) # -l ARG: name of log file to display. # valid values are 'all', 'sonar', 'web', 'ce' and 'es' (case insensitive). @@ -39,7 +43,8 @@ while getopts ":e:p:l:" opt; do esac done -checkEditionArgument "$EDITION" +EDITION=$(resolveAliases "$EDITION") +checkEdition "$EDITION" checkLogArgument "$LOG" if [[ "${OSTYPE:-}" == "darwin"* ]]; then @@ -48,7 +53,7 @@ else OS='linux-x86-64' fi -OSS_ZIP="$(distributionDirOf "oss")/$(baseFileNameOf "oss")-*.zip" +OSS_ZIP="$(distributionDirOf "community")/$(baseFileNameOf "community")-*.zip" if ! ls ${OSS_ZIP} &> /dev/null; then echo 'Sources are not built' "$ROOT"/build.sh