Skip to content

Instantly share code, notes, and snippets.

@Ronnasayd
Created October 13, 2020 14:54
Show Gist options
  • Save Ronnasayd/8718a9c7e181266b67e9bc3436188338 to your computer and use it in GitHub Desktop.
Save Ronnasayd/8718a9c7e181266b67e9bc3436188338 to your computer and use it in GitHub Desktop.
script to install sonar-scanner
# !bin/bash
CUR_DIR="$(pwd)"
if [ -d "/tmp/sonar-scanner" ];then
echo -e "sonar-scanner already instaled ✓"
cd /tmp/sonar-scanner/
BIN_DIRECTORY="$(find "`pwd`" -name bin | grep -v jre)"
export PATH=$PATH:"$BIN_DIRECTORY"
cd "$CUR_DIR"
else
echo -e "sonar-scanner not instaled ☓"
echo -e "installing..."
mkdir /tmp/sonar-scanner/
cd /tmp/sonar-scanner/
wget -q https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner -O index.html
LINUX_URL=$(cat index.html | grep https://binaries.sonarsource.com | grep linux | cut -d'"' -f4)
wget $LINUX_URL -O sonar.zip
unzip sonar.zip -d sonar/
rm index.html sonar.zip
BIN_DIRECTORY="$(find "`pwd`" -name bin | grep -v jre)"
export PATH=$PATH:"$BIN_DIRECTORY"
cd "$CUR_DIR"
echo -e "sonar-scanner installed"
fi
echo -e "access https://sonarcloud.io and paste the code"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment