2014-02-18 22:14:43 +00:00
|
|
|
#!/bin/bash
|
2015-02-24 18:49:47 +00:00
|
|
|
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
2014-09-04 04:56:29 +00:00
|
|
|
set -x
|
|
|
|
fi
|
2014-04-03 02:24:15 +00:00
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
2014-02-18 22:14:43 +00:00
|
|
|
|
2015-05-29 00:24:15 +00:00
|
|
|
# grub2 isn't available on rhel6/centos6; they are setup to use
|
|
|
|
# extlinux. skip this
|
|
|
|
# you would think we could match on $DISTRO or something else; but
|
|
|
|
# we can't because the rhel/centos elements are a bit mixed up;
|
|
|
|
# centos-minimal for example sets distro to "centos". so the best
|
|
|
|
# check is just for the original "grub-install" script
|
|
|
|
if [ -f /sbin/grub-install ]; then
|
2015-02-24 18:49:47 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
2014-02-18 22:14:43 +00:00
|
|
|
|
2015-08-10 12:17:04 +00:00
|
|
|
# remove grub2 package. As described in
|
|
|
|
# elements/ubuntu/pre-install.d/00-remove-grub; the grub post-kernel
|
|
|
|
# install hook will barf if the block device can't be found (as
|
|
|
|
# happens in a chroot).
|
|
|
|
#
|
|
|
|
# XXX : it is not clear this is necessary for fedora/centos7 and it's
|
|
|
|
# install hooks. Investigation is required.
|
|
|
|
if rpm -q grub2; then
|
2016-09-23 12:09:02 +00:00
|
|
|
install-packages -e grub-pc
|
2015-08-10 12:17:04 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# now configure things to re-install grub at the end. We don't want
|
|
|
|
# to rely on vm/finalise.d/51-bootloader to simply reinstall the
|
|
|
|
# package via the package-manager, because at that point (during
|
|
|
|
# finalise) the build-time yum-cache has been unmounted (hence the
|
|
|
|
# local-cache looks empty) and yum may try to repopulate the
|
|
|
|
# local-cache with all the grub2 dependencies. This is slow, and
|
|
|
|
# potentially fills up the disk.
|
|
|
|
#
|
|
|
|
# XXX : At this point, keepcache=0 *should* probably be set for
|
|
|
|
# yum/dnf. We have not standarised/documented that this will be done,
|
|
|
|
# however. This would *probably* stop dependencies being populated
|
|
|
|
# into the cache. We could investigate this, and possibly remove this
|
|
|
|
# all together if we standardise some of these behaviours.
|
|
|
|
|
|
|
|
# So we download the latest grub2 package and setup the install script
|
|
|
|
# to just install the single-package, which will be called later by
|
|
|
|
# vm/finalise.d/51-bootloader
|
2016-09-23 12:09:02 +00:00
|
|
|
install-packages -d /tmp/grub grub-pc
|
2014-02-18 22:14:43 +00:00
|
|
|
echo "rpm -i /tmp/grub/*.rpm" > /tmp/grub/install
|