From a60fec8f3c771e2f5098e8413b5539be1b3eda31 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 13 Sep 2012 16:07:22 +0100 Subject: [PATCH] Bail out if trying to run grub-mkconfig during upgrade to 2.00 (e.g. while configuring a kernel image), since the old /etc/grub.d/00_header conffile breaks until such time as grub-common is configured. --- debian/changelog | 3 +++ debian/patches/mkconfig_mid_upgrade.patch | 30 +++++++++++++++++++++++ debian/patches/series | 1 + util/grub-mkconfig.in | 7 ++++++ 4 files changed, 41 insertions(+) create mode 100644 debian/patches/mkconfig_mid_upgrade.patch diff --git a/debian/changelog b/debian/changelog index faeb1bd52..7211a34ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ grub2 (2.00-3) UNRELEASED; urgency=low * Use dh-autoreconf. + * Bail out if trying to run grub-mkconfig during upgrade to 2.00 (e.g. + while configuring a kernel image), since the old /etc/grub.d/00_header + conffile breaks until such time as grub-common is configured. -- Colin Watson Mon, 10 Sep 2012 00:23:08 +0100 diff --git a/debian/patches/mkconfig_mid_upgrade.patch b/debian/patches/mkconfig_mid_upgrade.patch new file mode 100644 index 000000000..49ac497a4 --- /dev/null +++ b/debian/patches/mkconfig_mid_upgrade.patch @@ -0,0 +1,30 @@ +Description: Bail out if trying to run grub-mkconfig during upgrade to 2.00 + Since files in /etc/grub.d/ are conffiles, they are not put in place until + grub-common is configured, meaning that they may be out of sync with the + parts of grub-mkconfig that reside in /usr/. In GRUB 1.99, + /etc/grub.d/00_header contained a reference to ${GRUB_PREFIX}/video.lst. + This and other code from 1.99 breaks with 2.00's grub-mkconfig. Deferring + this to when grub-PLATFORM.postinst eventually runs is safe and avoids this + problem. +Author: Colin Watson +Forwarded: no +Last-Update: 2012-09-13 + +Index: b/util/grub-mkconfig.in +=================================================================== +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -99,6 +99,13 @@ + esac + done + ++if fgrep -qs '${GRUB_PREFIX}/video.lst' "${grub_mkconfig_dir}/00_header"; then ++ echo "GRUB >= 2.00 has been unpacked but not yet configured." >&2 ++ echo "grub-mkconfig will not work until the upgrade is complete." >&2 ++ echo "It should run later as part of configuring the new GRUB packages." >&2 ++ exit 0 ++fi ++ + if [ "x$EUID" = "x" ] ; then + EUID=`id -u` + fi diff --git a/debian/patches/series b/debian/patches/series index fcc80867b..b3699331d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -15,3 +15,4 @@ efi_disk_cache.patch restore_mkdevicemap.patch efi_mmap_size.patch gettext_quiet.patch +mkconfig_mid_upgrade.patch diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index a8dd53444..64ec0dbd1 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -99,6 +99,13 @@ do esac done +if fgrep -qs '${GRUB_PREFIX}/video.lst' "${grub_mkconfig_dir}/00_header"; then + echo "GRUB >= 2.00 has been unpacked but not yet configured." >&2 + echo "grub-mkconfig will not work until the upgrade is complete." >&2 + echo "It should run later as part of configuring the new GRUB packages." >&2 + exit 0 +fi + if [ "x$EUID" = "x" ] ; then EUID=`id -u` fi