aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-06-25 15:39:30 -0700
committerAnders Broman <a.broman58@gmail.com>2018-06-26 11:53:14 +0000
commit724519d8f987b069867cb9b0cf25a50116402f37 (patch)
tree5f4e8abb9ec8a47d4e37ea0b90ca3f0248a0e626 /tools
parentb0a25f4443b4cfa0f2cdc92ad7ce5fb3944adfe7 (diff)
Fix shellcheck issues in debian-setup.sh.
Change-Id: I54956ea4de5e07f1d2a705f9b77624d6c25511a6 Reviewed-on: https://code.wireshark.org/review/28438 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/debian-setup.sh24
1 files changed, 11 insertions, 13 deletions
diff --git a/tools/debian-setup.sh b/tools/debian-setup.sh
index 001be5a1fe..2321afe703 100755
--- a/tools/debian-setup.sh
+++ b/tools/debian-setup.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Setup development environment on Debian and derivatives such as Ubuntu
#
# Wireshark - Network traffic analyzer
@@ -13,16 +13,16 @@
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"
+ printf "\\nUtility to setup a debian-based system for Wireshark Development.\\n"
+ printf "The basic usage installs the needed software\\n\\n"
+ printf "Usage: %s [--install-optional] [...other options...]\\n" "$0"
+ printf "\\t--install-optional: install optional software as well"
+ printf "\\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 ]
+if [ "$(id -u)" -ne 0 ]
then
echo "You must be root."
exit 1
@@ -83,6 +83,7 @@ add_package() {
return 1
elif [ -n "$versionreq" ]; then
# Require minimum version or fail.
+ # shellcheck disable=SC2086
dpkg --compare-versions $version $versionreq || return 1
fi
@@ -123,13 +124,10 @@ then
ACTUAL_LIST="$ACTUAL_LIST $ADDITIONAL_LIST"
fi
-apt-get install $ACTUAL_LIST $OPTIONS
-if [ $? != 0 ]
-then
- exit 2
-fi
+# shellcheck disable=SC2086
+apt-get install $ACTUAL_LIST $OPTIONS || exit 2
if [ ! $ADDITIONAL ]
then
- echo "\n*** Optional packages not installed. Rerun with --install-optional to have them.\n"
+ printf "\\n*** Optional packages not installed. Rerun with --install-optional to have them.\\n"
fi