Merge "Extract common RPM test builder steps to macro"
[releng/builder.git] / jjb / packaging / install-rpm.sh
index 7f72f0683a67badeff0f5b8f625e138b7bf3c888..2816c4a7865ba11949c1de41aca7c33938eca5ca 100644 (file)
@@ -9,14 +9,17 @@ set -ex -o pipefail
 # Update mirror list to avoid slow/hung one
 sudo yum update -y yum-plugin-fastestmirror
 
-# Install ODL from .rpm link or .repo url
-if [[ $URL == *.rpm ]]
-then
+# Install ODL from RPM path, RPM URL or .repo file url
+# NB: Paths must be anchored at root
+if [[ $URL == /*  ]]; then
+  # If path is globbed (/path/to/*.rpm), expand it
+  path=$(sudo find / -wholename $URL)
+  sudo yum install -y "$path"
+elif [[ $URL == *.rpm ]]; then
   sudo yum install -y "$URL"
-elif [[ $URL == *.repo ]]
-then
+elif [[ $URL == *.repo ]]; then
   # shellcheck disable=SC2154
-  repo_file="${{URL##*/}}"
+  repo_file="${URL##*/}"
   sudo curl --silent -o /etc/yum.repos.d/"$repo_file" "$URL"
   sudo yum install -y opendaylight
 else