6 # -o pipefail: Fail on errors in scripts this calls, give stacktrace
8 PACKAGE=${PACKAGE:-"$WORKSPACE/packaging/packages/deb/opendaylight/*.deb"}
9 URL_REGEX='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
10 # Wait for any background apt processes to finish
11 # There seems to be a backgroud apt process that locks /var/lib/dpkg/lock
12 # and causes our apt commands to fail.
13 while pgrep apt > /dev/null; do sleep 1; done
15 # Install ODL from .deb link or .repo url
16 if [[ $PACKAGE =~ $URL_REGEX ]]
18 # shellcheck disable=SC2154
19 pkg_basename="${PACKAGE##*/}"
20 curl -L --silent -o "$pkg_basename" "$PACKAGE"
21 sudo dpkg --install ./"$pkg_basename"
22 elif [[ $PACKAGE == *.deb ]]
25 sudo dpkg --install "$PACKAGE"
26 elif [[ $PACKAGE == ppa:* ]]
28 sudo add-apt-repository "$PACKAGE"
30 sudo apt-get install -y opendaylight
32 echo "URL is not a link to a PPA repo or .deb"