made the script somewhat idempodent

This commit is contained in:
Egon Rijpkema 2017-07-20 10:03:18 +02:00
parent 77d4c4a5d1
commit 09bce4f51c

View File

@ -1,4 +1,6 @@
#!/bin/bash -x
#!/bin/bash -ex
# printout debug info when running this script.
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
#
# Gemaakt voor RuG-CIT 2017-06-10 Door: Rein van Weerden
# ======================================================================
@ -17,6 +19,10 @@
# '-. \ "|\
# '.,,/'., dVR
#
#https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ -n ${DX} ]]
then
exec 1>>/tmp/${0##*/}.log 2>&1
@ -36,7 +42,7 @@ 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
sudo apt-get -y install libsslcommon2 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
@ -47,7 +53,7 @@ cd ~/src
# 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
cd /usr/lib/x86_64-linux-gnu
# 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
@ -76,13 +82,13 @@ sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
sudo ln -s /usr/bin/libtoolize /usr/bin/libtool
#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
#sudo cp /media/sf_VM-sfolder/build/libipfix_110209.tgz # staat er al
#sudo chown rein:rein libipfix_110209.tgz
tar xzf libipfix_110209.tgz
cd libipfix_110209/
./configure --prefix=/usr > configure.lst 2>&1
@ -90,7 +96,9 @@ 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
if [ ! -d librdkafka ] ; then
git clone https://github.com/edenhill/librdkafka.git
fi
cd librdkafka
./configure --prefix=/usr
make all > make.all.lst 2>&1
@ -126,10 +134,25 @@ 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
if [ ! -d protobuf ] ; then
git clone https://github.com/google/protobuf.git -b 3.3.x
fi
cd protobuf
# Copied from autogen.sh and modified.
if [ ! -d gmock ]; then
curl -L -O http://pkgs.fedoraproject.org/repo/pkgs/gmock/gmock-1.7.0.zip/073b984d8798ea1594f5e44d85b20d66/gmock-1.7.0.zip
unzip gmock-1.7.0.zip
sudo cp -r gmock-1.7.0 gmock
sudo chown $USER: gmock
mv gmock-1.7.0 gtest
rm gmock-1.7.0.zip
fi
sudo chown -R $USER: .
autoreconf -f -i -Wall
rm -rf autom4te.cache config.h.in~
./configure --prefix=/usr
make > make.all.lst 2>&1
sudo make install > make.install.lst 2>&1
@ -179,11 +202,11 @@ 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/
test -d cpp-driver || git clone https://github.com/datastax/cpp-driver.git
mkdir -p cpp-driver/build
cd cpp-driver
cd build
cmake .. > cmake..lst 2>&1
make > make.all.lst 2>&1
sudo make install > make.install.lst 2>&1
@ -191,13 +214,14 @@ 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 .
rm libcassandra.so.2 libcassandra.so
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
test -d git-repo || git clone https://gerrit.googlesource.com/git-repo
cd git-repo
sudo cp repo /usr/bin/
@ -206,7 +230,7 @@ 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
yes | 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
@ -232,7 +256,9 @@ cp packages.xml packages.xml.org
# sed -i '/thrift_patch1.diff/d' packages.xml
# sed -i '/thrift_autoconf.patch/d' packages.xml
# sed -i '/autoreconf/d' packages.xml
sudo mkdir -p /tmp/cache/$USER/third_party
sudo chown $USER: /tmp/cache/$USER/third_party
curl https://github.com/redis/hiredis/archive/v0.11.0.tar.gz -o /tmp/cache/$USER/third_party/hiredis-v0.11.0.tar.gz
python fetch_packages.py --file packages.xml
# mv thrift-0.10.0 thrift-0.8.0
cd thrift-0.8.0
@ -277,8 +303,7 @@ if [[ -f third_party/.cache/pugixml-1.2.tar.gz ]]
fi
fi
cd ~/src/Juniper/third_party
sudo cp /media/sf_VM-sfolder/build/mpackages.xml .
sudo chown rein:rein mpackages.xml
tar xvf $DIR/sharespot.tar
python fetch_packages.py --file mpackages.xml
export GOROOT=$HOME/src/Juniper/third_party/go
@ -287,8 +312,8 @@ 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
test -d cni || git clone https://github.com/containernetworking/cni.git
test -d plugins || git clone https://github.com/containernetworking/plugins.git
cd -
${GO} get "github.com/docker/docker/client"
${GO} get "github.com/natefinch/lumberjack"
@ -301,10 +326,8 @@ 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 .
sudo cp ~/src/Juniper/third_party/{macvlan.go,interface.go,veth.go} .
sudo chown -R $USER: .
# cd ~/src
# git clone https://github.com/Juniper/contrail-controller.git
# cd ~/src/Juniper/controller/src
@ -312,7 +335,9 @@ sudo cp /media/sf_VM-sfolder/build/veth.go .
# 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
# ln -s ../../../build/debug/analytics/analytics_request_skeleton.cpp analytics_request_skeleton.cpp # analytics_request_skeleton.cpp not present
sed -i "s/ 'nodeinfo',/ 'nodeinfo',\n 'dl',/" SConscript
cd ~/src/Juniper