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
This commit is contained in:
James Slagle 2014-01-10 16:22:27 -05:00
parent 843214246c
commit 380df31aac

View File

@ -6,12 +6,14 @@ yum remove -y grub2
# Install grub2 dependencies to minimise packages installed during finalise. # Install grub2 dependencies to minimise packages installed during finalise.
install-packages grub2-tools gettext os-prober system-logos 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 install-packages -d grub2
# Copy grub2 rpm out of mounted yum cache for install during finalise # Copy grub2 rpm out of mounted yum cache for install during finalise
mkdir /tmp/grub mkdir /tmp/grub
basearch=$(cat /etc/yum/vars/basearch)
cp $(find /tmp/yum/$basearch -regex ".*/grub2-[0-9].*\.rpm") /tmp/grub cp $(find /tmp/yum/$basearch -regex ".*/grub2-[0-9].*\.rpm") /tmp/grub
echo "rpm -i /tmp/grub/*.rpm" > /tmp/grub/install echo "rpm -i /tmp/grub/*.rpm" > /tmp/grub/install