setup_vpp_dpdk_dev_env.sh revision 9e9ca32b
1#!/bin/bash
2set -e -o pipefail
3
4OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
5OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
6
7function setup {
8    if ! [ -z ${REPO_NAME} ]; then
9        echo "INSTALLING VPP-DPKG-DEV from apt/yum repo"
10        REPO_URL="https://packagecloud.io/fdio/${STREAM}"
11        echo "REPO_URL: ${REPO_URL}"
12        # Setup by installing vpp-dev and vpp-lib
13        if [ "$OS_ID" == "ubuntu" ]; then
14        	if ! [ "${STREAM}" == "master" ]; then
15        		echo "tree not master deleting packagecloud repo pointer"
16        		sudo rm  -f /etc/apt/sources.list.d/fdio_master.list
17        		curl -s https://packagecloud.io/install/repositories/fdio/${STREAM}/script.deb.sh | sudo bash
18        	fi
19            if [ -f /etc/apt/sources.list.d/99fd.io.list ];then
20                echo "Deleting: /etc/apt/sources.list.d/99fd.io.list"
21                sudo rm /etc/apt/sources.list.d/99fd.io.list
22            fi
23            sudo apt-get update -qq || true
24            sudo apt-get -y --force-yes install vpp-dpdk-dev || true
25            sudo apt-get -y --force-yes install vpp-dpdk-dkms || true
26            sudo apt-get -y --force-yes install vpp-ext-deps || true
27        elif [ "$OS_ID" == "centos" ]; then
28            if [ -f /etc/yum.repos.d/fdio-master.repo ]; then
29                echo "Deleting: /etc/yum.repos.d/fdio-master.repo"
30                sudo rm /etc/yum.repos.d/fdio-master.repo
31            fi
32            curl -s https://packagecloud.io/install/repositories/fdio/${STREAM}/script.rpm.sh | sudo bash
33            sudo yum -y install vpp-dpdk-devel || true
34            sudo yum -y install vpp-ext-deps || true
35        elif [ "$OS_ID" == "opensuse" ]; then
36            REPO_URL="${NEXUSPROXY}/content/repositories/fd.io.${REPO_NAME}"
37            echo "REPO_URL: ${REPO_URL}"
38            sudo cat << EOF > fdio-master.repo
39[fdio-master]
40name=fd.io master branch latest merge
41baseurl=${REPO_URL}
42enabled=1
43gpgcheck=0
44EOF
45            sudo mv fdio-master.repo /etc/yum/repos.d/fdio-master.repo
46            sudo yum -y install vpp-dpdk-devel || true
47            sudo yum -y install vpp-ext-deps || true
48        elif [ "$OS_ID" == "opensuse-leap" ]; then
49            REPO_URL="${NEXUSPROXY}/content/repositories/fd.io.${REPO_NAME}"
50            echo "REPO_URL: ${REPO_URL}"
51            sudo cat << EOF > fdio-master.repo
52[fdio-master]
53name=fd.io master branch latest merge
54baseurl=${REPO_URL}
55enabled=1
56gpgcheck=0
57EOF
58            sudo mv fdio-master.repo /etc/yum/repos.d/fdio-master.repo
59            sudo yum -y install vpp-dpdk-devel || true
60            sudo yum -y install vpp-ext-deps || true
61        fi
62    fi
63}
64
65setup
66