From 380df31aac0fba66e1d29ab64c8eca22d0bc54f9 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Fri, 10 Jan 2014 16:22:27 -0500 Subject: [PATCH] Remove old versions of grub2 from the yum cache Before downloading and caching the latest version of grub2, we need to first remove all old versions. Otherwise, the find command that writes the grub2 version to /tmp/grub/install to install during the finalise phase could pick one of the older versions of grub2 in the cache. This will cause the install during the finalise phase to fail since the older version of grub2 will conflict with the newer installed version of grub2-tools. Change-Id: I5b43e359db3ba81ed6283dfb41c7e89629516d38 --- elements/fedora/pre-install.d/15-fedora-remove-grub | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/elements/fedora/pre-install.d/15-fedora-remove-grub b/elements/fedora/pre-install.d/15-fedora-remove-grub index 5541e762..309bb92d 100755 --- a/elements/fedora/pre-install.d/15-fedora-remove-grub +++ b/elements/fedora/pre-install.d/15-fedora-remove-grub @@ -6,12 +6,14 @@ yum remove -y grub2 # Install grub2 dependencies to minimise packages installed during finalise. install-packages grub2-tools gettext os-prober system-logos -# Ensure grub2 rpm is in the yum cache +# Remove all old versions of grub2 from the yum cache and then ensure the +# latest version is in the cache. +basearch=$(cat /etc/yum/vars/basearch) +find /tmp/yum/$basearch -regex ".*/grub2-[0-9].*\.rpm" -exec rm -f {} \; install-packages -d grub2 # Copy grub2 rpm out of mounted yum cache for install during finalise mkdir /tmp/grub -basearch=$(cat /etc/yum/vars/basearch) cp $(find /tmp/yum/$basearch -regex ".*/grub2-[0-9].*\.rpm") /tmp/grub echo "rpm -i /tmp/grub/*.rpm" > /tmp/grub/install