aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/assembly/bin
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-01-04 15:48:23 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2013-01-04 15:48:23 +0100
commit1293cfaa284545b522138303503f10846e1bf808 (patch)
tree43efb7a593bd014a48282bb75436f783b0bed7f3 /src/main/assembly/bin
parentb3d8968c56ea127efd078b9f95af84a592ce9c75 (diff)
downloadsonar-scanner-cli-1293cfaa284545b522138303503f10846e1bf808.tar.gz
sonar-scanner-cli-1293cfaa284545b522138303503f10846e1bf808.zip
SONARPLUGINS-2313 Improve Linux script
* SONAR_RUNNER_HOME: autodetection over symbolic links * validation when automaticly resolved * return non zero exit code when SONAR_RUNNER_HOME is wrong
Diffstat (limited to 'src/main/assembly/bin')
-rwxr-xr-xsrc/main/assembly/bin/sonar-runner17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main/assembly/bin/sonar-runner b/src/main/assembly/bin/sonar-runner
index 9ba40c4..21c120a 100755
--- a/src/main/assembly/bin/sonar-runner
+++ b/src/main/assembly/bin/sonar-runner
@@ -9,16 +9,21 @@
if [ -z "$SONAR_RUNNER_HOME" ] ; then
PRG="$0"
+ # try to resolve symlinks
+ if [ `command -v readlink >/dev/null 2>&1; echo $?` -eq 0 ] ; then
+ PRG=`readlink -f "$PRG"`
+ fi
+
SONAR_RUNNER_HOME=`dirname "$PRG"`/..
# make it fully qualified
SONAR_RUNNER_HOME=`cd "$SONAR_RUNNER_HOME" && pwd`
-else
- # check that the SONAR_RUNNER_HOME has been correctly set
- if [ ! -e "$SONAR_RUNNER_HOME/lib/sonar-runner-${project.version}.jar" ] ; then
- echo '$SONAR_RUNNER_HOME' does not point to a valid installation directory: $SONAR_RUNNER_HOME
- exit 0
- fi
+fi
+
+# check that the SONAR_RUNNER_HOME has been correctly set
+if [ ! -e "$SONAR_RUNNER_HOME/lib/sonar-runner-${project.version}.jar" ] ; then
+ echo '$SONAR_RUNNER_HOME' does not point to a valid installation directory: $SONAR_RUNNER_HOME
+ exit 1
fi
JAVA_CMD="`which java`"