#!/bin/bash
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
echo "---> jjb/scripts/setup_vpp_ext_deps.sh"
-set -e -o pipefail
+# Normally we would have the settings in any bash script stricter:
+# set -e -o pipefail
+#
+# But there is a corner case scenario that triggers an error,
+# namely when a new packagecloud repo is created, it is completely
+# empty. Then the installation fails. However, since this
+# script is an optimization, it is okay for it to fail without failing
+# the entire job.
+#
+# Therefore, we do not use the "-e" here.
+
+set -o pipefail
OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
echo "Removing packagecloud.io repository references and running apt-get update"
sudo rm -f /etc/apt/sources.list.d/fdio_*.list
sudo apt-get update -qq || true
-#TODO: Remove centos when VPP 21.06 is no longer supported
-elif [ "${OS_ID,,}" == "centos" ] ; then
- if [ "${STREAM}" != "master" ] ; then
- echo "stream '${STREAM}' is not master: replacing packagecloud repo list with stream specific list"
- sudo yum -y erase vpp-ext-deps || true
- sudo yum clean all || true
- sudo rm -f /etc/yum.repos.d/fdio_master.repo
- curl -s $INSTALL_URL/script.rpm.sh | sudo bash || true
- fi
- vpp_ext_deps_version="$(yum -q list vpp-ext-deps 2> /dev/null | mawk '/vpp-ext-deps/{print $2}')"
- vpp_ext_deps_pkg="$(yum -q list vpp-ext-deps 2> /dev/null | mawk '/vpp-ext-deps/{print $1}')"
- vpp_ext_deps_pkg="${vpp_ext_deps_pkg/./-${vpp_ext_deps_version}.}.rpm"
- if [ -f "$vpp_ext_deps_pkg" ] ; then
- echo "Installing cached vpp-ext-deps pkg: $vpp_ext_deps_pkg"
- sudo yum -y localinstall "$downloads_dir/$vpp_ext_deps_pkg" || true
- else
- echo "Installing vpp-ext-deps from packagecloud.io"
- sudo yum -y install vpp-ext-deps || true
- fi
else
echo "ERROR: Unsupported OS '$OS_ID'!"
fi