]> source.dussan.org Git - sonarqube.git/commitdiff
Support edition aliases in start script
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 13 Jun 2018 09:35:56 +0000 (11:35 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 14 Jun 2018 09:50:35 +0000 (11:50 +0200)
scripts/editions.sh
scripts/start.sh

index 7ccad91acd5ad9909607c2cd050d277af52a8ad9..ce8d0d07fe6c6c87053ba5ca840bebc87dc10115 100755 (executable)
@@ -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"
 }
index 6e6b1ffabb56e2995ae81676f7e2a56d9b337158..941b0ba1c97e38a42e7ace90038f97321c4321e0 100755 (executable)
@@ -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