]> git.ipfire.org Git - thirdparty/systemd.git/blob - travis-ci/tools/get-coverity.sh
service: add new RootImageOptions feature
[thirdparty/systemd.git] / travis-ci / tools / get-coverity.sh
1 #!/bin/bash
2
3 # Download and extract coverity tool
4
5 # Environment check
6 [ -z "$COVERITY_SCAN_TOKEN" ] && echo 'ERROR: COVERITY_SCAN_TOKEN must be set' && exit 1
7
8 # Use default values if not set
9 PLATFORM=$(uname)
10
11 TOOL_BASE=${TOOL_BASE:="/tmp/coverity-scan-analysis"}
12 TOOL_ARCHIVE=${TOOL_ARCHIVE:="/tmp/cov-analysis-${PLATFORM}.tgz"}
13
14 TOOL_URL="https://scan.coverity.com/download/${PLATFORM}"
15
16 # Make sure wget is installed
17 sudo apt-get update && sudo apt-get -y install wget
18
19 # Get coverity tool
20 if [ ! -d $TOOL_BASE ]; then
21 # Download Coverity Scan Analysis Tool
22 if [ ! -e $TOOL_ARCHIVE ]; then
23 echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m"
24 wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN"
25 fi
26
27 # Extract Coverity Scan Analysis Tool
28 echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m"
29 mkdir -p $TOOL_BASE
30 pushd $TOOL_BASE
31 tar xzf $TOOL_ARCHIVE
32 popd
33 fi
34
35 echo -e "\033[33;1mCoverity Scan Analysis Tool can be found at $TOOL_BASE ...\033[0m"