Fix apt concurrency failures
[releng/builder.git] / jjb / packaging / include-raw-test-deb.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 # Wait for any background apt processes to finish
10 # There seems to be a backgroud apt process that locks /var/lib/dpkg/lock
11 # and causes our apt commands to fail.
12 while pgrep apt > /dev/null; do sleep 1; done
13
14 # Install ODL from .deb link or .repo url
15 if [[ $URL == *.deb ]]
16 then
17   sudo apt-get install -y "$URL"
18 elif [[ $URL == ppa:* ]]
19 then
20   sudo add-apt-repository "$REPO_FILE"
21   sudo apt-get update
22   sudo apt-get install -y opendaylight
23 else
24   echo "URL is not a link to a PPA repo or .deb"
25 fi
26
27 # Install expect to interact with karaf shell
28 sudo apt-get install -y expect
29
30 # Start OpenDaylight
31 sudo systemctl start opendaylight
32
33 # Check status of OpenDaylight
34 sudo systemctl status opendaylight
35
36 # Get process id of Java
37 pgrep java