-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
executable file
·188 lines (161 loc) · 4.27 KB
/
setup
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
#!/bin/bash
# Copyright 2011 MIT Haystack Observatory
#
# This file is part of Mark6.
#
# Mark6 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# Mark6 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mark6. If not, see <http://www.gnu.org/licenses/>.
# Date: 6/21/2011
# Description:
# Install build dependencies.
# Filesystem variables
if [ "${VDAS_ROOT}" = "" ]; then
echo "Error. VDAS_ROOT must be set before running this script."
exit 1
fi
if [ "${VDAS_USER}" = "" ]; then
echo "Warning. VDAS_USER must be set before running this script."
exit 1
fi
EXTERN_ROOT=${VDAS_ROOT}/src/extern
# Binary dependencies
PREQ=$(cat <<EOP
automake autoconf build-essential flex linux-headers-2.6-amd64 git-core
byacc iperf texinfo texi2html subversion
libboost-all-dev libcppunit-dev
erlang erlang-os-mon libreadline5-dev
fio tree parted
EOP
)
# Source dependencies
# PF_RING dependency
PF_RING=PF_RING-4.7.0
# Commands
INSTALL=/usr/bin/apt-get
TAR=/bin/tar
RM=/bin/rm
GROUPADD=/usr/sbin/groupadd
CHMOD=/bin/chmod
CHGRP=/bin/chgrp
USERMOD=/usr/sbin/usermod
fix_squeeze_bugs() {
# Debian squeeze has a dangling symlink that breaks erlang packaging:
# lrwxrwxrwx 1 root root 19 Jul 5 13:46 /usr/lib/erlang/man/man1/gserialver.1.gz -> gserialver-4.4.1.gz
sudo ${RM} -f /usr/lib/erlang/man/man1/gserialver.1.gz
}
install_binary_deps() {
echo Installing binary dependencies: ${PREQ}
sudo ${INSTALL} install ${PREQ} -y
}
install_source_deps() {
echo Installing source dependencies
}
install_pfring() {
echo Installing ${PF_RING}...
cd ${EXTERN_ROOT}
${TAR} xvzf ${PF_RING}.tar.gz
cd ${PF_RING}
cd kernel
make
sudo make install
cd ..
cd userland
cd lib
./configure --prefix=/opt/mit/mark6
make
sudo make install
cd ..
cd libpcap-1.1.1-ring
./configure --prefix=/opt/mit/mark6
make
sudo make install
cd ..
cd ..
}
build() {
cd ${VDAS_ROOT}
./bootstrap
CXXFLAGS=-O4 ./configure \
--prefix=/opt/mit/mark6 \
BOOST_INCDIR=/usr/include/boost \
BOOST_LIBDIR=/usr/lib64/boost \
PFRING_ROOT=${VDAS_ROOT}/src/extern/PF_RING-4.7.0
make
}
install_mark6() {
cd ${VDAS_ROOT}
make
sudo make install
sudo ${GROUPADD} -f mark6
sudo ${CHGRP} -R mark6 /opt/mit/mark6
sudo ${CHMOD} g+rwx /opt/mit/mark6/bin/*
sudo ${CHMOD} -R g+rwx /opt/mit/mark6/lib
sudo ${CHMOD} g+rwx /opt/mit/mark6/lib/rel/mark6/bin/*
sudo ${USERMOD} -a -G mark6 ${VDAS_USER}
}
usage() {
echo "$0: [-b] [-s] [-p] [-B] [-f] [-a] [-h]"
echo " [--binary] [--source] [--pfring] [--fix] [--all] [--help]"
echo " -b, --binary Install binary dependencies"
echo " -s, --source Install source dependencies"
echo " -p, --pfring Install PF_RING"
echo " -B, --build Build software"
echo " -i, --install Build software"
echo " -f, --fix Fix debian os issues"
echo " -a, --all Do everything"
echo " -h, --help Display help message"
}
main() {
if [ $# -eq 0 ] ; then
usage
exit
fi
echo Welcome to the Mark6 setup program
echo
echo This software has been developed by MIT Haystack Observatory and
echo is released under the terms fo the GPL \(see LICENSE file\)
echo
echo Please direct any questions to [email protected]
echo
while [ "$1" != "" ]; do
case $1 in
-b | --binary ) install_binary_deps
;;
-s | --source ) install_source_deps
;;
-p | --pfring ) install_pfring
;;
-B | --build ) build
;;
-i | --install ) install_mark6
;;
-f | --fix ) fix_squeeze_bugs
;;
-a | --all ) install_binary_deps
fix_squeeze_bugs
install_pfring
install_source_deps
build
install_mark6
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
}
# Kick off setup.
echo $*
main $*