Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Get Command Line arguements if present |
| 4 | VPP_DIR=$1 |
| 5 | if [ "x$1" != "x" ]; then |
| 6 | VPP_DIR=$1 |
| 7 | else |
| 8 | VPP_DIR=`dirname $0`/../../ |
| 9 | fi |
| 10 | |
| 11 | if [ "x$2" != "x" ]; then |
| 12 | SUDOCMD="sudo -H -u $2" |
| 13 | fi |
| 14 | echo 0:$0 |
| 15 | echo 1:$1 |
| 16 | echo 2:$2 |
| 17 | echo VPP_DIR: $VPP_DIR |
| 18 | echo SUDOCMD: $SUDOCMD |
| 19 | |
| 20 | # Figure out what system we are running on |
| 21 | if [ -f /etc/lsb-release ];then |
| 22 | . /etc/lsb-release |
| 23 | elif [ -f /etc/redhat-release ];then |
| 24 | sudo yum install -y redhat-lsb |
| 25 | DISTRIB_ID=`lsb_release -si` |
| 26 | DISTRIB_RELEASE=`lsb_release -sr` |
| 27 | DISTRIB_CODENAME=`lsb_release -sc` |
| 28 | DISTRIB_DESCRIPTION=`lsb_release -sd` |
khers | 28262a0 | 2017-05-24 15:43:54 +0430 | [diff] [blame^] | 29 | elif [ -f /etc/os-release ];then |
| 30 | . /etc/os-release |
| 31 | DISTRIB_ID=$ID |
| 32 | DISTRIB_RELEASE=$VERSION_ID |
| 33 | DISTRIB_CODENAME=$VERSION |
| 34 | DISTRIB_DESCRIPTION=$PRETTY_NAME |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 35 | fi |
Dave Wallace | 431cd2f | 2016-06-03 17:09:11 -0400 | [diff] [blame] | 36 | KERNEL_OS=`uname -o` |
| 37 | KERNEL_MACHINE=`uname -m` |
| 38 | KERNEL_RELEASE=`uname -r` |
| 39 | KERNEL_VERSION=`uname -v` |
| 40 | |
| 41 | echo KERNEL_OS: $KERNEL_OS |
| 42 | echo KERNEL_MACHINE: $KERNEL_MACHINE |
| 43 | echo KERNEL_RELEASE: $KERNEL_RELEASE |
| 44 | echo KERNEL_VERSION: $KERNEL_VERSION |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 45 | echo DISTRIB_ID: $DISTRIB_ID |
| 46 | echo DISTRIB_RELEASE: $DISTRIB_RELEASE |
| 47 | echo DISTRIB_CODENAME: $DISTRIB_CODENAME |
| 48 | echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION |
| 49 | |
| 50 | # Install dependencies |
| 51 | cd $VPP_DIR |
Damjan Marion | c5e8681 | 2016-05-02 19:40:27 +0200 | [diff] [blame] | 52 | make UNATTENDED=yes install-dep |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 53 | |
| 54 | # Really really clean things up so we can be sure |
| 55 | # that the build works even when switching distros |
Ed Warnicke | 3ba4d36 | 2016-09-01 11:54:27 -0700 | [diff] [blame] | 56 | $SUDOCMD make wipe |
| 57 | (cd build-root/;$SUDOCMD make distclean) |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 58 | rm -f build-root/.bootstrap.ok |
| 59 | |
Ed Warnicke | d6a779c | 2016-05-03 16:47:50 -0500 | [diff] [blame] | 60 | if [ $DISTRIB_ID == "CentOS" ]; then |
| 61 | echo rpm -V apr-devel |
| 62 | rpm -V apr-devel |
| 63 | if [ $? != 0 ]; then sudo yum reinstall -y apr-devel;fi |
| 64 | echo rpm -V ganglia-devel |
| 65 | rpm -V ganglia-devel |
| 66 | if [ $? != 0 ]; then sudo yum reinstall -y ganglia-devel;fi |
| 67 | echo rpm -V libconfuse-devel |
| 68 | rpm -V libconfuse-devel |
| 69 | if [ $? != 0 ]; then sudo yum reinstall -y libconfuse-devel;fi |
| 70 | fi |
| 71 | |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 72 | # Build and install packaging |
| 73 | $SUDOCMD make bootstrap |
khers | 28262a0 | 2017-05-24 15:43:54 +0430 | [diff] [blame^] | 74 | |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 75 | if [ $DISTRIB_ID == "Ubuntu" ]; then |
| 76 | $SUDOCMD make pkg-deb |
khers | 28262a0 | 2017-05-24 15:43:54 +0430 | [diff] [blame^] | 77 | elif [ $DISTRIB_ID == "debian" ]; then |
| 78 | $SUDOCMD make pkg-deb |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 79 | elif [ $DISTRIB_ID == "CentOS" ]; then |
Billy McFall | 8cb034b | 2016-10-20 08:50:11 -0400 | [diff] [blame] | 80 | (cd $VPP_DIR/vnet ;$SUDOCMD aclocal;$SUDOCMD automake -a) |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 81 | $SUDOCMD make pkg-rpm |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 82 | fi |
| 83 | |