From afbba5e5526bce30bd55dddcf3aad3ebfb517cd4 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Fri, 27 Nov 2020 23:06:26 -0500 Subject: [PATCH] Check for RPM and DNF before using them This allows dependencies to be automatically installed on Fedora, without causing problems on Debian. --- run-tests | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/run-tests b/run-tests index 33f8c429..74cf70a6 100755 --- a/run-tests +++ b/run-tests @@ -1,13 +1,16 @@ #!/bin/bash -- set -eu -unset applications do_install_deps CLEANUP_LVM name DEFAULT_LVM_POOL retcode -applications=(lvm2 python3-inotify python3-sphinx python3-docutils - python3-pyyaml python3-jinja2 python3-lxml python3-pylint python3-coverage - btrfs-progs vim-common) -do_install_deps=false -rpm -q --quiet -- "${applications[@]}" || -sudo dnf -- install "${applications[@]}" +unset CLEANUP_LVM name DEFAULT_LVM_POOL retcode +install_rpm_deps () { + local applications + applications=(lvm2 python3-inotify python3-sphinx python3-docutils + python3-pyyaml python3-jinja2 python3-lxml python3-pylint + python3-coverage btrfs-progs vim-common) + rpm -q --quiet -- "${applications[@]}" || + sudo dnf -- install "${applications[@]}" +} +if { command -pv rpm && command -pv dnf; }>/dev/null; then install_rpm_deps; fi CLEANUP_LVM= name=$(dirname "$0") if sudo --non-interactive "$name/ci/lvm-manage" setup-lvm vg$$/pool; then