blob: 813c5f439175a0dc9f17c46ed4586492dd062084 [file] [log] [blame]
Ed Warnicke3ba4d362016-09-01 11:54:27 -07001#!/bin/bash
2# Figure out what system we are running on
3if [ -f /etc/lsb-release ];then
4 . /etc/lsb-release
5elif [ -f /etc/redhat-release ];then
6 sudo yum install -y redhat-lsb
7 DISTRIB_ID=`lsb_release -si`
8 DISTRIB_RELEASE=`lsb_release -sr`
9 DISTRIB_CODENAME=`lsb_release -sc`
10 DISTRIB_DESCRIPTION=`lsb_release -sd`
11fi
12KERNEL_OS=`uname -o`
13KERNEL_MACHINE=`uname -m`
14KERNEL_RELEASE=`uname -r`
15KERNEL_VERSION=`uname -v`
16
17echo KERNEL_OS: $KERNEL_OS
18echo KERNEL_MACHINE: $KERNEL_MACHINE
19echo KERNEL_RELEASE: $KERNEL_RELEASE
20echo KERNEL_VERSION: $KERNEL_VERSION
21echo DISTRIB_ID: $DISTRIB_ID
22echo DISTRIB_RELEASE: $DISTRIB_RELEASE
23echo DISTRIB_CODENAME: $DISTRIB_CODENAME
24echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
25
26# Make sure git is installed
27if [ $DISTRIB_ID == "CentOS" ]; then
28 yum -y install git
29elif [ $DISTRIB_ID == "Ubuntu" ]; then
30 apt-get -y install git
31fi
32
33# Setup the vpp code
34cd ~vagrant/
35sudo -u vagrant mkdir git
36cd git/
37echo "SSH_AUTH_SOCK $SSH_AUTH_SOCK x"
38chmod 777 $SSH_AUTH_SOCK
39
40CLONE_URL=`cd /vpp;git remote -v | grep origin |grep fetch |awk '{print $2}'`
41echo "CLONE_URL $CLONE_URL"
42echo $CLONE_URL | grep -q "^ssh:"
43if [ $? == 0 ]; then
44 SSH_HOST=`echo $CLONE_URL| awk -F/ '{print $3}'`
45 SSH_PORT=`echo $SSH_HOST| awk -F: '{print $2}'`
46 if [ -n $SSH_PORT ]; then
47 SSH_PORT="-p $SSH_PORT"
48 fi
49 SSH_HOST=`echo $SSH_HOST| awk -F: '{print $1}'`
50 echo "SSH_HOST $SSH_HOST"
51 echo "SSH_PORT $SSH_PORT"
52 sudo -HE -u vagrant ssh -oStrictHostKeyChecking=no -v $SSH_PORT $SSH_HOST
53fi
54sudo -HE -u vagrant git clone $CLONE_URL