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>
This commit is contained in:
Gerald Combs 2018-06-25 15:39:30 -07:00 committed by Anders Broman
parent b0a25f4443
commit 724519d8f9
2 changed files with 12 additions and 13 deletions

View File

@ -3067,6 +3067,7 @@ if(SHELLCHECK_EXECUTABLE)
packaging/macosx/osx-app.sh.in
packaging/macosx/osx-dmg.sh.in
tools/compress-pngs.sh
tools/debian-setup.sh
tools/git-export-release.sh
tools/fuzz-test.sh
tools/gen-bugnote

View File

@ -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