mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-05-11 02:41:33 +00:00
Imported 2.678
No reason for CPC update specified.
This commit is contained in:
parent
a63c7fd637
commit
d5647bfcf3
11
debian/changelog
vendored
11
debian/changelog
vendored
@ -1,3 +1,14 @@
|
|||||||
|
livecd-rootfs (2.678) groovy; urgency=medium
|
||||||
|
|
||||||
|
[ David Krauser ]
|
||||||
|
* Add mechanism to detect initrdless boot fallback
|
||||||
|
|
||||||
|
[ Dimitri John Ledkov ]
|
||||||
|
* auto/build: use setup|teardown_mountpoint to reduce duplication
|
||||||
|
* functions: provide nss_systemd-less nsswitch.conf in chroots.
|
||||||
|
|
||||||
|
-- Dimitri John Ledkov <xnox@ubuntu.com> Fri, 24 Jul 2020 21:08:07 +0100
|
||||||
|
|
||||||
livecd-rootfs (2.677) groovy; urgency=medium
|
livecd-rootfs (2.677) groovy; urgency=medium
|
||||||
|
|
||||||
* Avoid rbind /sys for chroot snap pre-seeding (cgroups fail to unmount)
|
* Avoid rbind /sys for chroot snap pre-seeding (cgroups fail to unmount)
|
||||||
|
@ -106,33 +106,17 @@ fi
|
|||||||
Setup_cleanup
|
Setup_cleanup
|
||||||
|
|
||||||
preinstall_snaps() {
|
preinstall_snaps() {
|
||||||
lb chroot_resolv install
|
setup_mountpoint chroot
|
||||||
|
|
||||||
snap_prepare chroot
|
snap_prepare chroot
|
||||||
|
|
||||||
for snap in "$@"; do
|
for snap in "$@"; do
|
||||||
SNAP_NO_VALIDATE_SEED=1 snap_preseed chroot "${snap}"
|
SNAP_NO_VALIDATE_SEED=1 snap_preseed chroot "${snap}"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ! -c /dev/mem ]; then
|
|
||||||
mknod -m 660 /dev/mem c 1 1
|
|
||||||
chown root:kmem /dev/mem
|
|
||||||
fi
|
|
||||||
|
|
||||||
mount --rbind /dev chroot/dev
|
|
||||||
mount --bind /sys chroot/sys
|
|
||||||
mount --bind /sys/kernel/security chroot/sys/kernel/security
|
|
||||||
mount --bind /proc chroot/proc
|
|
||||||
# Provide more up to date apparmor features, matching target kernel
|
|
||||||
mount -o bind /usr/share/livecd-rootfs/live-build/apparmor/generic chroot/sys/kernel/security/apparmor/features
|
|
||||||
mount -o bind /usr/share/livecd-rootfs/live-build/seccomp/generic.actions_avail chroot/proc/sys/kernel/seccomp/actions_avail
|
|
||||||
|
|
||||||
snap_validate_seed chroot
|
snap_validate_seed chroot
|
||||||
|
|
||||||
umount --recursive chroot/proc
|
teardown_mountpoint chroot
|
||||||
umount --recursive chroot/sys
|
|
||||||
umount --recursive chroot/dev
|
|
||||||
|
|
||||||
lb chroot_resolv remove
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rm -f binary.success
|
rm -f binary.success
|
||||||
|
@ -107,6 +107,8 @@ setup_mountpoint() {
|
|||||||
mount -t tmpfs none "$mountpoint/var/cache/apt"
|
mount -t tmpfs none "$mountpoint/var/cache/apt"
|
||||||
mv "$mountpoint/etc/resolv.conf" resolv.conf.tmp
|
mv "$mountpoint/etc/resolv.conf" resolv.conf.tmp
|
||||||
cp /etc/resolv.conf "$mountpoint/etc/resolv.conf"
|
cp /etc/resolv.conf "$mountpoint/etc/resolv.conf"
|
||||||
|
mv "$mountpoint/etc/nsswitch.conf" nsswitch.conf.tmp
|
||||||
|
sed 's/systemd//g' nsswitch.conf.tmp > "$mountpoint/etc/nsswitch.conf"
|
||||||
chroot "$mountpoint" apt-get update
|
chroot "$mountpoint" apt-get update
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -124,6 +126,7 @@ teardown_mountpoint() {
|
|||||||
umount $submount
|
umount $submount
|
||||||
done
|
done
|
||||||
mv resolv.conf.tmp "$mountpoint/etc/resolv.conf"
|
mv resolv.conf.tmp "$mountpoint/etc/resolv.conf"
|
||||||
|
mv nsswitch.conf.tmp "$mountpoint/etc/nsswitch.conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_partition() {
|
mount_partition() {
|
||||||
@ -962,6 +965,32 @@ replace_kernel () {
|
|||||||
force_boot_without_initramfs ${mountpoint}
|
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() {
|
force_boot_without_initramfs() {
|
||||||
mountpoint=$1
|
mountpoint=$1
|
||||||
|
|
||||||
|
@ -133,6 +133,7 @@ install_grub() {
|
|||||||
chroot mountpoint dpkg-query -W > binary/boot/filesystem.packages
|
chroot mountpoint dpkg-query -W > binary/boot/filesystem.packages
|
||||||
|
|
||||||
divert_grub mountpoint
|
divert_grub mountpoint
|
||||||
|
track_initramfs_boot_fallback mountpoint
|
||||||
chroot mountpoint update-grub
|
chroot mountpoint update-grub
|
||||||
replace_grub_root_with_label mountpoint
|
replace_grub_root_with_label mountpoint
|
||||||
undivert_grub mountpoint
|
undivert_grub mountpoint
|
||||||
|
@ -119,6 +119,11 @@ if [ "${should_install_grub}" -eq 1 ]; then
|
|||||||
--device-map=/tmp/device.map \
|
--device-map=/tmp/device.map \
|
||||||
${loop_device}
|
${loop_device}
|
||||||
|
|
||||||
|
divert_grub mountpoint
|
||||||
|
track_initramfs_boot_fallback mountpoint
|
||||||
|
chroot mountpoint update-grub
|
||||||
|
undivert_grub mountpoint
|
||||||
|
|
||||||
rm mountpoint/tmp/device.map
|
rm mountpoint/tmp/device.map
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user