From 38bb0b33013002257d93eaab06bd831d792bc48a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lallement Date: Mon, 18 Mar 2019 09:33:07 +0100 Subject: [PATCH] Fix grub divert for multilayer images grub-probe must not be called during image build so grub is diverted. In multilayer image the chroot is always the tip of the filesystem, so we divert grub at the beginning of each pass and undivdert it as the end. For flat images, it's diverted just before building the chroot and undiverted after. --- live-build/auto/build | 4 ++-- live-build/lb_chroot_layered | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 3a964636..8f4cf05d 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -261,14 +261,14 @@ EOF chmod +x chroot/usr/bin/man fi - divert_grub chroot if [ -n "${PASSES}" ]; then PATH="config/:$PATH" lb chroot_layered "$@" else + divert_grub chroot divert_update_initramfs lb chroot "$@" + undivert_grub chroot fi - undivert_grub chroot # Let all configuration non multi-layered project here. # If those are moving to a multi-layer layout, this needs to be diff --git a/live-build/lb_chroot_layered b/live-build/lb_chroot_layered index 3a3d50c0..113c7e30 100755 --- a/live-build/lb_chroot_layered +++ b/live-build/lb_chroot_layered @@ -175,6 +175,10 @@ create_chroot_pass () { lb chroot_devpts install ${*} lb chroot_proc install ${*} lb chroot_sysfs install ${*} + + # grub-probe should not be called as part of an image build so divert it + divert_grub chroot + # We run chroot_hacks only on root layers (update-initramfs diverted) if $(is_root_layer $pass); then divert_update_initramfs @@ -245,6 +249,9 @@ create_chroot_pass () { Chroot chroot "dpkg-query -W" > chroot.packages.${pass} + # Restore grub + undivert_grub chroot + # Deconfiguring chroot if $(is_root_layer $pass); then lb chroot_archives chroot remove ${*}