test/vm_setup.sh: exit with error when unsupported pkg manager is detected

Exit early from script execution when unsupported pkg manager is found.
Just not before the "--help" has a chance to be called.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I176bf5778dd7b2bc510f54842202113c8614a9d4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3054
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Zawadzki 2020-06-25 05:01:02 -04:00
parent 82540a6fd1
commit 8bfb8c6a65

View File

@ -73,8 +73,6 @@ elif hash pacman &> /dev/null; then
elif hash pkg &> /dev/null; then
source "$vmsetupdir/pkgdep/pkg"
else
echo "Supported package manager not found. Script supports:"
printf ' * %s\n' "${managers[@]##*/}"
package_manager="undefined"
fi
@ -110,6 +108,12 @@ while getopts 'd:siuht:c:-:' optchar; do
esac
done
if [[ "$package_manager" == "undefined" ]]; then
echo "Supported package manager not found. Script supports:"
printf ' * %s\n' "${managers[@]##*/}"
exit 1
fi
if [ -n "$CONF_PATH" ]; then
if [ ! -f "$CONF_PATH" ]; then
echo Configuration file does not exist: "$CONF_PATH"