[Merge] ~davidkrauser/livecd-rootfs/+git/livecd-rootfs:bootable-buildd into livecd-rootfs:ubuntu/master

Pat Viafore patrick.viafore at canonical.com
Thu Nov 7 18:18:32 UTC 2019



Diff comments:

> diff --git a/live-build/buildd/hooks/52-linux-virtual-image.binary b/live-build/buildd/hooks/52-linux-virtual-image.binary
> new file mode 100755
> index 0000000..8c4f883
> --- /dev/null
> +++ b/live-build/buildd/hooks/52-linux-virtual-image.binary
> @@ -0,0 +1,61 @@
> +#!/bin/bash -eux
> +# vi: ts=4 expandtab
> +#
> +# Generate linux-virtual image
> +#
> +
> +echo "Building bootable Buildd image"
> +
> +IMAGE_STR="# BUILDD_IMG: This file was created/modified by the Buildd Image build process"
> +
> +. config/functions
> +
> +mount_d=$(mktemp -d)
> +
> +create_derivative uefi linux-virtual #sets $derivative_img
> +mount_disk_image $derivative_img $mount_d
> +
> +# unmount disk image and remove created folders on exit
> +# even though we unmount manually before we convert to
> +# qcow2, we have this here just in case we error out before
> +# that step
> +cleanup_linux_virtual() {
> +    if [ -d "$mount_d" ]; then
> +        umount_disk_image "$mount_d"
> +    fi
> +    rm -rf $mount_d $derivative_img
> +}
> +trap cleanup_linux_virtual EXIT
> +
> +# Install dependencies
> +env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \
> +    update --assume-yes
> +env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \
> +    install -y lsb-release locales initramfs-tools busybox-initramfs \
> +               udev dbus netplan.io cloud-init openssh-server sudo snapd
> +
> +# Replace kernel
> +divert_grub "$mount_d"

Can you use replace_kernel here?

> +env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \
> +    install --assume-yes linux-image-virtual
> +env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \
> +    autoremove --purge --assume-yes
> +chroot "$mount_d" update-grub
> +undivert_grub "$mount_d"
> +
> +# Update initramfs image
> +chroot "$mount_d" \
> +    sh -c 'update-initramfs -c -v -k $(ls /boot/vmlinuz*generic | sed 1q | cut -d- -f2-3)'
> +
> +# Cleanup
> +env DEBIAN_FRONTEND=noninteractive chroot "$mount_d" apt-get \
> +    clean
> +
> +create_manifest $mount_d "livecd.$PROJECT.disk-linux-virtual.manifest"
> +
> +# unmount disk image to prevent corruption
> +# and remove it so the trap doesn't try to unmount it again
> +umount_disk_image $mount_d
> +rm -rf $mount_d
> +
> +convert_to_qcow2 $derivative_img "livecd.$PROJECT.disk-linux-virtual.img"


-- 
https://code.launchpad.net/~davidkrauser/livecd-rootfs/+git/livecd-rootfs/+merge/373916
Your team Ubuntu Core Development Team is requested to review the proposed merge of ~davidkrauser/livecd-rootfs/+git/livecd-rootfs:bootable-buildd into livecd-rootfs:ubuntu/master.



More information about the Ubuntu-reviews mailing list