2013-02-04 00:29:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Setup development environment on Debian and derivatives such as Ubuntu
|
|
|
|
#
|
2013-09-13 21:40:19 +00:00
|
|
|
# Wireshark - Network traffic analyzer
|
|
|
|
# By Gerald Combs <gerald@wireshark.org>
|
|
|
|
# Copyright 1998 Gerald Combs
|
|
|
|
#
|
|
|
|
# This program 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; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program 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 this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
2013-02-04 00:29:27 +00:00
|
|
|
# We drag in tools that might not be needed by all users; it's easier
|
|
|
|
# that way.
|
|
|
|
#
|
2016-01-29 09:13:57 +00:00
|
|
|
|
2017-04-20 13:20:33 +00:00
|
|
|
if [ "$1" = "--help" ]
|
|
|
|
then
|
|
|
|
echo "\nUtility to setup a debian-based system for Wireshark Development.\n"
|
|
|
|
echo "The basic usage installs the needed software\n\n"
|
|
|
|
echo "Usage: $0 [--install-optional] [...other options...]\n"
|
|
|
|
echo "\t--install-optional: install optional software as well"
|
|
|
|
echo "\t[other]: other options are passed as-is to apt\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check if the user is root
|
|
|
|
if [ $(id -u) -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "You must be root."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-06-17 17:30:57 +00:00
|
|
|
for op in $@
|
|
|
|
do
|
|
|
|
if [ "$op" = "--install-optional" ]
|
|
|
|
then
|
|
|
|
ADDITIONAL=1
|
|
|
|
else
|
|
|
|
OPTIONS="$OPTIONS $op"
|
|
|
|
fi
|
|
|
|
done
|
2016-01-29 09:13:57 +00:00
|
|
|
|
2016-08-04 07:51:32 +00:00
|
|
|
BASIC_LIST="libgtk2.0-dev libpcap-dev bison flex make automake \
|
2017-05-09 18:04:27 +00:00
|
|
|
libtool python perl libgcrypt-dev"
|
2016-08-04 07:51:32 +00:00
|
|
|
|
|
|
|
ADDITIONAL_LIST="libnl-3-dev qttools5-dev qttools5-dev-tools libgtk-3-dev \
|
2016-11-15 16:10:11 +00:00
|
|
|
libc-ares-dev libkrb5-dev libqt5svg5-dev lynx libsmi2-dev \
|
2017-05-09 18:04:27 +00:00
|
|
|
portaudio19-dev asciidoc libsbc-dev libgeoip-dev \
|
2016-11-21 22:52:04 +00:00
|
|
|
qtmultimedia5-dev liblua5.2-dev libnl-cli-3-dev \
|
2016-11-03 21:39:34 +00:00
|
|
|
libparse-yapp-perl qt5-default cmake libcap-dev \
|
2017-04-04 21:23:59 +00:00
|
|
|
liblz4-dev libsnappy-dev libspandsp-dev libxml2-dev"
|
2016-08-04 07:51:32 +00:00
|
|
|
|
2016-11-09 00:55:30 +00:00
|
|
|
# Adds package $2 to list variable $1 if the package is found
|
|
|
|
add_package() {
|
|
|
|
local list="$1" pkgname="$2"
|
|
|
|
|
|
|
|
# fail if the package is not known
|
|
|
|
[ -n "$(apt-cache show "$pkgname" 2>/dev/null)" ] || return 1
|
|
|
|
|
|
|
|
# package is found, append it to list
|
|
|
|
eval "${list}=\"\${${list}} \${pkgname}\""
|
|
|
|
}
|
|
|
|
|
|
|
|
# only needed for newer distro versions where "libtool" binary is separated.
|
|
|
|
# Debian >= jessie, Ubuntu >= 16.04
|
|
|
|
add_package BASIC_LIST libtool-bin
|
|
|
|
|
|
|
|
# Debian >= wheezy-backports, Ubuntu >= 16.04
|
|
|
|
add_package ADDITIONAL_LIST libnghttp2-dev ||
|
|
|
|
echo "libnghttp2-dev is unavailable" >&2
|
|
|
|
|
|
|
|
# libssh-gcrypt-dev: Debian >= jessie, Ubuntu >= 16.04
|
|
|
|
# libssh-dev (>= 0.6): Debian >= jessie, Ubuntu >= 14.04
|
|
|
|
add_package ADDITIONAL_LIST libssh-gcrypt-dev ||
|
|
|
|
add_package ADDITIONAL_LIST libssh-dev ||
|
|
|
|
echo "libssh-gcrypt-dev and libssh-dev are unavailable" >&2
|
2016-08-04 07:51:32 +00:00
|
|
|
|
2016-11-21 22:52:04 +00:00
|
|
|
# libgnutls-dev: Debian <= jessie, Ubuntu <= 16.04
|
|
|
|
# libgnutls28-dev: Debian >= wheezy-backports, Ubuntu >= 12.04
|
|
|
|
add_package ADDITIONAL_LIST libgnutls28-dev ||
|
|
|
|
add_package ADDITIONAL_LIST libgnutls-dev ||
|
|
|
|
echo "libgnutls28-dev and libgnutls-dev are unavailable" >&2
|
2016-08-04 07:51:32 +00:00
|
|
|
|
2017-04-20 13:20:33 +00:00
|
|
|
ACTUAL_LIST=$BASIC_LIST
|
2013-02-04 00:29:27 +00:00
|
|
|
|
2016-01-29 09:13:57 +00:00
|
|
|
# Now arrange for optional support libraries
|
2017-04-20 13:20:33 +00:00
|
|
|
if [ $ADDITIONAL ]
|
|
|
|
then
|
|
|
|
ACTUAL_LIST="$ACTUAL_LIST $ADDITIONAL_LIST"
|
|
|
|
fi
|
|
|
|
|
|
|
|
apt-get install $ACTUAL_LIST $OPTIONS
|
|
|
|
if [ $? != 0 ]
|
|
|
|
then
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2016-08-04 07:51:32 +00:00
|
|
|
if [ ! $ADDITIONAL ]
|
2016-01-29 09:13:57 +00:00
|
|
|
then
|
|
|
|
echo "\n*** Optional packages not installed. Rerun with --install-optional to have them.\n"
|
|
|
|
fi
|