From 5b7559554732931d7b015016bd566cbd7bbaf9dd Mon Sep 17 00:00:00 2001 From: fiftydinar <65243233+fiftydinar@users.noreply.github.com> Date: Sun, 24 Nov 2024 21:10:40 +0100 Subject: [PATCH] chore: Improve RPMFusion repo install robustness --- modules/bling/installers/rpmfusion.sh | 31 ++++++++++++--------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/modules/bling/installers/rpmfusion.sh b/modules/bling/installers/rpmfusion.sh index 3115d23..a0d2299 100644 --- a/modules/bling/installers/rpmfusion.sh +++ b/modules/bling/installers/rpmfusion.sh @@ -3,22 +3,19 @@ # Tell build process to exit if there are any errors. set -euo pipefail -# Check if rpmfusion is already installed before running -if [[ "$(rpm -q rpmfusion-free-release)" != "rpmfusion-free-release"* && "$(rpm -q rpmfusion-nonfree-release)" != "rpmfusion-nonfree-release"* ]]; then - - echo "running rpmfusion install..." - rpm-ostree install \ - "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-${OS_VERSION}.noarch.rpm" \ - "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${OS_VERSION}.noarch.rpm" - - # check if negativo17 repo is installed - if [[ -f /etc/yum.repos.d/negativo17-fedora-multimedia.repo ]]; then - echo "making sure negativo17 repo is disabled" - sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/negativo17-fedora-multimedia.repo - fi +NEGATIVO_REPO_FILE="$(awk -F'=' '$1 == "name" && $2 == "negativo17 - Multimedia" {print FILENAME}' /etc/yum.repos.d/*)" +# Check if rpmfusion is already installed before running +if ! rpm -q rpmfusion-free-release &>/dev/null && ! rpm -q rpmfusion-nonfree-release &>/dev/null; then + echo "Running RPMFusion repo install..." + rpm-ostree install \ + "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-${OS_VERSION}.noarch.rpm" \ + "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${OS_VERSION}.noarch.rpm" + # check if negativo17 repo is installed + if [[ -n "${NEGATIVO_REPO_FILE}" ]]; then + echo "Making sure that Negativo17 repo is disabled" + sed -i 's@enabled=1@enabled=0@g' "${NEGATIVO_REPO_FILE}" + fi else - - echo "rpmfusion is already installed" - -fi \ No newline at end of file + echo "RPMFusion repo is already installed" +fi