install_sonar_scanner.sh
本文最后更新于310 天前,其中的信息可能已经过时,如有错误请发送邮件到gengjiayong2022@outlook.com
#!/bin/bash
#支持在线和离线安装

SONARQUBE_SERVER=sonarqube.wang.org

SONAR_SCANNER_VER=6.2.1.4610
#SONAR_SCANNER_VER=6.1.0.4477
#SONAR_SCANNER_VER=5.0.1.3006
#SONAR_SCANNER_VER=4.8.0.2856
#SONAR_SCANNER_VER=4.7.0.2747
#SONAR_SCANNER_VER=4.6.2.2472
#SONAR_SCANNER_VER=4.3.0.2102

FILE=sonar-scanner-cli-${SONAR_SCANNER_VER}-linux-x64.zip
URL="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/$FILE"
#URL="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VER}-linux.zip"
GREEN="echo -e \E[32;1m"
END="\E[0m"
WORK_DIR=`pwd`

color () {
    RES_COL=60
    MOVE_TO_COL="echo -en \\033[${RES_COL}G"
    SETCOLOR_SUCCESS="echo -en \\033[1;32m"
    SETCOLOR_FAILURE="echo -en \\033[1;31m"
    SETCOLOR_WARNING="echo -en \\033[1;33m"
    SETCOLOR_NORMAL="echo -en \E[0m"
    echo -n "$1" && $MOVE_TO_COL
    echo -n "["
    if [ $2 = "success" -o $2 = "0" ] ;then
        ${SETCOLOR_SUCCESS}
        echo -n $"  OK  "    
    elif [ $2 = "failure" -o $2 = "1"  ] ;then 
        ${SETCOLOR_FAILURE}
        echo -n $"FAILED"
    else
        ${SETCOLOR_WARNING}
        echo -n $"WARNING"
    fi
    ${SETCOLOR_NORMAL}
    echo -n "]"
    echo 
}

install_sonar_scanner (){
    cd $WORK_DIR
    if [ ! -f $FILE ] ;then
        wget $URL || { color  "下载失败!" 1 ;exit ; }
    fi
    unzip $FILE -d /usr/local/src
    ln -s /usr/local/src/sonar-scanner-${SONAR_SCANNER_VER}-linux*/ /usr/local/sonar-scanner
    ln -s /usr/local/sonar-scanner/bin/sonar-scanner /usr/local/bin/
    cat >>  /usr/local/sonar-scanner/conf/sonar-scanner.properties <<EOF
sonar.host.url=http://${SONARQUBE_SERVER}:9000 
sonar.sourceEncoding=UTF-8
EOF
    sonar-scanner -v
    if [ $?  -eq 0 ];then  
        echo 
        color "sonar_scanner 安装完成!" 0
    else
        color "sonar_scanner 安装失败!" 1
        exit
    fi 
}

install_sonar_scanner
文末附加内容
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇
Theme Argon
京ICP备2024094827号