Merge "Generate versions.csv for autorelease builds"
[releng/builder.git] / jjb / packaging / install-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 # Update mirror list to avoid slow/hung one
10 sudo yum update -y yum-plugin-fastestmirror
11
12 # Install ODL from .rpm link or .repo url
13 if [[ $URL == *.rpm ]]
14 then
15   sudo yum install -y "$URL"
16 elif [[ $URL == *.repo ]]
17 then
18   # shellcheck disable=SC2154
19   repo_file="${{URL##*/}}"
20   sudo curl --silent -o /etc/yum.repos.d/"$repo_file" "$URL"
21   sudo yum install -y opendaylight
22 else
23   echo "URL is not a link to .rpm or .repo"
24   exit 1
25 fi