Merge "Update releng/global-jjb repository information"
[releng/builder.git] / jjb / packaging / include-raw-test-rpm.sh
1 #!/bin/bash
2
3 # Options:
4 #   -x: Echo commands
5 #   -e: Fail on errors
6 #   -o pipefail: Fail on errors in scripts this calls, give stacktrace
7 set -ex -o pipefail
8
9 # Remove opendaylight if already installed
10 if rpm -q opendaylight > /dev/null;
11 then
12   sudo yum remove -y opendaylight;
13 fi
14
15 # Install ODL from .rpm link or .repo url
16 if [[ $URL == *.rpm ]]
17 then
18   sudo yum install -y "$URL"
19 elif [[ $URL == *.repo ]]
20 then
21   # shellcheck disable=SC2154
22   repo_file="${{URL##*/}}"
23   sudo curl --silent -o /etc/yum.repos.d/"$repo_file" "$URL"
24   sudo yum install -y opendaylight
25 else
26   echo "URL is not a link to .rpm or .repo"
27 fi
28
29 # Install expect to interact with karaf shell
30 sudo yum install -y expect
31
32 # Start OpenDaylight
33 sudo systemctl start opendaylight
34
35 # Check status of OpenDaylight
36 sudo systemctl status opendaylight
37
38 # Get process id of Java
39 pgrep java