2023-09-13 01:29:56 +00:00
|
|
|
%post --erroronfail
|
|
|
|
set -x
|
|
|
|
|
2023-10-04 09:06:23 +00:00
|
|
|
MACHINE_ARCH="$(uname -m)"
|
|
|
|
DNF_RELEASEVER="$(dnf config-manager --dump-variables | grep 'releasever' | awk '{print $3}')"
|
|
|
|
|
2023-10-05 08:20:02 +00:00
|
|
|
# import the key manually, since it does not get automatically get imported...
|
|
|
|
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
|
|
|
|
|
2023-09-13 01:29:56 +00:00
|
|
|
# Setup networking temporarily
|
|
|
|
[ -f /etc/resolv.conf ] || echo "nameserver 1.1.1.1" > /etc/resolv.conf
|
|
|
|
|
|
|
|
# This repository is a given since it provides 'uboot-images-armv8' and
|
|
|
|
# 'uboot-tools', which are **required**.
|
2023-10-04 09:06:23 +00:00
|
|
|
dnf config-manager --assumeyes --add-repo "https://download.rockylinux.org/pub/sig/${DNF_RELEASEVER}/altarch/${MACHINE_ARCH}/altarch-common"
|
2023-10-04 09:28:02 +00:00
|
|
|
if ! dnf repolist --enabled | grep "download.rockylinux.org_pub_sig_${DNF_RELEASEVER}_altarch_${MACHINE_ARCH}_altarch-common" > /dev/null; then
|
|
|
|
dnf config-manager --set-enabled "download.rockylinux.org_pub_sig_${DNF_RELEASEVER}_altarch_${MACHINE_ARCH}_altarch-common" || exit 1
|
2023-09-13 01:29:56 +00:00
|
|
|
fi
|
|
|
|
|
2023-10-04 09:06:23 +00:00
|
|
|
if dnf list installed | grep '@epel' > /dev/null || dnf list installed | grep 'epel-release' > /dev/null; then
|
2023-09-13 01:29:56 +00:00
|
|
|
# Install the epel-release package since we don't know if a package was
|
|
|
|
# installed from EPEL or only the epel-release package was installed.
|
|
|
|
# Either way, the user definitely wants EPEL enabled, so just do that
|
|
|
|
# anyways.
|
|
|
|
dnf install --assumeyes epel-release
|
|
|
|
|
2023-10-04 09:06:23 +00:00
|
|
|
if ! dnf repolist --enabled | grep 'crb' > /dev/null; then
|
2023-09-13 01:29:56 +00:00
|
|
|
dnf config-manager --set-enabled crb || exit 1
|
|
|
|
fi
|
|
|
|
|
2023-10-04 09:06:23 +00:00
|
|
|
if ! dnf repolist --enabled | grep 'epel' > /dev/null; then
|
2023-09-13 01:29:56 +00:00
|
|
|
dnf config-manager --set-enabled epel || exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# This is my (Pratham Patel) COPR that I use to provide 'kernel-stable-tfg' and
|
|
|
|
# 'kernel-lts-tfg' packages. I intend to keep it up-to-date so this is enabled
|
|
|
|
# so that users can get updates whenever upstream bumps versions.
|
2023-10-04 09:28:02 +00:00
|
|
|
dnf copr enable --assumeyes prathampatel/kernel-tfg "rhel-${DNF_RELEASEVER}-${MACHINE_ARCH}"
|
2023-09-13 01:29:56 +00:00
|
|
|
if ! dnf repolist --enabled | grep 'copr:copr.fedorainfracloud.org:prathampatel:kernel-tfg' > /dev/null; then
|
|
|
|
dnf config-manager --set-enabled 'copr:copr.fedorainfracloud.org:prathampatel:kernel-tfg' || exit 1
|
|
|
|
fi
|
|
|
|
|
2023-10-08 23:47:30 +00:00
|
|
|
if dnf list installed | grep "kernel-next-tfg\|kernel-rc-tfg\|kernel-opi5-tfg" > /dev/null; then
|
2023-09-13 01:29:56 +00:00
|
|
|
# The user has installed a package that provides either kernel-next or
|
|
|
|
# kernel-rc which comes from the the 'prathampatel/kernel-testing-tfg'
|
|
|
|
# COPR repository. Since that is used, enable it so updates reach the user.
|
2023-10-04 09:28:02 +00:00
|
|
|
dnf copr enable --assumeyes prathampatel/kernel-testing-tfg "rhel-${DNF_RELEASEVER}-${MACHINE_ARCH}"
|
2023-09-13 01:29:56 +00:00
|
|
|
if ! dnf repolist --enabled | grep 'copr:copr.fedorainfracloud.org:prathampatel:kernel-testing-tfg' > /dev/null; then
|
|
|
|
dnf config-manager --set-enabled 'copr:copr.fedorainfracloud.org:prathampatel:kernel-testing-tfg' || exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2023-10-04 10:01:54 +00:00
|
|
|
# upgrade all packages for the user's happy smile
|
|
|
|
dnf clean expire-cache
|
|
|
|
dnf upgrade -y
|
|
|
|
|
2023-09-13 01:29:56 +00:00
|
|
|
# Remove the temporary 'resolv.conf' file
|
|
|
|
rm -v -f /etc/resolv.conf
|
|
|
|
|
|
|
|
%end
|