aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2018-05-30 16:10:05 +0200
committerSonarTech <sonartech@sonarsource.com>2018-06-12 20:21:01 +0200
commit7e59b1e27f80a5d466913a3b9040ee82d1ae2e52 (patch)
tree08b5777d40923468cefe2fc455bd3f4233ea267b
parent77f771b0411d1d5bc92b757bad1bcbc18921e6b4 (diff)
downloadsonarqube-7e59b1e27f80a5d466913a3b9040ee82d1ae2e52.tar.gz
sonarqube-7e59b1e27f80a5d466913a3b9040ee82d1ae2e52.zip
[scripts] declare bash function in portable fashion
-rwxr-xr-xscripts/editions.sh10
-rwxr-xr-xscripts/generate_batch_reports.sh8
-rwxr-xr-xscripts/logs.sh8
-rwxr-xr-xscripts/property_utils.sh6
-rwxr-xr-xscripts/stop.sh2
-rwxr-xr-xtravis.sh8
6 files changed, 21 insertions, 21 deletions
diff --git a/scripts/editions.sh b/scripts/editions.sh
index fadf5cbe03a..4f001c0617c 100755
--- a/scripts/editions.sh
+++ b/scripts/editions.sh
@@ -5,11 +5,11 @@ set -euo pipefail
DEFAULT_EDITION="oss"
EDITIONS="oss"
-function toLower() {
+toLower() {
echo "$1" | tr '[:upper:]' '[:lower:]'
}
-function checkEditionArgument() {
+checkEditionArgument() {
local editionArg="$1"
local lowerEditionArg=$(toLower $editionArg)
@@ -27,7 +27,7 @@ function checkEditionArgument() {
exit 1
}
-function distributionDirOf() {
+distributionDirOf() {
local edition="$1"
if [ "$edition" = "oss" ]; then
@@ -38,7 +38,7 @@ function distributionDirOf() {
fi
}
-function baseFileNameOf() {
+baseFileNameOf() {
local edition="$1"
if [ "$edition" = "oss" ]; then
@@ -49,7 +49,7 @@ function baseFileNameOf() {
fi
}
-function targetDirOf() {
+targetDirOf() {
local edition="$1"
if [ "$edition" = "oss" ]; then
diff --git a/scripts/generate_batch_reports.sh b/scripts/generate_batch_reports.sh
index 247fd1580f2..acd64769c28 100755
--- a/scripts/generate_batch_reports.sh
+++ b/scripts/generate_batch_reports.sh
@@ -16,11 +16,11 @@
set -euo pipefail
-function clean() {
+clean() {
rm -Rf $BUILD_DIR
}
-function createPrivateClone() {
+createPrivateClone() {
BRANCH=$(git symbolic-ref -q HEAD)
BRANCH=${BRANCH##refs/heads/}
BRANCH=${BRANCH:-HEAD}
@@ -39,7 +39,7 @@ function createPrivateClone() {
cd ${BUILD_DIR}${RELATIVE_PATH}
}
-function showHelp() {
+showHelp() {
echo "Usage: $0 -d DIR_PATH [ -l integer ] [ -h URL ] [ -u string ] [ -p string ]
-d : path to directory where batch report bumpds will be created
-l : number of commit in the past (optional: default is $HISTORY_LENGTH)
@@ -48,7 +48,7 @@ function showHelp() {
-p : password to authentication on the SQ instance (optional: default is $SONAR_USER)"
}
-function checkOptions() {
+checkOptions() {
if [[ -z "$DUMP_DIR" ]]; then
>&2 echo "-d option is mandatory"
showHelp
diff --git a/scripts/logs.sh b/scripts/logs.sh
index e023847fb8b..f5078ee47fa 100755
--- a/scripts/logs.sh
+++ b/scripts/logs.sh
@@ -23,11 +23,11 @@ DEFAULT_LOG="all"
DEFAULT_LINES="25"
LOGS="sonar web ce es"
-function toLower() {
+toLower() {
echo "$1" | tr '[:upper:]' '[:lower:]'
}
-function checkLogArgument() {
+checkLogArgument() {
local logArg="$1"
local lowerLogArg=$(toLower $logArg)
@@ -45,7 +45,7 @@ function checkLogArgument() {
exit 1
}
-function buildTailArgs() {
+buildTailArgs() {
local logArg="$(toLower $1)"
local logLines="$2"
local res=""
@@ -59,7 +59,7 @@ function buildTailArgs() {
echo "$res"
}
-function doTail() {
+doTail() {
local logArg="$1"
local logLines="${2:-"$DEFAULT_LINES"}"
TAIL_ARG=$(buildTailArgs "$logArg" "$logLines")
diff --git a/scripts/property_utils.sh b/scripts/property_utils.sh
index 57b94f23ee5..0232d0cd1d1 100755
--- a/scripts/property_utils.sh
+++ b/scripts/property_utils.sh
@@ -8,12 +8,12 @@
set -euo pipefail
-function cnt_lines {
+cnt_lines() {
local FILE=$1
wc -l < "$FILE"
}
-function write_prop {
+write_prop() {
local PROPERTY=$1
local VALUE=$2
local FILE=$3
@@ -25,7 +25,7 @@ function write_prop {
echo "${PROPERTY}=${VALUE}" >> "$FILE"
}
-function set_property {
+set_property() {
local PROPERTY=$1
local VALUE=$2
local FILE=$3
diff --git a/scripts/stop.sh b/scripts/stop.sh
index 8b94cd2d2a7..8c2cdd8a936 100755
--- a/scripts/stop.sh
+++ b/scripts/stop.sh
@@ -17,7 +17,7 @@ else
OS='linux-x86-64'
fi
-function stopAny() {
+stopAny() {
for edition in $EDITIONS; do
SONAR_SH="$(distributionDirOf "$edition")/$(targetDirOf "$edition")/sonarqube-*/bin/$OS/sonar.sh"
if ls $SONAR_SH &> /dev/null; then
diff --git a/travis.sh b/travis.sh
index a9542844056..85748c6cae1 100755
--- a/travis.sh
+++ b/travis.sh
@@ -9,7 +9,7 @@ set -euo pipefail
# JDK is kept in cache. It does not need to be downloaded from Oracle
# at each build.
#
-function installJdk8 {
+installJdk8() {
echo "Setup JDK 1.8u171"
mkdir -p ~/jvm
pushd ~/jvm > /dev/null
@@ -26,7 +26,7 @@ function installJdk8 {
#
# Configure Maven settings and install some script utilities
#
-function configureTravis {
+configureTravis() {
mkdir -p ~/.local
curl -sSL https://github.com/SonarSource/travis-utils/tarball/v47 | tar zx --strip-components 1 -C ~/.local
source ~/.local/bin/install
@@ -35,10 +35,10 @@ configureTravis
#
# Travis fails on timeout when build does not print logs
-# during 10 minutes. This function aims to bypass this
+# during 10 minutes. This aims to bypass this
# behavior when building the slow sonar-server sub-project.
#
-function keep_alive() {
+keep_alive() {
while true; do
echo -en "\a"
sleep 60