X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fpackaging%2Finstall-rpm.sh;h=7c011ad646f46e7cc69a36448d2052e124e47169;hb=d5fb457479b8760a272adb35212aa275042598e4;hp=2816c4a7865ba11949c1de41aca7c33938eca5ca;hpb=3255e032e27ef0ce3618bce7112f68597c1c2f25;p=releng%2Fbuilder.git diff --git a/jjb/packaging/install-rpm.sh b/jjb/packaging/install-rpm.sh index 2816c4a78..7c011ad64 100644 --- a/jjb/packaging/install-rpm.sh +++ b/jjb/packaging/install-rpm.sh @@ -6,23 +6,49 @@ # -o pipefail: Fail on errors in scripts this calls, give stacktrace set -ex -o pipefail -# Update mirror list to avoid slow/hung one -sudo yum update -y yum-plugin-fastestmirror +# Use local RPM in build-out dir if URL not passed +URL=${URL:-"$HOME/rpmbuild/RPMS/noarch/*.rpm"} -# 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 - # shellcheck disable=SC2154 - repo_file="${URL##*/}" - sudo curl --silent -o /etc/yum.repos.d/"$repo_file" "$URL" - sudo yum install -y opendaylight +if [ -f /usr/bin/yum ]; then + # Update mirror list to avoid slow/hung one + sudo yum update -y yum-plugin-fastestmirror + + # 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 + # shellcheck disable=SC2154 + repo_file="${URL##*/}" + sudo curl --silent -o /etc/yum.repos.d/"$repo_file" "$URL" + sudo yum install -y opendaylight + else + echo "URL is not a link to .rpm or .repo" + exit 1 + fi +elif [ -f /usr/bin/zypper ]; 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 /root -wholename "$URL") + sudo zypper -n --no-gpg-checks install "$path" + elif [[ $URL == *.rpm ]]; then + sudo zypper -n --no-gpg-checks install "$URL" + elif [[ $URL == *.repo ]]; then + # shellcheck disable=SC2154 + repo_file="${URL##*/}" + sudo curl --silent -o /etc/zypp/repos.d/"$repo_file" "$URL" + sudo zypper -n --no-gpg-checks install opendaylight + else + echo "URL is not a link to .rpm or .repo" + exit 1 + fi else - echo "URL is not a link to .rpm or .repo" + echo "The package manager is not supported (not yum or zypper)" exit 1 fi