Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from
Nov 25, 2024
2 changes: 1 addition & 1 deletion modules/bling/bling.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -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">;
}
37 changes: 37 additions & 0 deletions modules/bling/installers/negativo17.sh
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions modules/bling/installers/rpmfusion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/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..."
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 repo is already installed"
fi
2 changes: 2 additions & 0 deletions modules/bling/module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down