blob: 7fd7e3a6cffb0a4fbe9d3cd55a5db2c7543be226 [file] [log] [blame]
Ed Warnicked6a0fc52016-04-12 17:34:48 -05001#!/bin/bash
2
3# Get Command Line arguements if present
4VPP_DIR=$1
5if [ "x$1" != "x" ]; then
6 VPP_DIR=$1
7else
8 VPP_DIR=`dirname $0`/../../
9fi
10
11if [ "x$2" != "x" ]; then
12 SUDOCMD="sudo -H -u $2"
13fi
14echo 0:$0
15echo 1:$1
16echo 2:$2
17echo VPP_DIR: $VPP_DIR
18echo SUDOCMD: $SUDOCMD
19
20# Figure out what system we are running on
21if [ -f /etc/lsb-release ];then
22 . /etc/lsb-release
23elif [ -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`
29fi
30echo DISTRIB_ID: $DISTRIB_ID
31echo DISTRIB_RELEASE: $DISTRIB_RELEASE
32echo DISTRIB_CODENAME: $DISTRIB_CODENAME
33echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
34
35# Install dependencies
36cd $VPP_DIR
Damjan Marionc5e86812016-05-02 19:40:27 +020037make UNATTENDED=yes install-dep
Ed Warnicked6a0fc52016-04-12 17:34:48 -050038
39# Really really clean things up so we can be sure
40# that the build works even when switching distros
41make wipe
42(cd build-root/;make distclean)
43rm -f build-root/.bootstrap.ok
44
Ed Warnicked6a779c2016-05-03 16:47:50 -050045if [ $DISTRIB_ID == "CentOS" ]; then
46 echo rpm -V apr-devel
47 rpm -V apr-devel
48 if [ $? != 0 ]; then sudo yum reinstall -y apr-devel;fi
49 echo rpm -V ganglia-devel
50 rpm -V ganglia-devel
51 if [ $? != 0 ]; then sudo yum reinstall -y ganglia-devel;fi
52 echo rpm -V libconfuse-devel
53 rpm -V libconfuse-devel
54 if [ $? != 0 ]; then sudo yum reinstall -y libconfuse-devel;fi
55fi
56
Ed Warnicked6a0fc52016-04-12 17:34:48 -050057# Build and install packaging
58$SUDOCMD make bootstrap
59if [ $DISTRIB_ID == "Ubuntu" ]; then
60 $SUDOCMD make pkg-deb
Ed Warnicked6a0fc52016-04-12 17:34:48 -050061elif [ $DISTRIB_ID == "CentOS" ]; then
62 $SUDOCMD make pkg-rpm
Ed Warnicked6a0fc52016-04-12 17:34:48 -050063fi
64