diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2018-06-13 11:35:56 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-06-14 11:50:35 +0200 |
commit | 323edff58d259c3f49ba74ab2294276cbfee78a5 (patch) | |
tree | 950b5e2dd7c69cd26d0d64e661c55b6a9e18bd9d /scripts | |
parent | 964114c0da7b0f0ad0024072d14a74d7b7b98001 (diff) | |
download | sonarqube-323edff58d259c3f49ba74ab2294276cbfee78a5.tar.gz sonarqube-323edff58d259c3f49ba74ab2294276cbfee78a5.zip |
Support edition aliases in start script
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/editions.sh | 47 | ||||
-rwxr-xr-x | scripts/start.sh | 13 |
2 files changed, 28 insertions, 32 deletions
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 |