mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-02-23 03:11:12 +00:00
Merge feature/initrdless-detection into ubuntu/master [a=davidkrauser] [r=rcj]
MP: https://code.launchpad.net/~davidkrauser/livecd-rootfs/+git/livecd-rootfs/+merge/387862
This commit is contained in:
commit
9c52eaef60
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
||||
livecd-rootfs (2.678) UNRELEASED; urgency=medium
|
||||
|
||||
* Add mechanism to detect initrdless boot fallback
|
||||
|
||||
-- David Krauser <david.krauser@canonical.com> Wed, 22 Jul 2020 14:43:09 -0400
|
||||
|
||||
livecd-rootfs (2.677) groovy; urgency=medium
|
||||
|
||||
* Avoid rbind /sys for chroot snap pre-seeding (cgroups fail to unmount)
|
||||
|
@ -962,6 +962,32 @@ replace_kernel () {
|
||||
force_boot_without_initramfs ${mountpoint}
|
||||
}
|
||||
|
||||
track_initramfs_boot_fallback() {
|
||||
mountpoint=$1
|
||||
cat <<END > "${mountpoint}/etc/grub.d/01_track_initrdless_boot_fallback"
|
||||
#! /bin/sh
|
||||
# ${IMAGE_STR}
|
||||
# This will detect if we attempt to boot with an initramfs and fail.
|
||||
# In the case of a failure, initrdless_boot_fallback_triggered is set to
|
||||
# a non-zero value in the grubenv. This value can be checked after boot
|
||||
# by looking in /boot/grub/grubenv or by using the grub-editenv list command.
|
||||
set -e
|
||||
END
|
||||
cat <<"END" >> "${mountpoint}/etc/grub.d/01_track_initrdless_boot_fallback"
|
||||
cat <<"EOF"
|
||||
if [ -n "${have_grubenv}" ]; then
|
||||
if [ -n "${initrdfail}" ]; then
|
||||
set initrdless_boot_fallback_triggered="${initrdfail}"
|
||||
else
|
||||
set initrdless_boot_fallback_triggered=0
|
||||
fi
|
||||
save_env initrdless_boot_fallback_triggered
|
||||
fi
|
||||
EOF
|
||||
END
|
||||
chmod +x "${mountpoint}/etc/grub.d/01_track_initrdless_boot_fallback"
|
||||
}
|
||||
|
||||
force_boot_without_initramfs() {
|
||||
mountpoint=$1
|
||||
|
||||
|
@ -133,6 +133,7 @@ install_grub() {
|
||||
chroot mountpoint dpkg-query -W > binary/boot/filesystem.packages
|
||||
|
||||
divert_grub mountpoint
|
||||
track_initramfs_boot_fallback mountpoint
|
||||
chroot mountpoint update-grub
|
||||
replace_grub_root_with_label mountpoint
|
||||
undivert_grub mountpoint
|
||||
|
@ -119,6 +119,11 @@ if [ "${should_install_grub}" -eq 1 ]; then
|
||||
--device-map=/tmp/device.map \
|
||||
${loop_device}
|
||||
|
||||
divert_grub mountpoint
|
||||
track_initramfs_boot_fallback mountpoint
|
||||
chroot mountpoint update-grub
|
||||
undivert_grub mountpoint
|
||||
|
||||
rm mountpoint/tmp/device.map
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user