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 | |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame^] | 20 | if [ "$(uname)" <> "Darwin" ]; then |
| 21 | OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') |
| 22 | OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 23 | fi |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame^] | 24 | |
Dave Wallace | 431cd2f | 2016-06-03 17:09:11 -0400 | [diff] [blame] | 25 | KERNEL_OS=`uname -o` |
| 26 | KERNEL_MACHINE=`uname -m` |
| 27 | KERNEL_RELEASE=`uname -r` |
| 28 | KERNEL_VERSION=`uname -v` |
| 29 | |
| 30 | echo KERNEL_OS: $KERNEL_OS |
| 31 | echo KERNEL_MACHINE: $KERNEL_MACHINE |
| 32 | echo KERNEL_RELEASE: $KERNEL_RELEASE |
| 33 | echo KERNEL_VERSION: $KERNEL_VERSION |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame^] | 34 | echo OS_ID: $OS_ID |
| 35 | echo OS_VERSION_ID: $OS_ID |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 36 | |
| 37 | # Install dependencies |
| 38 | cd $VPP_DIR |
Damjan Marion | c5e8681 | 2016-05-02 19:40:27 +0200 | [diff] [blame] | 39 | make UNATTENDED=yes install-dep |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 40 | |
| 41 | # Really really clean things up so we can be sure |
| 42 | # that the build works even when switching distros |
Ed Warnicke | 3ba4d36 | 2016-09-01 11:54:27 -0700 | [diff] [blame] | 43 | $SUDOCMD make wipe |
| 44 | (cd build-root/;$SUDOCMD make distclean) |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 45 | rm -f build-root/.bootstrap.ok |
| 46 | |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame^] | 47 | if [ $OS_ID == "centos" ]; then |
Ed Warnicke | d6a779c | 2016-05-03 16:47:50 -0500 | [diff] [blame] | 48 | echo rpm -V apr-devel |
| 49 | rpm -V apr-devel |
| 50 | if [ $? != 0 ]; then sudo yum reinstall -y apr-devel;fi |
| 51 | echo rpm -V ganglia-devel |
| 52 | rpm -V ganglia-devel |
| 53 | if [ $? != 0 ]; then sudo yum reinstall -y ganglia-devel;fi |
| 54 | echo rpm -V libconfuse-devel |
| 55 | rpm -V libconfuse-devel |
| 56 | if [ $? != 0 ]; then sudo yum reinstall -y libconfuse-devel;fi |
| 57 | fi |
| 58 | |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 59 | # Build and install packaging |
| 60 | $SUDOCMD make bootstrap |
khers | 28262a0 | 2017-05-24 15:43:54 +0430 | [diff] [blame] | 61 | |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame^] | 62 | if [ "$OS_ID" == "ubuntu" ]; then |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 63 | $SUDOCMD make pkg-deb |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame^] | 64 | elif [ "$OS_ID" == "debian" ]; then |
khers | 28262a0 | 2017-05-24 15:43:54 +0430 | [diff] [blame] | 65 | $SUDOCMD make pkg-deb |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame^] | 66 | elif [ "$OS_ID" == "centos" ]; then |
Billy McFall | 8cb034b | 2016-10-20 08:50:11 -0400 | [diff] [blame] | 67 | (cd $VPP_DIR/vnet ;$SUDOCMD aclocal;$SUDOCMD automake -a) |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 68 | $SUDOCMD make pkg-rpm |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame^] | 69 | elif [ "$OS_ID" == "opensuse" ]; then |
Marco Varlese | dc33d4c | 2017-09-22 17:53:53 +0200 | [diff] [blame] | 70 | $SUDOCMD make build-release |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 71 | fi |
| 72 | |