aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Warnicke <eaw@cisco.com>2016-09-01 11:54:27 -0700
committerDave Wallace <dwallacelf@gmail.com>2016-09-02 02:05:57 +0000
commit3ba4d36d927444cfd1929c3d130af7dc9194ea6c (patch)
tree3fcd9cc58fff10f1af5c8e5a8fa70d701e1c2942
parent16bcf7d8dcd411e6a6b8d217cce5e450f7357bb3 (diff)
VPP-373: stop building from /vpp mount
Change-Id: I7f8fe8fa6c24b4229b0cb45e6c83e7cb2828e2da Signed-off-by: Ed Warnicke <eaw@cisco.com>
-rw-r--r--build-root/vagrant/Vagrantfile10
-rwxr-xr-xbuild-root/vagrant/build.sh4
-rwxr-xr-xbuild-root/vagrant/clone.sh54
3 files changed, 63 insertions, 5 deletions
diff --git a/build-root/vagrant/Vagrantfile b/build-root/vagrant/Vagrantfile
index 641397e82ba..47709033435 100644
--- a/build-root/vagrant/Vagrantfile
+++ b/build-root/vagrant/Vagrantfile
@@ -14,8 +14,9 @@ Vagrant.configure(2) do |config|
config.vm.box_check_update = false
config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh")
- config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant"
- config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp"
+ config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clone.sh")
+ config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/home/vagrant/git/vpp vagrant"
+ config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/home/vagrant/git/vpp"
config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh")
config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh")
@@ -59,8 +60,11 @@ Vagrant.configure(2) do |config|
vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2)
vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096)
-
+
+ config.ssh.forward_agent = true
+
config.vm.synced_folder "../../", "/vpp", disabled: false
+
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--ioapic", "on"]
vb.memory = "#{vmram}"
diff --git a/build-root/vagrant/build.sh b/build-root/vagrant/build.sh
index aecb1d64a72..8695b030d44 100755
--- a/build-root/vagrant/build.sh
+++ b/build-root/vagrant/build.sh
@@ -47,8 +47,8 @@ make UNATTENDED=yes install-dep
# Really really clean things up so we can be sure
# that the build works even when switching distros
-make wipe
-(cd build-root/;make distclean)
+$SUDOCMD make wipe
+(cd build-root/;$SUDOCMD make distclean)
rm -f build-root/.bootstrap.ok
if [ $DISTRIB_ID == "CentOS" ]; then
diff --git a/build-root/vagrant/clone.sh b/build-root/vagrant/clone.sh
new file mode 100755
index 00000000000..813c5f43917
--- /dev/null
+++ b/build-root/vagrant/clone.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+# Figure out what system we are running on
+if [ -f /etc/lsb-release ];then
+ . /etc/lsb-release
+elif [ -f /etc/redhat-release ];then
+ sudo yum install -y redhat-lsb
+ DISTRIB_ID=`lsb_release -si`
+ DISTRIB_RELEASE=`lsb_release -sr`
+ DISTRIB_CODENAME=`lsb_release -sc`
+ DISTRIB_DESCRIPTION=`lsb_release -sd`
+fi
+KERNEL_OS=`uname -o`
+KERNEL_MACHINE=`uname -m`
+KERNEL_RELEASE=`uname -r`
+KERNEL_VERSION=`uname -v`
+
+echo KERNEL_OS: $KERNEL_OS
+echo KERNEL_MACHINE: $KERNEL_MACHINE
+echo KERNEL_RELEASE: $KERNEL_RELEASE
+echo KERNEL_VERSION: $KERNEL_VERSION
+echo DISTRIB_ID: $DISTRIB_ID
+echo DISTRIB_RELEASE: $DISTRIB_RELEASE
+echo DISTRIB_CODENAME: $DISTRIB_CODENAME
+echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
+
+# Make sure git is installed
+if [ $DISTRIB_ID == "CentOS" ]; then
+ yum -y install git
+elif [ $DISTRIB_ID == "Ubuntu" ]; then
+ apt-get -y install git
+fi
+
+# Setup the vpp code
+cd ~vagrant/
+sudo -u vagrant mkdir git
+cd git/
+echo "SSH_AUTH_SOCK $SSH_AUTH_SOCK x"
+chmod 777 $SSH_AUTH_SOCK
+
+CLONE_URL=`cd /vpp;git remote -v | grep origin |grep fetch |awk '{print $2}'`
+echo "CLONE_URL $CLONE_URL"
+echo $CLONE_URL | grep -q "^ssh:"
+if [ $? == 0 ]; then
+ SSH_HOST=`echo $CLONE_URL| awk -F/ '{print $3}'`
+ SSH_PORT=`echo $SSH_HOST| awk -F: '{print $2}'`
+ if [ -n $SSH_PORT ]; then
+ SSH_PORT="-p $SSH_PORT"
+ fi
+ SSH_HOST=`echo $SSH_HOST| awk -F: '{print $1}'`
+ echo "SSH_HOST $SSH_HOST"
+ echo "SSH_PORT $SSH_PORT"
+ sudo -HE -u vagrant ssh -oStrictHostKeyChecking=no -v $SSH_PORT $SSH_HOST
+fi
+sudo -HE -u vagrant git clone $CLONE_URL