Skip to content

Commit

Permalink
chore: Make adding negativo repo more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftydinar authored Nov 24, 2024
1 parent 0108b3f commit 195a52d
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions modules/bling/installers/negativo17.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,33 @@
set -euo pipefail

# Check if rpmfusion is installed before running
if [[ "$(rpm -q rpmfusion-free-release)" == "rpmfusion-free-release"* && "$(rpm -q rpmfusion-nonfree-release)" == "rpmfusion-nonfree-release"* ]]; then

echo "uninstalling rpmfusion..."
if rpm -q rpmfusion-free-release &>/dev/null || rpm -q rpmfusion-nonfree-release &>/dev/null; then
echo "Uninstalling RPMFusion repo..."
if rpm -q rpmfusion-free-release &>/dev/null && rpm -q rpmfusion-nonfree-release &>/dev/null; then
rpm-ostree uninstall rpmfusion-free-release rpmfusion-nonfree-release

elif rpm -q rpmfusion-free-release &>/dev/null; then
rpm-ostree uninstall rpmfusion-free-release
elif rpm -q rpmfusion-nonfree-release &>/dev/null; then
rpm-ostree uninstall rpmfusion-nonfree-release
fi
fi

NEGATIVO_REPO_FILE="$(awk -F'=' '$1 == "name" && $2 == "negativo17 - Multimedia" {print FILENAME}' /etc/yum.repos.d/*)"

# check if negativo17 repo is installed
if [[ -f /etc/yum.repos.d/negativo17-fedora-multimedia.repo ]]; then
if [[ -n "${NEGATIVO_REPO_FILE}" ]]; then

echo "negativo17 repo is already installed"
echo "making sure negativo17 repo is enabled"
sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/negativo17-fedora-multimedia.repo
echo "Negativo17 repo is already installed"
echo "Making sure that Negativo17 repo is enabled"
sed -i 's@enabled=.*@enabled=0@g' "${NEGATIVO_REPO_FILE}"
sed -i '0,/enabled=/s/enabled=[^ ]*/enabled=1/' "${NEGATIVO_REPO_FILE}"

else

echo "installing negativo17 repo..."
echo "Installing Negativo17 repo..."
curl -Lo /etc/yum.repos.d/negativo17-fedora-multimedia.repo https://negativo17.org/repos/fedora-multimedia.repo

echo "setting negativo17 repo priority to 90..."
echo "Setting Negativo17 repo priority to 90..."
sed -i '0,/enabled=1/{s/enabled=1/enabled=1\npriority=90/}' /etc/yum.repos.d/negativo17-fedora-multimedia.repo

fi
fi

0 comments on commit 195a52d

Please sign in to comment.