diff --git a/includes/post/cleanup.ksi b/includes/post/cleanup.ksi index 85555b8..c977bee 100644 --- a/includes/post/cleanup.ksi +++ b/includes/post/cleanup.ksi @@ -2,7 +2,7 @@ set -x echo "Packages within this disk image" -rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' |sort -rn +rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' | sort -rn # Remove all network connections and/or links rm -v -f /etc/sysconfig/network-scripts/ifcfg-link diff --git a/includes/post/rpm-repos-enable.ksi b/includes/post/rpm-repos-enable.ksi index e949d4e..c29d5e4 100644 --- a/includes/post/rpm-repos-enable.ksi +++ b/includes/post/rpm-repos-enable.ksi @@ -1,28 +1,31 @@ %post --erroronfail set -x +MACHINE_ARCH="$(uname -m)" +DNF_RELEASEVER="$(dnf config-manager --dump-variables | grep 'releasever' | awk '{print $3}')" + # 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**. -dnf config-manager --assumeyes --add-repo "https://download.rockylinux.org/pub/sig/$(dnf config-manager --dump-variables | grep releasever | awk '{print $3}')/altarch/$(uname -m)/altarch-common" -if ! dnf repolist --enabled | grep "download.rockylinux.org_pub_sig_$(dnf config-manager --dump-variables | grep releasever | awk '{print $3}')_altarch_$(uname -m)_altarch-common" > /dev/null; then - dnf config-manager --set-enabled "download.rockylinux.org_pub_sig_$(dnf config-manager --dump-variables | grep releasever | awk '{print $3}')_altarch_$(uname -m)_altarch-common" || exit 1 +dnf config-manager --assumeyes --add-repo "https://download.rockylinux.org/pub/sig/${DNF_RELEASEVER}/altarch/${MACHINE_ARCH}/altarch-common" +if ! dnf repolist --enabled | grep "download.rockylinux.org_pub_sig_${DNF_RELEASE_VER}_altarch_${MACHINE_ARCH}_altarch-common" > /dev/null; then + dnf config-manager --set-enabled "download.rockylinux.org_pub_sig_${DNF_RELEASE_VER}_altarch_${MACHINE_ARCH}_altarch-common" || exit 1 fi -if dnf list installed | grep @epel > /dev/null || dnf list installed | grep epel-release > /dev/null; then +if dnf list installed | grep '@epel' > /dev/null || dnf list installed | grep 'epel-release' > /dev/null; then # 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 - if ! dnf repolist --enabled | grep crb > /dev/null; then + 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 + if ! dnf repolist --enabled | grep 'epel' > /dev/null; then dnf config-manager --set-enabled epel || exit 1 fi fi @@ -30,7 +33,7 @@ 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. -dnf copr enable --assumeyes prathampatel/kernel-tfg "rhel-$(dnf config-manager --dump-variables | grep releasever | awk '{print $3}')-$(uname -m)" +dnf copr enable --assumeyes prathampatel/kernel-tfg "rhel-${DNF_RELEASE_VER}-${MACHINE_ARCH}" 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 @@ -39,7 +42,7 @@ if dnf list installed | grep "kernel-next-tfg\|kernel-rc-tfg" > /dev/null; then # 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. - dnf copr enable --assumeyes prathampatel/kernel-testing-tfg "rhel-$(dnf config-manager --dump-variables | grep releasever | awk '{print $3}')-$(uname -m)" + dnf copr enable --assumeyes prathampatel/kernel-testing-tfg "rhel-${DNF_RELEASE_VER}-${MACHINE_ARCH}" 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