sbc-images/includes/post/rpm-repos-enable.ksi

48 lines
2.2 KiB
Plaintext

%post --erroronfail
set -x
MACHINE_ARCH="$(uname -m)"
VERSION_ID="$(source <(grep VERSION_ID /etc/os-release) && awk -F '.' '{print $1}' <<< $VERSION_ID)"
# This repository is a given since it provides 'uboot-images-armv8' and
# 'uboot-tools', which are **required**.
dnf config-manager --assumeyes --add-repo "https://download.rockylinux.org/pub/sig/${VERSION_ID}/altarch/${MACHINE_ARCH}/altarch-common"
if ! dnf repolist --enabled | grep "download.rockylinux.org_pub_sig_${VERSION_ID}_altarch_${MACHINE_ARCH}_altarch-common" > /dev/null; then
dnf config-manager --set-enabled "download.rockylinux.org_pub_sig_${VERSION_ID}_altarch_${MACHINE_ARCH}_altarch-common" || exit 1
fi
# import the SIG/AltArch key manually, since it does not get automatically get imported...
wget "https://download.rockylinux.org/pub/sig/${VERSION_ID}/altarch/${MACHINE_ARCH}/altarch-common/RPM-GPG-KEY-Rocky-SIG-AltArch"
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
rpm --import RPM-GPG-KEY-Rocky-SIG-AltArch
rm RPM-GPG-KEY-Rocky-SIG-AltArch
# Enable EPEL if packages are installed from EPEL
if dnf list installed | grep '@epel' > /dev/null || dnf list installed | grep 'epel-release' > /dev/null; then
dnf install --assumeyes epel-release
if ! dnf repolist --enabled | grep 'crb' > /dev/null; then
dnf config-manager --set-enabled crb || exit 1
fi
if ! dnf repolist --enabled | grep 'epel' > /dev/null; then
dnf config-manager --set-enabled epel || exit 1
fi
fi
# SIG/kernel's kernel-mainline-sbc
dnf copr enable --assumeyes prathampatel/kernel-rocky "rhel-${VERSION_ID}-${MACHINE_ARCH}"
if ! dnf repolist --enabled | grep 'copr:copr.fedorainfracloud.org:prathampatel:kernel-rocky' > /dev/null; then
dnf config-manager --set-enabled 'copr:copr.fedorainfracloud.org:prathampatel:kernel-rocky' || exit 1
fi
echo 'metadata_expire=2400' | tee -a '/etc/yum.repos.d/_copr:copr.fedorainfracloud.org:prathampatel:kernel-rocky.repo'
# manually import the GPG keys for my COPRs
wget 'https://download.copr.fedorainfracloud.org/results/prathampatel/kernel-rocky/pubkey.gpg' -O kernel-rocky-pubkey.gpg
rpm --import kernel-elrepo-pubkey.gpg
rm -vf kernel-elrepo-pubkey.gpg
dnf clean expire-cache
%end