Merge "Modify OS syntax"
[ci-management.git] / jjb / scripts / cleanup_vpp_plugin_dev_env.sh
1 #!/bin/bash
2 set -e -o pipefail
3
4 # Figure out what system we are running on
5 if [ -f /etc/lsb-release ];then
6     . /etc/lsb-release
7 elif [ -f /etc/redhat-release ];then
8     sudo yum install -y redhat-lsb
9     DISTRIB_ID=`lsb_release -si`
10     DISTRIB_RELEASE=`lsb_release -sr`
11     DISTRIB_CODENAME=`lsb_release -sc`
12     DISTRIB_DESCRIPTION=`lsb_release -sd`
13 fi
14 echo DISTRIB_ID: $DISTRIB_ID
15 echo DISTRIB_RELEASE: $DISTRIB_RELEASE
16 echo DISTRIB_CODENAME: $DISTRIB_CODENAME
17 echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
18
19 function cleanup {
20     # Setup by installing vpp-dev and vpp-lib
21     if [ $DISTRIB_ID == "Ubuntu" ]; then
22         sudo rm -f /etc/apt/sources.list.d/99fd.io.list
23         sudo dpkg -r vpp-dev vpp-lib vpp-dev vpp-lib vpp vpp-dpdk-dev vpp-dpdk-dkms vpp-dbg
24     elif [[ $DISTRIB_ID == "CentOS" ]]; then
25         sudo rm -f /etc/yum.repos.d/fdio-master.repo
26         sudo yum -y remove vpp-devel vpp-lib vpp
27     fi
28 }
29
30 trap cleanup EXIT
31 cleanup