aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJanos Gyerik <janos.gyerik@sonarsource.com>2018-03-15 12:05:01 +0100
committerGitHub <noreply@github.com>2018-03-15 12:05:01 +0100
commit31436ae379c0680f6502a35ef590afa4ac819e47 (patch)
treecd65bdcc4313d7cf00626256246d944de7afc434 /scripts
parent8ab2074c40707cec61b1fecbdf7eb6a23881161c (diff)
downloadsonarqube-31436ae379c0680f6502a35ef590afa4ac819e47.tar.gz
sonarqube-31436ae379c0680f6502a35ef590afa4ac819e47.zip
Fix minor safety issues in built-in patches (#3155)
* Add shebang line for all patches * Properly double-quote variables used on the command line * Use different debug port for debug CE and Web * Add double-quotes around long -agentlib option too
Diffstat (limited to 'scripts')
-rw-r--r--scripts/patches/README.md5
-rwxr-xr-xscripts/patches/debug_ce.sh7
-rwxr-xr-xscripts/patches/debug_web.sh7
-rwxr-xr-xscripts/patches/mysql.sh8
-rwxr-xr-xscripts/patches/postgres.sh8
5 files changed, 23 insertions, 12 deletions
diff --git a/scripts/patches/README.md b/scripts/patches/README.md
index 709c7bb81d5..25db7196408 100644
--- a/scripts/patches/README.md
+++ b/scripts/patches/README.md
@@ -34,8 +34,9 @@ Example scripts
SQ_HOME=$1
- echo "enabling debug in conf/sonar.properties, listening on port 5005"
- set_property sonar.web.javaAdditionalOpts -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 "$SQ_HOME/conf/sonar.properties"
+ port=5005
+ echo "enabling debug in conf/sonar.properties, listening on port $port"
+ set_property sonar.web.javaAdditionalOpts "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$port" "$SQ_HOME/conf/sonar.properties"
### Views
diff --git a/scripts/patches/debug_ce.sh b/scripts/patches/debug_ce.sh
index aafeadaf8c7..f0ea04eb9c3 100755
--- a/scripts/patches/debug_ce.sh
+++ b/scripts/patches/debug_ce.sh
@@ -1,8 +1,11 @@
+#!/usr/bin/env bash
+
set -euo pipefail
source scripts/property_utils.sh
SQ_HOME=$1
-echo "enabling debug on compute engine, listening on port 5005"
-set_property sonar.ce.javaAdditionalOpts -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 $SQ_HOME/conf/sonar.properties
+port=5006
+echo "enabling debug on compute engine, listening on port $port"
+set_property sonar.ce.javaAdditionalOpts "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$port" "$SQ_HOME/conf/sonar.properties"
diff --git a/scripts/patches/debug_web.sh b/scripts/patches/debug_web.sh
index 831a6dd5b17..ae06f2b9485 100755
--- a/scripts/patches/debug_web.sh
+++ b/scripts/patches/debug_web.sh
@@ -1,8 +1,11 @@
+#!/usr/bin/env bash
+
set -euo pipefail
source scripts/property_utils.sh
SQ_HOME=$1
-echo "enabling debug on web server, listening on port 5005"
-set_property sonar.web.javaAdditionalOpts -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 $SQ_HOME/conf/sonar.properties
+port=5005
+echo "enabling debug on web server, listening on port $port"
+set_property sonar.web.javaAdditionalOpts "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$port" "$SQ_HOME/conf/sonar.properties"
diff --git a/scripts/patches/mysql.sh b/scripts/patches/mysql.sh
index 59931e77b94..ce0f260d615 100755
--- a/scripts/patches/mysql.sh
+++ b/scripts/patches/mysql.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
set -euo pipefail
source scripts/property_utils.sh
@@ -5,6 +7,6 @@ source scripts/property_utils.sh
SQ_HOME=$1
echo "configuring mysql"
-set_property sonar.jdbc.url "jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance" $SQ_HOME/conf/sonar.properties
-set_property sonar.jdbc.username sonarqube $SQ_HOME/conf/sonar.properties
-set_property sonar.jdbc.password sonarqube $SQ_HOME/conf/sonar.properties
+set_property sonar.jdbc.url "jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance" "$SQ_HOME/conf/sonar.properties"
+set_property sonar.jdbc.username sonarqube "$SQ_HOME/conf/sonar.properties"
+set_property sonar.jdbc.password sonarqube "$SQ_HOME/conf/sonar.properties"
diff --git a/scripts/patches/postgres.sh b/scripts/patches/postgres.sh
index 0f3b10559ac..5465c458468 100755
--- a/scripts/patches/postgres.sh
+++ b/scripts/patches/postgres.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
set -euo pipefail
source scripts/property_utils.sh
@@ -5,6 +7,6 @@ source scripts/property_utils.sh
SQ_HOME=$1
echo "configuring postgres"
-set_property sonar.jdbc.url jdbc:postgresql://localhost:5432/sonarqube $SQ_HOME/conf/sonar.properties
-set_property sonar.jdbc.username sonarqube $SQ_HOME/conf/sonar.properties
-set_property sonar.jdbc.password sonarqube $SQ_HOME/conf/sonar.properties
+set_property sonar.jdbc.url jdbc:postgresql://localhost:5432/sonarqube "$SQ_HOME/conf/sonar.properties"
+set_property sonar.jdbc.username sonarqube "$SQ_HOME/conf/sonar.properties"
+set_property sonar.jdbc.password sonarqube "$SQ_HOME/conf/sonar.properties"