feat(bling): rpmfusion & negativo17 repo helpers (#363)

* feat(bling): rpmfusion & negativo17 repo helpers

* chore: Make adding negativo repo more robust

* chore: Make sure that priority is set when negativo repo is installed

* chore: Improve RPMFusion repo install robustness

* chore: Fix some indendation

* chore: Fix some indetation pt. 2

* chore: Install all RPMFusion repos in cases when only free or non-free repo is installed

* chore: Install all RPMFusion repos in cases when only free or non-free repo is installed pt. 2

---------

Co-authored-by: fiftydinar <65243233+fiftydinar@users.noreply.github.com>
This commit is contained in:
xyny 2024-11-25 10:26:10 +02:00 committed by GitHub
parent a166afed8a
commit 387a29e127
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 69 additions and 1 deletions

View file

@ -9,5 +9,5 @@ model BlingModule {
type: "bling";
/** List of bling submodules to run / things to install onto your system. */
install: Array<"ublue-update" | "1password" | "dconf-update-service" | "gnome-vrr">;
install: Array<"rpmfusion" | "negativo17" | "ublue-update" | "1password" | "dconf-update-service" | "gnome-vrr">;
}

View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
# Tell build process to exit if there are any errors.
set -euo pipefail
# Check if rpmfusion is installed before running
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 [[ -n "${NEGATIVO_REPO_FILE}" ]]; then
echo "Negativo17 repo is already installed"
echo "Making sure that Negativo17 repo is enabled"
# Set all Negativo repo sources to disabled
sed -i 's@enabled=.*@enabled=0@g' "${NEGATIVO_REPO_FILE}"
# Enable only the 1st repo source (Multimedia repo)
sed -i '0,/enabled=/s/enabled=[^ ]*/enabled=1/' "${NEGATIVO_REPO_FILE}"
# Wipe all existing source priorities
sed -i '/priority=/d' "${NEGATIVO_REPO_FILE}"
# Set priority to 90 for 1st repo source (Multimedia repo)
sed -i '0,/enabled=1/{s/enabled=1/enabled=1\npriority=90/}' "${NEGATIVO_REPO_FILE}"
else
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..."
sed -i '0,/enabled=1/{s/enabled=1/enabled=1\npriority=90/}' /etc/yum.repos.d/negativo17-fedora-multimedia.repo
fi

View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Tell build process to exit if there are any errors.
set -euo pipefail
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..."
if ! rpm -q rpmfusion-free-release &>/dev/null && ! rpm -q rpmfusion-nonfree-release &>/dev/null; then
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"
elif ! rpm -q rpmfusion-free-release &>/dev/null; then
rpm-ostree install \
"https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-free-release-${OS_VERSION}.noarch.rpm"
elif ! rpm -q rpmfusion-nonfree-release &>/dev/null; then
rpm-ostree install \
"https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${OS_VERSION}.noarch.rpm"
fi
# 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 repo is already installed"
fi

View file

@ -3,6 +3,8 @@ shortdesc: The bling module can be used to pull in small "bling" into your image
example: |
type: bling
install:
- rpmfusion # install RPMFusion repos, disable negativo17 repos if installed
- negativo17 # install negativo17 repos and set priority to 90, uninstall RPMFusion repos if installed
- ublue-update # https://github.com/ublue-os/ublue-update
- 1password # install 1Password (stable) and `op` CLI tool
- dconf-update-service # a service unit that updates the dconf db on boot