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 <tserong@suse.com>
}
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