Undivert update-initramfs more carefully

Previously the wrapper script and diversion were left in place on images
such as buildd images that don't have initramfs-tools installed.

LP: #1841573
amd64-kernel-on-i386
Colin Watson 5 years ago
parent ce58687eed
commit 9a65a4013d

8
debian/changelog vendored

@ -1,3 +1,11 @@
livecd-rootfs (2.606) UNRELEASED; urgency=medium
* Undivert update-initramfs more carefully: previously the wrapper script
and diversion were left in place on images such as buildd images that
don't have initramfs-tools installed (LP: #1841573).
-- Colin Watson <cjwatson@ubuntu.com> Tue, 27 Aug 2019 12:43:55 +0100
livecd-rootfs (2.605) eoan; urgency=medium livecd-rootfs (2.605) eoan; urgency=medium
[ David Krauser ] [ David Krauser ]

@ -284,6 +284,7 @@ EOF
divert_grub chroot divert_grub chroot
divert_update_initramfs divert_update_initramfs
lb chroot "$@" lb chroot "$@"
undivert_update_initramfs
undivert_grub chroot undivert_grub chroot
fi fi

@ -875,13 +875,12 @@ echo "update-initramfs: diverted by livecd-rootfs (will be called later)" >&2
exit 0 exit 0
EOF EOF
chmod +x chroot/usr/sbin/update-initramfs chmod +x chroot/usr/sbin/update-initramfs
}
cat > config/hooks/999-undivert-update-initramfs.chroot <<'EOF' undivert_update_initramfs () {
#! /bin/sh rm -f chroot/usr/sbin/update-initramfs
[ ! -f /usr/sbin/update-initramfs.REAL ] && exit 0 Chroot chroot "dpkg-divert --quiet --remove --rename \
rm -f /usr/sbin/update-initramfs /usr/sbin/update-initramfs"
dpkg-divert --quiet --remove --rename /usr/sbin/update-initramfs
EOF
} }
is_root_layer () { is_root_layer () {

@ -261,6 +261,11 @@ create_chroot_pass () {
lb chroot_dpkg remove ${*} lb chroot_dpkg remove ${*}
lb chroot_debianchroot remove ${*} lb chroot_debianchroot remove ${*}
# Restore update-initramfs, if necessary
if $(is_root_layer $pass); then
undivert_update_initramfs
fi
# Restore grub # Restore grub
undivert_grub chroot undivert_grub chroot

Loading…
Cancel
Save