got these files from Rein over email

This commit is contained in:
Egon Rijpkema 2017-07-19 09:40:15 +02:00
commit a693eac7a5
3 changed files with 571 additions and 0 deletions

329
JuniperControllerBuild Executable file
View File

@ -0,0 +1,329 @@
#!/bin/bash -x
#
# Gemaakt voor RuG-CIT 2017-06-10 Door: Rein van Weerden
# ======================================================================
# JuniperControllerBuild Copyright dVR H&S Sys. 2017
# ======================================================================
#
# JuniperControllerBuild is used
# go and build a Contrail Controlller in a virtualbox
#
# ____
# <. .\
# \..|
# \ |___(\--/)
# __/ ( . . )
# "'._. '-.O.'
# '-. \ "|\
# '.,,/'., dVR
#
if [[ -n ${DX} ]]
then
exec 1>>/tmp/${0##*/}.log 2>&1
set -${DX} # Are you going to debug? (DX is set to 'x' (set DX='x') or unset)
fi
#
date > /home/rein/JuniperControllerBuild.run.time
rm -Rf .repo
rm -Rf ~/.repo*
cd /home/rein
echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
sudo apt-get update
sudo apt-get -y install pkgconf
sudo apt-get -y install autoconf automake bison debhelper flex libexpat-dev libgettextpo0 libtool libxml2-utils make python-all python-dev python-lxml python-setuptools python-sphinx ruby-ronn scons unzip vim-common libsnmp-python libfixbuf3 libfixbuf3-dev zlib1g-dev
sudo apt-get -y install glibc-source
sudo apt-get -y install libssl-dev
cd ~/src
# sudo cp /media/sf_VM-sfolder/build/openssl-1.0.2d.tar.gz .
# sudo chown rein:rein openssl-1.0.2d.tar.gz
# tar xzf openssl-1.0.2d.tar.gz
# cd openssl-1.0.2d
# ./config --prefix=/usr threads zlib shared
# make all > make.all.lst 2>&1
# find /usr -name "libssl.*" -exec rm -f {} \;
# find /usr -name "libcrypto.*" -exec rm -f {} \;
# sudo make install > make.install.lst 2>&1
cd /usr/lib
# sudo ln -s libssl.so.1.0.0 libssl.so.1.0.0
# sudo ln -s libssl.so.1.0.0 libssl.so.1.0.2
# sudo ln -s libssl.so.1.0.0 libssl.so
# sudo ln -s libcrypto.so.1.0.0 libcrypto.so.1.0.0
# sudo ln -s libcrypto.so.1.0.0 libcrypto.so.1.0.2
# sudo ln -s libcrypto.so.1.0.0 libcrypto.so
sudo cp -a libssl.* libcrypto.* /lib/x86_64-linux-gnu/
mkdir -p ~/src/Juniper/build/lib
sudo cp -a libssl.* libcrypto.* ~/src/Juniper/build/lib
sudo ldconfig
cd ~/src
sudo apt-get -y install libboost-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev google-mock libgoogle-perftools-dev liblog4cplus-dev libtbb-dev libhttp-parser-dev libxml2-dev libicu-dev libpcap-dev libsasl2-dev
sudo apt-get -y install libcurl4-gnutls-dev
sudo apt-get -y install libzookeeper-java libzookeeper2 libzookeeper-mt2 libzookeeper-mt-dev
sudo apt-get -y install cmake cmake-data cmake-extras
sudo apt-get -y install python-virtualenv python-libxml2 libxslt1-dev
sudo apt-get -y install w3m
sudo apt-get -y install nmon
sudo apt-get -y install python3-pip
sudo pip3 install pip --upgrade
sudo apt-get -y install python-pip
sudo pip2 install pip --upgrade
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
sudo ln -s /usr/bin/libtoolize /usr/bin/libtool
cd ~/src
# git clone https://github.com/tubav/libipfix.git
sudo cp /media/sf_VM-sfolder/build/libipfix_110209.tgz .
sudo chown rein:rein libipfix_110209.tgz
tar xzf libipfix_110209.tgz
cd libipfix_110209/
./configure --prefix=/usr > configure.lst 2>&1
make all > make.all.lst 2>&1
sudo make install > make.install.lst 2>&1
cd ~/src
git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --prefix=/usr
make all > make.all.lst 2>&1
sudo make install > make.install.lst 2>&1
sudo ldconfig
cd /usr/lib
if [[ ! -f libnl-3.so ]]
then
sudo ln -s /lib/x86_64-linux-gnu/libnl-3.so.200 libnl-3.so
fi
if [[ ! -f libnl-genl-3.so ]]
then
sudo ln -s /lib/x86_64-linux-gnu/libnl-genl-3.so.200 libnl-genl-3.so
fi
cd ~/src
sudo ldconfig
cat << EOF > ~/.gitconfig.new
[user]
name = plReynaerde
email = plreynaerde@dvrhss.net
[push]
default = simple
[filter "media"]
clean = git media clean %f
smudge = git media smudge %f
required = true
[http]
sslVerify = false
EOF
sudo mv -f ~/.gitconfig.new ~/.gitconfig
cd ~/src
git clone https://github.com/google/protobuf.git -b 3.3.x
cd protobuf/
sed -i 's#curl $curlopts -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip#curl $curlopts -O http://pkgs.fedoraproject.org/repo/pkgs/gmock/gmock-1.7.0.zip/073b984d8798ea1594f5e44d85b20d66/gmock-1.7.0.zip#' autogen.sh
./autogen.sh
./configure --prefix=/usr
make > make.all.lst 2>&1
sudo make install > make.install.lst 2>&1
mkdir -p ~/src/Juniper/build/lib
cd ~/src/Juniper/build/lib/
cp -a ~/src/protobuf/src/.libs/* .
rm -f libprotobuf.la libprotobuf-lite.la libprotoc.la
cp -a ~/src/protobuf/src/libprotobuf.la .
cp -a ~/src/protobuf/src/libprotobuf-lite.la .
cp -a ~/src/protobuf/src/libprotoc.la .
sudo ldconfig
cd ~/src
mkdir -p casdrvr
cd casdrvr
DISTRO=$(sudo lsb_release -is|tr '[:upper:]' '[:lower:]')
THISONE=$(sudo lsb_release -rs)
ALIST=$(w3m -dump -no-graph http://downloads.datastax.com/cpp-driver/${DISTRO}/${THISONE}/dependencies/libuv/|tail -n +6|head -n -2|cut -f2 -d'v'|sed 's/\/.*$//'|tr -d '.')
for ALN in ${ALIST}
do
if [[ $((${ALNO})) -lt $((${ALN})) ]]
then
export ALNO=${ALN}
fi
done
export ALNN=v
for ((i=0; i<${#ALNO}; i++))
do
if [[ i -ne 1 ]]
then
export ALNN+="${ALNO:$i:1}."
else
export ALNN+="${ALNO:$i:1}"
fi
done
ALEN=$((${#ALNN} - 1))
AVN=${ALNN:0:${ALEN}}
ADRVLST=$(w3m -dump -no-graph http://downloads.datastax.com/cpp-driver/${DISTRO}/${THISONE}/dependencies/libuv/${AVN}/|tail -n +7|head -n -2|awk -F ' ' '{ print $3 }'|grep -v dbg)
for AFN in ${ADRVLST}
do
wget http://downloads.datastax.com/cpp-driver/${DISTRO}/${THISONE}/dependencies/libuv/${AVN}/${AFN}
done
sudo dpkg --force-all --install libuv_*
sudo dpkg --force-all --install libuv-dev_*
cd ~/src
# git clone https://github.com/datastax/cpp-driver.git -b 2.0
git clone https://github.com/datastax/cpp-driver.git
cd cpp-driver/
mkdir -p build
cd build/
cmake .. > cmake..lst 2>&1
make > make.all.lst 2>&1
sudo make install > make.install.lst 2>&1
mkdir -p ~/src/Juniper/build/lib/
cd ~/src/Juniper/build/lib/
cp ~/src/cpp-driver/build/libcassandra.so.2.7.0 .
cp ~/src/cpp-driver/build/libcassandra_static.a .
ln -s libcassandra.so.2.7.0 libcassandra.so.2
ln -s libcassandra.so.2 libcassandra.so
sudo ldconfig
cd ~/src
git clone https://gerrit.googlesource.com/git-repo
cd git-repo
sudo cp repo /usr/bin/
cd ~/src
mkdir -p Juniper
cd Juniper
#repo init -u https://github.com/Juniper/contrail-vnc -b R4.0
repo init -u git@github.com:Juniper/contrail-vnc -b R4.0
#find .repo/manifests -iname "*.xml" -exec sed -i 's/project name="/project name="Juniper\//' {} \;
repo sync
#sed -i 's#third_party/rapidjson#build/third_party/rapidjson#' controller/lib/rapidjson/SConscript
# <package>
# <name>Apache Thrift 0.8</name>
# <url>http://archive.apache.org/dist/thrift/0.8.0/thrift-0.8.0.tar.gz</url>
# <patches>
# <patch strip="2">thrift_patch1.diff</patch>
# <patch strip="2">thrift_autoconf.patch</patch>
# </patches>
# <format>tgz</format>
# <md5>d29dfcd38d476cbc420b6f4d80ab966c</md5>
# <autoreconf>true</autoreconf>
# </package>
cd third_party
cp packages.xml packages.xml.org
# sed -i 's/0.8.0\/thrift-0.8.0.tar.gz/0.10.0\/thrift-0.10.0.tar.gz/' packages.xml
# sed -i 's/d29dfcd38d476cbc420b6f4d80ab966c/795c5dd192e310ffff38cfd9430d6b29/' packages.xml
# sed -i '/thrift_patch1.diff/d' packages.xml
# sed -i '/thrift_autoconf.patch/d' packages.xml
# sed -i '/autoreconf/d' packages.xml
python fetch_packages.py --file packages.xml
# mv thrift-0.10.0 thrift-0.8.0
cd thrift-0.8.0
autoconf
# sudo cp /media/sf_VM-sfolder/build/THRIFT-2039-thrift_config_h.patch .
# sudo chown rein:rein THRIFT-2039-thrift_config_h.patch
# patch -p1 < THRIFT-2039-thrift_config_h.patch
mkdir -p ~/src/Juniper/build/include/
cd ~/src/Juniper/build/include/
# sudo cp /media/sf_VM-sfolder/build/thrift_include.txz .
# sudo chown rein:rein thrift_include.txz
# tar xJf thrift_include.txz
mkdir -p ~/src/Juniper/third_party/thrift-0.8.0/compiler/cpp
cd ~/src/Juniper/third_party/thrift-0.8.0/compiler/cpp
# sudo cp /media/sf_VM-sfolder/build/thrift_include.txz .
# sudo chown rein:rein thrift_include.txz
# tar xJf thrift_include.txz
cd ~/src/Juniper
if [[ -f third_party/.cache/vijava55b20130927src.jar ]]
then
if [[ -d ~/src/Juniper/third_party/vijava ]]
then
cd ~/src/Juniper/third_party/vijava
if [[ ! -f README.txt ]]
then
unzip ../.cache/vijava55b20130927src.jar
cd ~/src/Juniper
patch -p1 < third_party/vijava_patch1.diff
fi
fi
fi
cd ~/src/Juniper
if [[ -f third_party/.cache/pugixml-1.2.tar.gz ]]
then
if [[ -d ~/src/Juniper/third_party/pugixml ]]
then
cd ~/src/Juniper/third_party/pugixml
if [[ ! -f readme.txt ]]
then
tar xzf ../.cache/pugixml-1.2.tar.gz
fi
fi
fi
cd ~/src/Juniper/third_party
sudo cp /media/sf_VM-sfolder/build/mpackages.xml .
sudo chown rein:rein mpackages.xml
python fetch_packages.py --file mpackages.xml
export GOROOT=/home/rein/src/Juniper/third_party/go
export GOPATH=/home/rein/go
export GO=${GOROOT}/bin/go
mkdir -p ${GOPATH}/src/github.com/containernetworking
cd ${GOPATH}/src/github.com/containernetworking
rm -Rf cni
git clone https://github.com/containernetworking/cni.git
git clone https://github.com/containernetworking/plugins.git
cd -
${GO} get "github.com/docker/docker/client"
${GO} get "github.com/natefinch/lumberjack"
${GO} get "github.com/vishvananda/netlink"
mkdir -p ~/src/Juniper/third_party/go/src
cd ~/src/Juniper/third_party/go/src
ln -s ~/go/src/github.com github.com
mkdir -p ~/src/Juniper/third_party/go/pkg/linux_amd64
cd ~/src/Juniper/third_party/go/pkg/linux_amd64
ln -s ~/go/pkg/linux_amd64/github.com github.com
cd ~/src/Juniper/controller/src/container/cni/cni/common
sudo cp /media/sf_VM-sfolder/build/macvlan.go .
sudo cp /media/sf_VM-sfolder/build/interface.go .
sudo cp /media/sf_VM-sfolder/build/veth.go .
# cd ~/src
# git clone https://github.com/Juniper/contrail-controller.git
# cd ~/src/Juniper/controller/src
# rm -Rf analytics
# cp -a ~/src/contrail-controller/src/analytics .
cd ~/src/Juniper/controller/src/analytics
ln -s ../../../build/debug/analytics/analytics_request_skeleton.cpp analytics_request_skeleton.cpp
sed -i "s/ 'nodeinfo',/ 'nodeinfo',\n 'dl',/" SConscript
cd ~/src/Juniper
sudo -H pip install generateDS --upgrade
echo "doScons" > ~/next
date >> /home/rein/JuniperControllerBuild.run.time
sudo reboot
date >> /home/rein/JuniperControllerBuild.run.time

205
buildKern Normal file
View File

@ -0,0 +1,205 @@
#!/bin/bash
#
# Gemaakt voor RuG-CIT 2017-05-27 Door: Rein van Weerden
# ======================================================================
# buildKern Copyright dVR H&S Sys. 2017
# ======================================================================
#
# build is used to check a flag file set by a webhook and if
# go and build a kernel in a virtualbox
#
# ____
# <. .\
# \..|
# \ |___(\--/)
# __/ ( . . )
# "'._. '-.O.'
# '-. \ "|\
# '.,,/'., dVR
#
if [[ -n ${DX} ]]
then
exec 1>>/tmp/${0##*/}.log 2>&1
set -${DX} # Are you going to debug? (DX is set to 'x' (set DX='x') or unset)
fi
#
cd ${HOME}/build
if [[ ! -f /tmp/flg.build ]]
then
exit
else
if [[ -f flg.building ]]
then
echo "Busy with a build. Try again later"
exit
else
sudo mv /tmp/flg.build flg.building
fi
fi
DATUM="$(/bin/date '+%a %d %b (%V) %Y %H:%M:%S %Z')"
EPOCH="$(/bin/date '+%s')"
VBOXMANAGE=$(which VBoxManage)
VBOXMANAGE=${VBOXMANAGE:-"/usr/local/bin/VBoxManage"}
if [[ ! -x "${VBOXMANAGE}" ]]
then
echo "Command 'VBoxManage' not found, bailing out"
exit 1
fi
CLONENAME=$(/usr/local/bin/uuidgen -t)
CLONENAME=${CLONENAME%%-*}
cat << EOF > .gitconfig
[user]
name = plReynaerde
email = plreynaerde@dvrhss.net
[push]
default = simple
[filter "media"]
clean = git media clean %f
smudge = git media smudge %f
required = true
[http]
sslVerify = false
EOF
REPONAME=$(cat flg.building |sed -n '2p')
BRANCHNAME=$(cat flg.building |sed -n '3p')
CONFIGFILE=$(cat flg.building |sed -n '4p')
# CONFIGFILE=$(echo ${CONFIGFILE} |sed -e 's/:2242//')
KERNELSET=${CONFIGFILE%/*}
KERNELSET=${KERNELSET}/Kernel.git
cat << EOF > getAndBuild
#!/bin/bash -x
#
# Gemaakt voor RuG-CIT 2017-05-27 Door: Rein van Weerden
# ======================================================================
# getAndBuild Copyright dVR H&S Sys. 2017
# ======================================================================
#
# getAndBuild is used to check a flag file set by a webhook and if
# go and build a kernel in a virtualbox
#
# ____
# <. .\
# \..|
# \ |___(\--/)
# __/ ( . . )
# "'._. '-.O.'
# '-. \ "|\
# '.,,/'., dVR
#
if [[ -n \${DX} ]]
then
exec 1>>/tmp/\${0##*/}.log 2>&1
set -\${DX} # Are you going to debug? (DX is set to 'x' (set DX='x') or unset)
fi
#
date > /home/rein/getAndBuild.run.time
cd /home/rein/bin
mv mvGet2here mvGet2here.done
sudo mv /media/sf_VM-sfolder/build/vr_genetlink.c.new /home/rein/src
sudo chown rein:rein /home/rein/src/vr_genetlink.c.new
sudo chmod a-wx,a+r,u+w /home/rein/src/vr_genetlink.c.new
cd /home/rein
echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
sudo dpkg --configure -a
sudo apt-get update
# sudo apt-get -y install autoconf automake bison debhelper flex libcurl4-openssl-dev libexpat1-dev libgettextpo0 libprotobuf-dev libtool libxml2-utils make protobuf-compiler python-all python-lxml python-setuptools python-sphinx ruby-ronn scons unzip vim-common python-netsnmp librdkafka-dev librdkafka1
sudo apt-get -y install autoconf automake bison debhelper flex libcurl4-openssl-dev libexpat1-dev libgettextpo0 libprotobuf-dev libtool libxml2-utils make protobuf-compiler python-all python-lxml python-setuptools python-sphinx ruby-ronn scons unzip vim-common python-netsnmp
sudo apt-get -y install python-dev
sudo apt-get -y install libfixbuf3-dev
sudo apt-get -y install xz-utils cpio pax
sudo apt-get -y install libncurses5-dev
sudo apt-get -y install libssl-dev
sudo mv /media/sf_VM-sfolder/build/libssl1.0.0_1.0.2g-1ubuntu4_amd64.deb .
sudo apt-get -f install
sudo apt-get -y install git
sudo apt-get -y install g++ g++-multilib
# sudo apt-get -y install gcc-4.9-plugin-dev
sudo apt-get -y install gcc-5-plugin-dev
sudo apt-get -y --no-install-recommends install dselect build-essential fakeroot kernel-package
sudo apt-get -y install libboost-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev libcurl4-openssl-dev google-mock libgoogle-perftools-dev liblog4cplus-dev libtbb-dev libhttp-parser-dev libxml2-dev libicu-dev
# sudo apt-get -y install libuv1 libuv1-dev
sudo apt-get -y install libpcap-dev
sudo apt-get -y install libnl-3-200 libnl-3-dev libnl-genl-3-200 libnl-genl-3-dev
sudo apt-get -y install cmake cmake-data cmake-extras
sudo apt-get -y install w3m
sudo apt-get -y install repo
sudo apt-get -y install nmon
sudo apt-get -y -f install
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
sudo rm -f /media/sf_VM-sfolder/build/dpkg-gencontrol
date >> /home/rein/getAndBuild.run.time
MAKEOPTIES="--jobs \$(nproc) V=1 -d"
mkdir -p src/Linux
cd src/Linux
# git clone ${KERNELSET}
# git clone ${CONFIGFILE}
# cd ~/src/Linux/build
# ln -s ../Kernel source
# if make \${MAKEOPTIES} prepare > make.prepare.lst 2>&1
# then
# if make \${MAKEOPTIES} modules > make.modules.lst 2>&1
# then
# if make \${MAKEOPTIES} all > make.all.lst 2>&1
# then
# if sudo make \${MAKEOPTIES} modules_install > make.modules_install.lst 2>&1
# then
# if sudo make \${MAKEOPTIES} headers_install > make.headers_install.lst 2>&1
# then
# if sudo make \${MAKEOPTIES} install > make.install.lst 2>&1
# then
# VERSION=\$(cat include/config/kernel.release)
# cd /boot
# sudo update-grub
# sudo update-initramfs -c -k \${VERSION}
# sudo update-grub
# sudo update-initramfs -u -k \${VERSION}
# sudo update-grub
# fi
# fi
# fi
# fi
# fi
# fi
date >> /home/rein/getAndBuild.run.time
# cd ~/src/Linux/build
# KR=\$(cat include/config/kernel.release)
KR=\$(uname -r)
echo \${KR} > ~/kernel.version
# sudo mkdir -p /usr/src/linux-headers-\${KR}
# sudo cp -a * /usr/src/linux-headers-\${KR}/
# cd /usr/src/
# sudo chown -R root:root linux-headers-\${KR}
date >> /home/rein/getAndBuild.run.time
echo "JuniperControllerBuild" > next
sleep 5
sudo reboot
EOF
chmod 777 getAndBuild
mkdir -p ~/VM-sfolder/build
cp getAndBuild ~/VM-sfolder/build
cp .gitconfig ~/VM-sfolder/build
cp dpkg-gencontrol ~/VM-sfolder/build
cp vr_genetlink.c.new ~/VM-sfolder/build
#cp JuniperVRouterBuild ~/VM-sfolder/build
cp openssl-1.1.0f.tar.gz ~/VM-sfolder/build
cp libipfix_110209.tgz ~/VM-sfolder/build
cp JuniperControllerBuild ~/VM-sfolder/build
cp mpackages.xml ~/VM-sfolder/build
BUILDERNAME="build-${CLONENAME}"
UUID=$(${VBOXMANAGE} showvminfo builder|grep 'Hardware UUID:'|cut -f5 -d' ')
${VBOXMANAGE} clonevm --mode all --name "${BUILDERNAME}" --register "${UUID}"
${VBOXMANAGE} startvm "${BUILDERNAME}" --type headless
echo "To connet to the VM use: ssh \$(getVMIPAddress ${BUILDERNAME})"
sudo rm -f .gitconfig flg.building getAndBuild

37
doScons Normal file
View File

@ -0,0 +1,37 @@
#!/bin/bash
#
# Gemaakt voor RuG-CIT 2017-07-17 Door: Rein van Weerden
# ======================================================================
# doScons Copyright dVR H&S Sys. 2017
# ======================================================================
#
# doVRouterMake is used to check a 4.11 release kernel and if
# go and build a Contrail VRouter in a virtualbox
#
# ____
# <. .\
# \..|
# \ |___(\--/)
# __/ ( . . )
# "'._. '-.O.'
# '-. \ "|\
# '.,,/'., dVR
#
if [[ -n ${DX} ]]
then
exec 1>>/tmp/${0##*/}.log 2>&1
set -${DX} # Are you going to debug? (DX is set to 'x' (set DX='x') or unset)
fi
#
export USER=rein
export GOROOT=/home/${USER}/src/Juniper/third_party/go
export GOPATH=/home/${USER}/go
date >> /home/${USER}/doScons.run.time
cd /home/${USER}/src/Juniper
#export C_INCLUDE_PATH="/usr/include"
#export CPLUS_INCLUDE_PATH="/usr/include"
export NUM_CPU="$(nproc)"
scons -Q debug=1 > /home/${USER}/doScons.log 2>&1
date >> /home/${USER}/doScons.run.time