diff --git a/debian/changelog b/debian/changelog index 4a0609e2..d958834d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (2.505) bionic; urgency=medium + + * Move casper from filesystem.squashfs to installer.squashfs. + + -- Michael Hudson-Doyle Fri, 23 Feb 2018 16:54:51 +1300 + livecd-rootfs (2.504) bionic; urgency=medium * Override JobRunningTimeoutSec to 0s on the .device unit that diff --git a/live-build/auto/config b/live-build/auto/config index 8ce877b5..a94fd990 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -116,6 +116,12 @@ if [ -z "${IMAGEFORMAT:-}" ]; then esac fi +skip_lb_stage() { + STAGE="$1" + mkdir -p .build + touch ".build/$STAGE" +} + case $IMAGEFORMAT in ext2|ext3|ext4) OPTS="${OPTS:+$OPTS }--initramfs none --chroot-filesystem $IMAGEFORMAT" @@ -141,7 +147,9 @@ case $IMAGEFORMAT in INITRAMFS_TYPE=none case $PROJECT:${SUBPROJECT:-} in ubuntu-server:live) - add_package live lupin-casper + # Stop lb installing casper into filesystem.squashfs + # by skipping lb_chroot_live-packages. + skip_lb_stage chroot_live-packages INITRAMFS_TYPE=auto ;; *) diff --git a/live-build/functions b/live-build/functions index 04397fdb..239169ad 100644 --- a/live-build/functions +++ b/live-build/functions @@ -329,3 +329,34 @@ undivert_grub() { chroot "$CHROOT_ROOT" dpkg-divert --remove --local \ --rename /usr/bin/systemd-detect-virt } + +recreate_initramfs() { + # Regenerate the initramfs by running update-initramfs in the + # chroot at $1 and copying the generated initramfs + # around. Beware that this was written for a single use case + # (live-server) and may not work in all cases without + # tweaking... + # config/common must be sourced before calling this function. + CHROOT="$1" + # Start by cargo culting bits of lb_chroot_hacks: + if [ -n "$LB_INITRAMFS_COMPRESSION" ]; then + echo "COMPRESS=$LB_INITRAMFS_COMPRESSION" > "$CHROOT"/etc/initramfs-tools/conf.d/livecd-rootfs.conf + fi + chroot "$CHROOT" sh -c "${UPDATE_INITRAMFS_OPTIONS:-} update-initramfs -k all -t -u" + rm -rf "$CHROOT"/etc/initramfs-tools/conf.d/livecd-rootfs.conf + # Then bits of lb_binary_linux-image: + case "${LB_INITRAMFS}" in + casper) + DESTDIR="binary/casper" + ;; + + live-boot) + DESTDIR="binary/live" + ;; + + *) + DESTDIR="binary/boot" + ;; + esac + mv "$CHROOT"/boot/initrd.img-* $DESTDIR +} diff --git a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary index fe970005..a0b77a20 100755 --- a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary +++ b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary @@ -22,6 +22,7 @@ if [ -n "$SUBARCH" ]; then fi . config/functions +. config/common SQUASH_ROOT=binary/boot/squashfs.dir OVERLAY_ROOT=binary/overlay @@ -50,8 +51,10 @@ EOF # Install any requirements for the installer, for things we don't want # to see on the installed system chroot $SQUASH_ROOT apt-get update -chroot $SQUASH_ROOT apt-get -y install user-setup -chroot $SQUASH_ROOT apt-get -y install curtin +chroot $SQUASH_ROOT apt-get -y install user-setup curtin lupin-casper + +# Installing casper means we need a new initramfs +UPDATE_INITRAMFS_OPTIONS=CASPER_GENERATE_UUID=1 recreate_initramfs $SQUASH_ROOT # Don't let cloud-init run in the live session. touch $SQUASH_ROOT/etc/cloud/cloud-init.disabled