diff --git a/modules/bling/bling.tsp b/modules/bling/bling.tsp index 54f343f..601fcec 100644 --- a/modules/bling/bling.tsp +++ b/modules/bling/bling.tsp @@ -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">; } diff --git a/modules/bling/installers/negativo17.sh b/modules/bling/installers/negativo17.sh new file mode 100644 index 0000000..c728d68 --- /dev/null +++ b/modules/bling/installers/negativo17.sh @@ -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 diff --git a/modules/bling/installers/rpmfusion.sh b/modules/bling/installers/rpmfusion.sh new file mode 100644 index 0000000..23d93c6 --- /dev/null +++ b/modules/bling/installers/rpmfusion.sh @@ -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 diff --git a/modules/bling/module.yml b/modules/bling/module.yml index 32efdf1..5945f17 100644 --- a/modules/bling/module.yml +++ b/modules/bling/module.yml @@ -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