blob: 8695b030d44d24f30397f9701bbbbc5e3d9fa51b [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
Dave Wallace431cd2f2016-06-03 17:09:11 -040030KERNEL_OS=`uname -o`
31KERNEL_MACHINE=`uname -m`
32KERNEL_RELEASE=`uname -r`
33KERNEL_VERSION=`uname -v`
34
35echo KERNEL_OS: $KERNEL_OS
36echo KERNEL_MACHINE: $KERNEL_MACHINE
37echo KERNEL_RELEASE: $KERNEL_RELEASE
38echo KERNEL_VERSION: $KERNEL_VERSION
Ed Warnicked6a0fc52016-04-12 17:34:48 -050039echo DISTRIB_ID: $DISTRIB_ID
40echo DISTRIB_RELEASE: $DISTRIB_RELEASE
41echo DISTRIB_CODENAME: $DISTRIB_CODENAME
42echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
43
44# Install dependencies
45cd $VPP_DIR
Damjan Marionc5e86812016-05-02 19:40:27 +020046make UNATTENDED=yes install-dep
Ed Warnicked6a0fc52016-04-12 17:34:48 -050047
48# Really really clean things up so we can be sure
49# that the build works even when switching distros
Ed Warnicke3ba4d362016-09-01 11:54:27 -070050$SUDOCMD make wipe
51(cd build-root/;$SUDOCMD make distclean)
Ed Warnicked6a0fc52016-04-12 17:34:48 -050052rm -f build-root/.bootstrap.ok
53
Ed Warnicked6a779c2016-05-03 16:47:50 -050054if [ $DISTRIB_ID == "CentOS" ]; then
55 echo rpm -V apr-devel
56 rpm -V apr-devel
57 if [ $? != 0 ]; then sudo yum reinstall -y apr-devel;fi
58 echo rpm -V ganglia-devel
59 rpm -V ganglia-devel
60 if [ $? != 0 ]; then sudo yum reinstall -y ganglia-devel;fi
61 echo rpm -V libconfuse-devel
62 rpm -V libconfuse-devel
63 if [ $? != 0 ]; then sudo yum reinstall -y libconfuse-devel;fi
64fi
65
Ed Warnicked6a0fc52016-04-12 17:34:48 -050066# Build and install packaging
67$SUDOCMD make bootstrap
68if [ $DISTRIB_ID == "Ubuntu" ]; then
69 $SUDOCMD make pkg-deb
Ed Warnicked6a0fc52016-04-12 17:34:48 -050070elif [ $DISTRIB_ID == "CentOS" ]; then
71 $SUDOCMD make pkg-rpm
Ed Warnicked6a0fc52016-04-12 17:34:48 -050072fi
73