From e71e8654eef332ead804b569ec361d296ed3e953 Mon Sep 17 00:00:00 2001 From: Tim Serong Date: Thu, 30 Apr 2015 17:44:10 +1000 Subject: [PATCH] run-make-check.sh: stricter check for yum/apt-get/zypper Believe it or not, it's possible (although not necessarily likely) to have both yum and zypper installed on openSUSE. In this case the previous implementation using `which` would return a string containing both commands, which doesn't work. Signed-off-by: Tim Serong --- run-make-check.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/run-make-check.sh b/run-make-check.sh index 940c3dacc2f1..c569ff4adc28 100755 --- a/run-make-check.sh +++ b/run-make-check.sh @@ -42,7 +42,16 @@ function get_processors() { } function run() { - sudo $(which apt-get yum zypper 2>/dev/null) install -y ccache jq + # Same logic as install-deps.sh for finding package installer + local install_cmd + test -f /etc/redhat-release && install_cmd="yum install -y" + type apt-get > /dev/null 2>&1 && install_cmd="apt-get install -y" + type zypper > /dev/null 2>&1 && install_cmd="zypper --gpg-auto-import-keys --non-interactive install" + if [ -n "$install_cmd" ]; then + sudo $install_cmd ccache jq + else + echo "WARNING: Don't know how to install packages" >&2 + fi sudo /sbin/modprobe rbd if test -f ./install-deps.sh ; then -- 2.47.3