From bd6ee4479f17db1b75a8ebb200104082dfc2d01f Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Sun, 10 Apr 2022 15:40:36 -0700 Subject: [PATCH] Tools: Make the Debian and RPM setup scripts more strict. We use debian-setup.sh and rpm-setup.sh to build the containers in https://gitlab.com/wireshark/wireshark-containers/. Make sure they fail with a nonzero exit status, otherwise we might end up with an invalid container image. Make sure OPTIONS is defined in all of the setup scripts that use it. --- tools/alpine-setup.sh | 1 + tools/arch-setup.sh | 1 + tools/bsd-setup.sh | 1 + tools/debian-setup.sh | 5 ++++- tools/msys2-setup.sh | 1 + tools/rpm-setup.sh | 3 +++ 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/alpine-setup.sh b/tools/alpine-setup.sh index 38771fb393..7da2ed6e64 100755 --- a/tools/alpine-setup.sh +++ b/tools/alpine-setup.sh @@ -29,6 +29,7 @@ then fi ADDITIONAL=0 +OPTIONS= for arg; do case $arg in --install-optional) diff --git a/tools/arch-setup.sh b/tools/arch-setup.sh index 51cc8733fe..2cdfb49405 100755 --- a/tools/arch-setup.sh +++ b/tools/arch-setup.sh @@ -34,6 +34,7 @@ fi ADDITIONAL=0 TESTDEPS=0 AUR=0 +OPTIONS= for arg; do case $arg in --install-optional) diff --git a/tools/bsd-setup.sh b/tools/bsd-setup.sh index 3f92a711d1..10bf93d8a5 100755 --- a/tools/bsd-setup.sh +++ b/tools/bsd-setup.sh @@ -30,6 +30,7 @@ then exit 1 fi +OPTIONS= for op do if [ "$op" = "--install-optional" ] diff --git a/tools/debian-setup.sh b/tools/debian-setup.sh index c08c271858..3ccf4dc467 100755 --- a/tools/debian-setup.sh +++ b/tools/debian-setup.sh @@ -11,6 +11,8 @@ # that way. # +set -e -u -o pipefail + if [ "$1" = "--help" ] then printf "\\nUtility to setup a debian-based system for Wireshark Development.\\n" @@ -33,6 +35,7 @@ fi ADDITIONAL=0 DEBDEPS=0 TESTDEPS=0 +OPTIONS= for arg; do case $arg in --install-optional) @@ -113,7 +116,7 @@ TESTDEPS_LIST= # Adds package $2 to list variable $1 if the package is found. # If $3 is given, then this version requirement must be satisfied. add_package() { - local list="$1" pkgname="$2" versionreq="$3" version + local list="$1" pkgname="$2" versionreq="${3:-}" version version=$(apt-cache show "$pkgname" 2>/dev/null | awk '/^Version:/{ print $2; exit}') diff --git a/tools/msys2-setup.sh b/tools/msys2-setup.sh index c17b65388b..62c8080f1d 100644 --- a/tools/msys2-setup.sh +++ b/tools/msys2-setup.sh @@ -27,6 +27,7 @@ fi ADDITIONAL=0 TESTDEPS=0 LUA=0 +OPTIONS= for arg; do case $arg in --install-optional) diff --git a/tools/rpm-setup.sh b/tools/rpm-setup.sh index 38d6b18ef2..c176bdd9f2 100755 --- a/tools/rpm-setup.sh +++ b/tools/rpm-setup.sh @@ -11,6 +11,8 @@ # that way. # +set -e -u -o pipefail + if [ "$1" = "--help" ] then echo "\nUtility to setup a rpm-based system for Wireshark Development.\n" @@ -31,6 +33,7 @@ fi ADDITIONAL=0 RPMDEPS=0 +OPTIONS= for arg; do case $arg in --install-optional)