provisioner.bash 4.77 KB
Newer Older
garciay's avatar
garciay committed
1
2
#!/bin/bash
# Prepare environment for the build
garciay's avatar
garciay committed
3
#set -e # Exit with non 0 if any command fails
garciay's avatar
garciay committed
4
5
6
7
8
#set -vx

# Update system
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
garciay's avatar
garciay committed
9
sudo DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common -y
garciay's avatar
garciay committed
10
11
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:linuxuprising/java -y
sudo DEBIAN_FRONTEND=noninteractive apt-get update
garciay's avatar
garciay committed
12
sudo DEBIAN_FRONTEND=noninteractive apt-get --allow-unauthenticated install emacs openjdk-11-jre gcc-8 g++-8 git subversion lsof ntp gdb make cmake flex bison autoconf doxygen graphviz libtool libncurses5-dev expect libssl-dev libxml2-dev xutils-dev tcpdump libpcap-dev libwireshark-dev wget tree unzip sshpass kubuntu-desktop valgrind qt5-default qtmultimedia5-dev libqt5svg5-dev vim tzdata -y
garciay's avatar
garciay committed
13
14
# Install java
#sudo DEBIAN_FRONTEND=noninteractive apt-get install oracle-java9-installer oracle-java9-set-default -y
garciay's avatar
garciay committed
15
#sudo DEBIAN_FRONTEND=noninteractive apt-get --allow-unauthenticated install oracle-java10-installer oracle-java10-set-default -y
garciay's avatar
garciay committed
16
#sudo DEBIAN_FRONTEND=noninteractive apt --fix-broken install -y
garciay's avatar
garciay committed
17
18
19
20
21
22
23
24
25
26
27
sudo DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y
sudo DEBIAN_FRONTEND=noninteractive apt-get clean

gcc --version
g++ --version
valgrind --version
java -version

export USERNAME=$1
export PASSWORD=$2

garciay's avatar
garciay committed
28
export HOME=/home/vagrant
garciay's avatar
garciay committed
29

garciay's avatar
garciay committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
export PATH_DEV=${HOME}/dev
export HOME_FRAMEWORKS=${HOME}/frameworks
export HOME_LIB=${HOME}/lib
export HOME_BIN=${HOME}/bin
export HOME_ETC=${HOME}/etc
export HOME_INC=${HOME}/include
export HOME_TMP=${HOME}/tmp
export HOME_DOCS=${HOME}/docs
export PATH=${HOME_BIN}:${PATH}
export LD_LIBRARY_PATH=${HOME_LIB}:/usr/local/lib:${LD_LIBRARY_PATH}

OLD_PWD=`pwd`
# Create directories
mkdir -p ${HOME_LIB}
if [ ! -d ${HOME_LIB} ]
then
    exit -1
fi
mkdir -p ${HOME_INC}
if [ ! -d ${HOME_INC} ]
then
    exit -1
fi
mkdir -p ${HOME_BIN}
if [ ! -d ${HOME_BIN} ]
then
    exit -1
fi
mkdir -p ${HOME_TMP}
if [ ! -d ${HOME_TMP} ]
then
    exit -1
fi
mkdir -p ${HOME_DOCS}
if [ ! -d ${HOME_DOCS} ]
then
    exit -1
fi
mkdir -p ${HOME_FRAMEWORKS}
if [ ! -d ${HOME_FRAMEWORKS} ]
then
    exit -1
fi
garciay's avatar
garciay committed
73
74
75
76
77
mkdir -p ${PATH_DEV}
if [ ! -d ${PATH_DEV} ]
then
    exit -1
fi
garciay's avatar
garciay committed
78

garciay's avatar
garciay committed
79
80
81
cd /home/vagrant/dev 
svn co --username $USERNAME --password $PASSWORD --non-interactive https://oldforge.vagrant.org/svn/ITS/branches/STF525 ./STF525_Its 
cd /home/vagrant/dev/STF525_Its/scripts
garciay's avatar
garciay committed
82
83
84
85
86
chmod 775 *.bash devenv.bash.*
cd /home/vagrant/dev/STF525_Its/docker
chmod 775 *.sh
cd /home/vagrant/dev/STF525_Its
chmod 775 ./.jenkins.sh
garciay's avatar
garciay committed
87
88
89
cd /home/vagrant
ln -sf /home/vagrant/dev/STF525_Its/scripts/devenv.bash.ubuntu /home/vagrant/devenv.bash
. /home/vagrant/devenv.bash
garciay's avatar
garciay committed
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

# Install all frameworks
cd ${HOME_FRAMEWORKS}

# Install asn1c
cd ${HOME_FRAMEWORKS}
git clone https://github.com/vlm/asn1c.git asn1c
cd ${HOME_FRAMEWORKS}/asn1c
test -f configure || autoreconf -iv
./configure
make && sudo make install
cd -

# Install GoogleTest
cd ${HOME_FRAMEWORKS}
git clone https://github.com/google/googletest.git googletest
cd ${HOME_FRAMEWORKS}/googletest/
cmake .
make CXX=g++
sudo make install
cd -

# Install latest LCOV
mkdir -p ${HOME_FRAMEWORKS}/lcov
cd ${HOME_FRAMEWORKS}/lcov
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz
tar xf lcov_1.13.orig.tar.gz
sudo make -C lcov-1.13/ install
cd -

# Install lcov to coveralls conversion
sudo gem install coveralls-lcov

lcov --version
coveralls-lcov -h

# Install eclipse
cd ${HOME_FRAMEWORKS}

garciay's avatar
garciay committed
129
wget 'http://ftp.halifax.rwth-aachen.de/eclipse/technology/epp/downloads/release/oxygen/2/eclipse-cpp-oxygen-2-linux-gtk-x86_64.tar.gz' -Oeclipse-cpp-oxygen-2-linux-gtk-x86_64.tar.gz
garciay's avatar
garciay committed
130
131
132
133
134
135
136
tar -zxvf ./eclipse-cpp-oxygen-2-linux-gtk-x86_64.tar.gz
rm -f ./eclipse-cpp-oxygen-2-linux-gtk-x86_64.tar.gz

# Checkout the project
if [ ${USERNAME} != '' ] && [ ${PASSWORD} != '' ]
then
    cd ${HOME}/tmp
garciay's avatar
garciay committed
137
    svn co --username $USERNAME --password $PASSWORD --non-interactive https://oldforge.vagrant.org/svn/ITS/branches/STF525
garciay's avatar
garciay committed
138
139
140
else
    echo "Pease set <username> & <password> in your local Vagrantfile"
    exit -1
garciay's avatar
garciay committed
141
142
fi

garciay's avatar
garciay committed
143
144
145
146
147
148
sudo echo "" >> /etc/profile 
sudo echo "export HOME=/home/etsi" >> /etc/profile 
sudo echo "export LD_LIBRARY_PATH=/home/etsi/TriesAndDelete/etsi_its/lib:$LD_LIBRARY_PATH" >> /etc/profile 
sudo echo "export PATH=/home/etsi/bin:$PATH" >> /etc/profile 
sudo echo "cd /home/etsi" >> /etc/profile 
sudo echo ". ./devenv.bash" >> /etc/profile 
garciay's avatar
garciay committed
149

garciay's avatar
garciay committed
150
cd /home/vagrant/dev/STF525_Its/scripts
garciay's avatar
garciay committed
151
152
./build_titan.bash 
. /home/etsi/devenv.bash 
garciay's avatar
garciay committed
153
./update_its_project.bash
garciay's avatar
garciay committed
154
155
156
157
158
159
#ln -sf ~/TriesAndDelete/etsi_its/lib/libItsAsn.so ~/lib/libItsAsn.so
#cd ${HOME}/TriesAndDelete/etsi_its/src/TestCodec/objs
#. ${HOME}/devenv.bash
#../bin/testcodec_generate_makefile.bash
#../bin/run_mtc.bash &
#../bin/run_ptcs.bash
garciay's avatar
garciay committed
160
161
162
163
164
165
166
167
168

cd ${OLD_PWD}

unset USERNAME
unset PASSWORD

sudo init 6

exit 0