6 # -o pipefail: Fail on errors in scripts this calls, give stacktrace
9 # Update mirror list to avoid slow/hung one
10 sudo yum update -y yum-plugin-fastestmirror
12 # Use local RPM in build-out dir if URL not passed
13 URL=${URL:-"$HOME/rpmbuild/RPMS/noarch/*.rpm"}
15 # Install ODL from RPM path, RPM URL or .repo file url
16 # NB: Paths must be anchored at root
17 if [[ $URL == /* ]]; then
18 # If path is globbed (/path/to/*.rpm), expand it
19 path=$(sudo find / -wholename $URL)
20 sudo yum install -y "$path"
21 elif [[ $URL == *.rpm ]]; then
22 sudo yum install -y "$URL"
23 elif [[ $URL == *.repo ]]; then
24 # shellcheck disable=SC2154
25 repo_file="${URL##*/}"
26 sudo curl --silent -o /etc/yum.repos.d/"$repo_file" "$URL"
27 sudo yum install -y opendaylight
29 echo "URL is not a link to .rpm or .repo"