From 5daa964b9c6df5e9d57fe32b48d3b7d9208d3d61 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Fri, 27 Nov 2020 22:20:39 -0500 Subject: [PATCH] Only install dependencies if needed If all of the dependencies are already installed, there is no need to install them with DNF. --- run-tests | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/run-tests b/run-tests index 8687a9f3..33f8c429 100755 --- a/run-tests +++ b/run-tests @@ -1,9 +1,16 @@ -#!/bin/sh -- +#!/bin/bash -- set -eu -sudo dnf -y install lvm2 python3-inotify python3-sphinx python3-docutils python3-PyYAML python3-jinja2 python3-lxml python3-pylint python3-coverage btrfs-progs vim-common +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[@]}" CLEANUP_LVM= -if sudo --non-interactive $(dirname "$0")/ci/lvm-manage setup-lvm vg$$/pool; then +name=$(dirname "$0") +if sudo --non-interactive "$name/ci/lvm-manage" setup-lvm vg$$/pool; then export DEFAULT_LVM_POOL=vg$$/pool CLEANUP_LVM=yes fi