From acc1fbcb5e13961c1fcf1a00952b19b154b296b6 Mon Sep 17 00:00:00 2001 From: Kyle Mestery Date: Fri, 10 Aug 2018 16:32:13 -0500 Subject: [PATCH] Make vagrant work behind a proxy Without this change, I cannot get the in-tree VPP Vagrant to work behind a proxy. This commit fixes that by ensuring when we run sudo we're passing environment variables, amongst some other cleanups. Change-Id: Ica98a1238d40e6e6ccf80c472f52559c95af52f0 Signed-off-by: Kyle Mestery --- extras/vagrant/Vagrantfile | 2 ++ extras/vagrant/build.sh | 6 +++--- extras/vagrant/clearinterfaces.sh | 2 +- extras/vagrant/env.sh | 3 ++- extras/vagrant/install.sh | 8 ++++---- extras/vagrant/run.sh | 9 +++++---- 6 files changed, 17 insertions(+), 13 deletions(-) mode change 100644 => 100755 extras/vagrant/install.sh diff --git a/extras/vagrant/Vagrantfile b/extras/vagrant/Vagrantfile index badaa979a43..a97a3dc38fc 100644 --- a/extras/vagrant/Vagrantfile +++ b/extras/vagrant/Vagrantfile @@ -12,6 +12,8 @@ Vagrant.configure(2) do |config| elsif distro == 'opensuse' config.vm.box = "opensuse/openSUSE-42.3-x86_64" config.vm.box_version = "1.0.4.20170726" + elsif distro == 'ubuntu1804' + config.vm.box = "bento/ubuntu-18.04" else config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm" end diff --git a/extras/vagrant/build.sh b/extras/vagrant/build.sh index 86ed4cdb184..3a10e707fb9 100755 --- a/extras/vagrant/build.sh +++ b/extras/vagrant/build.sh @@ -47,13 +47,13 @@ rm -f build-root/.bootstrap.ok if [ $OS_ID == "centos" ]; then echo rpm -V apr-devel rpm -V apr-devel - if [ $? != 0 ]; then sudo yum reinstall -y apr-devel;fi + if [ $? != 0 ]; then sudo -E yum reinstall -y apr-devel;fi echo rpm -V ganglia-devel rpm -V ganglia-devel - if [ $? != 0 ]; then sudo yum reinstall -y ganglia-devel;fi + if [ $? != 0 ]; then sudo -E yum reinstall -y ganglia-devel;fi echo rpm -V libconfuse-devel rpm -V libconfuse-devel - if [ $? != 0 ]; then sudo yum reinstall -y libconfuse-devel;fi + if [ $? != 0 ]; then sudo -E yum reinstall -y libconfuse-devel;fi fi # Build and install packaging diff --git a/extras/vagrant/clearinterfaces.sh b/extras/vagrant/clearinterfaces.sh index 78f6705ca32..31a63098e87 100755 --- a/extras/vagrant/clearinterfaces.sh +++ b/extras/vagrant/clearinterfaces.sh @@ -12,6 +12,6 @@ chown vagrant:vagrant ~vagrant/ifconfiga for intf in $(ls /sys/class/net) ; do if [ -d /sys/class/net/$intf/device ] && [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then - ifconfig $intf down + sudo -E ifconfig $intf down fi done diff --git a/extras/vagrant/env.sh b/extras/vagrant/env.sh index bd329ea7ce9..441a4c1aaef 100644 --- a/extras/vagrant/env.sh +++ b/extras/vagrant/env.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash -export VPP_VAGRANT_DISTRO="ubuntu1604" +export VPP_VAGRANT_DISTRO="ubuntu1804" export VPP_VAGRANT_NICS=2 export VPP_VAGRANT_VMCPU=4 export VPP_VAGRANT_VMRAM=4096 +export VPP_VAGRANT_POST_BUILD=install diff --git a/extras/vagrant/install.sh b/extras/vagrant/install.sh old mode 100644 new mode 100755 index a53faa4dd73..cfe5fe5b2d0 --- a/extras/vagrant/install.sh +++ b/extras/vagrant/install.sh @@ -12,7 +12,7 @@ fi if [ -f /etc/lsb-release ];then . /etc/lsb-release elif [ -f /etc/redhat-release ];then - sudo yum install -y redhat-lsb + sudo -E yum install -y redhat-lsb DISTRIB_ID=`lsb_release -si` DISTRIB_RELEASE=`lsb_release -sr` DISTRIB_CODENAME=`lsb_release -sc` @@ -24,7 +24,7 @@ echo DISTRIB_CODENAME: $DISTRIB_CODENAME echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION if [ $DISTRIB_ID == "Ubuntu" ]; then - (cd ${VPP_DIR}/build-root/;sudo dpkg -i *.deb) + (cd ${VPP_DIR}/build-root/;sudo -E dpkg -i *.deb) elif [ $DISTRIB_ID == "CentOS" ]; then - (cd ${VPP_DIR}/build-root/;sudo rpm -Uvh *.rpm) -fi \ No newline at end of file + (cd ${VPP_DIR}/build-root/;sudo -E rpm -Uvh *.rpm) +fi diff --git a/extras/vagrant/run.sh b/extras/vagrant/run.sh index 3c779fa23f6..61c9261fe2f 100755 --- a/extras/vagrant/run.sh +++ b/extras/vagrant/run.sh @@ -12,11 +12,12 @@ fi if [ "$OS_ID" == "centos" ] || [ "$OS_ID" == "opensuse" ]; then # Install uio-pci-generic - modprobe uio_pci_generic + sudo -E modprobe uio_pci_generic fi + echo "Starting VPP..." -if [ "$OS_ID" == "ubuntu" ] && [ $OS_CODENAME = "trusty" ] ; then - start vpp +if [ "$OS_ID" == "ubuntu" ] && [ "$OS_CODENAME" == "trusty" ] ; then + sudo -E start vpp else - service vpp start + sudo -E service vpp start fi -- 2.16.6