Skip to content

Commit

Permalink
fix(akmods): Including V4L2Loopback & WL akmod fail the build
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftydinar authored Oct 6, 2024
1 parent 562b6d6 commit a7f0212
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions modules/akmods/akmods.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@
#!/usr/bin/env bash
set -euo pipefail

ENABLE_MULTIMEDIA_REPO() {
ENABLE_AKMODS_REPO() {
sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo
sed -i "0,/enabled/ s@enabled=0@enabled=1@g" /etc/yum.repos.d/negativo17-fedora-multimedia.repo
}

DISABLE_MULTIMEDIA_REPO() {
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/negativo17-fedora-multimedia.repo
}

SET_HIGHER_PRIORITY_AKMODS_REPO() {
echo "priority=90" >> /etc/yum.repos.d/_copr_ublue-os-akmods.repo
}

INSTALL_RPM_FUSION() {
rpm-ostree install \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
}

UNINSTALL_RPM_FUSION() {
rpm-ostree uninstall rpmfusion-free-release rpmfusion-nonfree-release
}

get_yaml_array INSTALL '.install[]' "$1"

if [[ ${#INSTALL[@]} -lt 1 ]]; then
echo "ERROR: You didn't specify any akmod for installation!"
exit 1
fi

INSTALL_PATH=("${INSTALL[@]/#/\/tmp/rpms/kmods/*}")
INSTALL_PATH=("${INSTALL_PATH[@]/%/*.rpm}")
INSTALL_STR=$(echo "${INSTALL_PATH[*]}" | tr -d '\n')

if [[ ${#INSTALL[@]} -gt 0 ]]; then
echo "Installing akmods"
echo "Installing: $(echo "${INSTALL[*]}" | tr -d '\n')"
SET_HIGHER_PRIORITY_AKMODS_REPO
ENABLE_MULTIMEDIA_REPO
# Universal Blue switched from RPMFusion to negativo17 repos
# Determine if RPMFusion for akmod is needed or not (WL & V4L2Loopback akmods currently require RPMFusion)

rpm_fusion_dependent=false
for akmod in "${INSTALL[@]}"; do
if [[ "${akmod}" =~ ^(wl|v4l2loopback)$ ]]; then
rpm_fusion_dependent=true
fi
done

echo "Installing akmods"
echo "Installing: $(echo "${INSTALL[*]}" | tr -d '\n')"
SET_HIGHER_PRIORITY_AKMODS_REPO
ENABLE_AKMODS_REPO
if "${rpm_fusion_dependent}"; then
INSTALL_RPM_FUSION
rpm-ostree install ${INSTALL_STR}
UNINSTALL_RPM_FUSION
else
rpm-ostree install ${INSTALL_STR}
DISABLE_MULTIMEDIA_REPO
fi
fi

0 comments on commit a7f0212

Please sign in to comment.