summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2017-04-20 15:20:33 +0200
committerDario Lombardo <lomato@gmail.com>2017-04-25 21:07:23 +0000
commit5b1a802c3ee3cffb2b0754e6ed17c2a470278335 (patch)
tree5af0674bdd36adb37dfa1493602c29084af6153a /tools
parent451731f0c6d3991008df9f173782fc26f28629ba (diff)
downloadwireshark-5b1a802c3ee3cffb2b0754e6ed17c2a470278335.tar.gz
tools: improve debian-setup.
Change-Id: If547e0e1c821d3696eba0f303e8ab0769b1fabb4 Reviewed-on: https://code.wireshark.org/review/21245 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Dario Lombardo <lomato@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/debian-setup.sh33
1 files changed, 29 insertions, 4 deletions
diff --git a/tools/debian-setup.sh b/tools/debian-setup.sh
index 5118f61f4a..e2db669bb9 100755
--- a/tools/debian-setup.sh
+++ b/tools/debian-setup.sh
@@ -23,6 +23,23 @@
# that way.
#
+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
+
for op in $@
do
if [ "$op" = "--install-optional" ]
@@ -74,13 +91,21 @@ add_package ADDITIONAL_LIST libgnutls28-dev ||
add_package ADDITIONAL_LIST libgnutls-dev ||
echo "libgnutls28-dev and libgnutls-dev are unavailable" >&2
-# Install basic packages
-apt-get install $BASIC_LIST $OPTIONS
+ACTUAL_LIST=$BASIC_LIST
# Now arrange for optional support libraries
+if [ $ADDITIONAL ]
+then
+ ACTUAL_LIST="$ACTUAL_LIST $ADDITIONAL_LIST"
+fi
+
+apt-get install $ACTUAL_LIST $OPTIONS
+if [ $? != 0 ]
+then
+ exit 2
+fi
+
if [ ! $ADDITIONAL ]
then
echo "\n*** Optional packages not installed. Rerun with --install-optional to have them.\n"
-else
- apt-get install $ADDITIONAL_LIST $OPTIONS
fi