summaryrefslogtreecommitdiffstats
path: root/utils/test/dashboard/install.sh
blob: 9fd60d91614796ccb780984ace6ed0621ff86538 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

usage="
Script to install dashboard automatically.
This script should be run under root.

usage:
    bash $(basename "$0") [-h|--help] [-t <test_name>]

where:
    -h|--help         show this help text
    -p|--project      project dashboard
      <project_name>"

# Parse parameters
while [[ $# > 0 ]]
    do
    key="$1"
    case $key in
        -h|--help)
            echo "$usage"
            exit 0
            shift
        ;;
        -p|--project)
            PROJECT="$2"
            shift
        ;;
        *)
            echo "unknown option $1 $2"
            exit 1
        ;;
    esac
    shift # past argument or value
done

if [[ $(whoami) != "root" ]]; then
    echo "Error: This script must be run as root!"
    exit 1
fi

if [ -z ${PROJECT+x} ]; then
    echo "project must be specified"
    exit 1
fi

if [ $PROJECT != "functest" ] && [ $PROJECT != "qtip" ];then
    echo "unsupported project $PROJECT"
    exit 1
fi

cp -f dashboard/$PROJECT/format.py dashboard/mongo2elastic
cp -f dashboard/$PROJECT/testcases.yaml etc/
python setup.py install