blob: 68d25517ddfd9c43d961dc5df6dd218036461aa0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
#!/bin/bash
do_setup() {
echo "127.0.1.1 $(hostname) # temporary" >> /etc/hosts
}
do_mvn_install() {
MAVEN_VERSION=3.3.9
MAVEN_FILENAME=apache-maven-${MAVEN_VERSION}-bin.tar.gz
MAVEN_HOME=/opt/apache/maven
mkdir -p ${MAVEN_HOME}
tar -C ${MAVEN_HOME} --strip-components 1 -xzf /vagrant/${MAVEN_FILENAME}
}
do_cleanup() {
perl -i -ne 'print unless /^127.0.1.1.*# temporary$/' /etc/hosts
}
deb_probe_modules() {
for mod in "$@"
do
modprobe ${mod}
done
}
deb_enable_modules() {
for mod in "$@"
do
echo ${mod} >> /etc/modules
done
}
deb_aptconf_batchconf() {
cat <<EOF >> /etc/apt/apt.conf
APT {
Get {
Assume-Yes "true";
allow-change-held-packages "true";
allow-downgrades "true";
allow-remove-essential "true";
};
};
Dpkg::Options {
"--force-confdef";
"--force-confold";
};
quiet "2";
EOF
}
deb_sync_minor() {
echo '---> Updating OS'
# Standard update + upgrade dance
apt-get update
apt-get upgrade
apt-get dist-upgrade
}
deb_correct_shell() {
echo '---> Correcting system shell'
# Fix the silly notion that /bin/sh should point to dash by pointing it to bash
update-alternatives --install /bin/sh sh /bin/bash 100
}
deb_flush() {
echo '---> Flushing extra packages and package cache'
apt-get autoremove
apt-get clean
}
deb_add_ppa() {
echo "---> Adding '$1' PPA"
apt-get install software-properties-common
ATTEMPT=0
while [ ${ATTEMPT} -le 4 ]
do
FAIL=0
apt-add-repository -y $1 || FAIL=1
if [ ${FAIL} -eq 0 ]
then
break
fi
ATTEMPT=$(expr $ATTEMPT + 1)
done
apt-get update
}
deb_install_pkgs() {
apt-get install lsb-release
LSB_PATH=$(which lsb_release)
VERSION=$(lsb_release -r | awk '{print $2}')
DIST=$(lsb_release -i | awk '{print $3}')
CODENAME=$(lsb_release -c | awk '{print $2}')
echo "---> Detected [${DIST} v${VERSION} (${CODENAME})]"
# initialize PACKAGES
PACKAGES="cloud-initramfs-dyn-netconf cloud-initramfs-growroot
cloud-initramfs-rescuevol"
if [ "$VERSION" = '14.04' ]
then
# openjdk-8-jdk is not available in 14.04 repos by default
deb_add_ppa ppa:openjdk-r/ppa
# Install OpenJDK v8 *and* v7 on Trusty
PACKAGES="$PACKAGES openjdk-8-jdk-headless openjdk-7-jdk emacs24-nox"
elif [ "$VERSION" = '16.04' ]
then
# Install default jdk (v8 on this platform)
PACKAGES="$PACKAGES default-jdk-headless emacs-nox"
# plymouth-label and plymouth-themes are required to get rid of
# initrd warnings / errors on 16.04
apt-get install plymouth-themes plymouth-label
fi
# Build tools - should match vpp/Makefile DEB_DEPENDS variable
PACKAGES="$PACKAGES curl build-essential autoconf automake bison libssl-dev
ccache debhelper dkms git libtool libganglia1-dev libapr1-dev
dh-systemd libconfuse-dev git-review exuberant-ctags cscope indent"
# Interface manipulation tools, editors, debugger and lsb
PACKAGES="$PACKAGES iproute2 ethtool vlan bridge-utils
vim gdb lsb-release"
# Install latest kernel and uio
PACKAGES="$PACKAGES linux-image-extra-virtual linux-headers-virtual"
# $$$ comment out for the moment
# PACKAGES="$PACKAGES maven3"
# Install virtualenv for test execution
PACKAGES="$PACKAGES python-virtualenv python-pip python-dev"
echo '---> Installing packages'
# disable double quoting check
# shellcheck disable=SC2086
apt-get install ${PACKAGES}
# Specify documentation packages
DOC_PACKAGES="doxygen graphviz"
apt-get install ${DOC_PACKAGES}
}
deb_enable_hugepages() {
# Setup for hugepages using sysctl so it persists across reboots
sysctl -w vm.nr_hugepages=1024
mkdir -p /mnt/huge
echo "hugetlbfs /mnt/huge hugetlbfs defaults 0 0" >> /etc/fstab
}
deb_mount_hugepages() {
mount /mnt/huge
}
deb_reup_certs() {
# update CA certificates
echo '---> Forcing CA certificate update'
update-ca-certificates -f
}
deb_remove_pkgs() {
echo '---> Removing unattended-upgrades packge to avoid it locking /var/lib/dpkg/lock'
apt-get remove unattended-upgrades
}
deb_disable_apt_systemd_daily() {
echo '---> Stopping and disabling apt.systemd.daily to avoid it locking /var/lib/dpkg/lock'
if [ -f /usr/bin/systemctl ]
then
systemctl stop apt.systemd.daily
systemctl disable apt.systemd.daily
else
/etc/init.d/unattended-upgrades stop
update-rc.d -f unattended-upgrades remove
fi
}
rh_clean_pkgs() {
echo '---> Cleaning caches'
yum clean all -q
}
rh_update_pkgs() {
echo '---> Updating OS'
yum upgrade -q -y
}
rh_install_pkgs() {
echo '---> Installing tools'
# Install build tools
yum install -q -y @development redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils \
openssl-devel apr-devel indent
# Specify documentation packages
DOC_PACKAGES="doxygen graphviz"
yum install -q -y install ${DOC_PACKAGES}
# Install python development
OUTPUT=$(yum search python34-devel 2>&1 | grep 'No matches')
if [ -z "$OUTPUT" ]
then
echo '---> Installing python34-devel'
yum install -q -y python34-devel
else
echo '---> Installing python-devel'
yum install -q -y python-devel
fi
echo '---> Configuring EPEL'
# Install EPEL
OUTPUT=$(rpm -qa epel-release)
if [ -z "$OUTPUT" ]
then
yum install -q -y /vagrant/epel-release-latest-7.noarch.rpm
fi
# Install components to build Ganglia modules
yum install -q -y --enablerepo=epel {libconfuse,ganglia}-devel mock
# Install debuginfo packages
debuginfo-install -q -y glibc-2.17-106.el7_2.4.x86_64 openssl-libs-1.0.1e-51.el7_2.4.x86_64 zlib-1.2.7-15.el7.x86_64
}
|