diff -Nru live-build-3.0~a57/debian/changelog live-build-3.0~a57/debian/changelog --- live-build-3.0~a57/debian/changelog 2017-10-02 23:57:51.000000000 +0000 +++ live-build-3.0~a57/debian/changelog 2018-06-26 22:36:32.000000000 +0000 @@ -1,3 +1,10 @@ +live-build (3.0~a57-1ubuntu25.6) xenial; urgency=medium + + * ubuntu-initramfs-handling.patch: Use initramfs-tools to work with initrds, + instead of trying to naively repack and unpack them blindly (LP: #1778811) + + -- Adam Conrad Tue, 26 Jun 2018 16:36:32 -0600 + live-build (3.0~a57-1ubuntu25.5) xenial; urgency=medium [ Balint Reczey ] diff -Nru live-build-3.0~a57/debian/patches/series live-build-3.0~a57/debian/patches/series --- live-build-3.0~a57/debian/patches/series 2017-10-02 23:57:19.000000000 +0000 +++ live-build-3.0~a57/debian/patches/series 2018-06-26 22:36:32.000000000 +0000 @@ -34,3 +34,4 @@ ubuntu-initramfs-compression-symlinks.patch ubuntu-debootstrap-demotions.patch skip-missing-initrd.patch +ubuntu-initramfs-handling.patch diff -Nru live-build-3.0~a57/debian/patches/ubuntu-initramfs-handling.patch live-build-3.0~a57/debian/patches/ubuntu-initramfs-handling.patch --- live-build-3.0~a57/debian/patches/ubuntu-initramfs-handling.patch 1970-01-01 00:00:00.000000000 +0000 +++ live-build-3.0~a57/debian/patches/ubuntu-initramfs-handling.patch 2018-06-26 22:36:32.000000000 +0000 @@ -0,0 +1,75 @@ +Description: Use initramfs-tools to work with initrds instead of being silly. + Note that the lb_binary_disk portion of this is not a backport of the code + in bionic and cosmic, as initramfs-tools there does not have unmkinitramfs, + so we instead just guard against failing if we can't read the initrd. +Author: Adam Conrad +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1778811 +Last-Update: 2018-06-26 + +--- live-build-3.0~a57.orig/scripts/build/lb_binary_disk ++++ live-build-3.0~a57/scripts/build/lb_binary_disk +@@ -100,15 +100,21 @@ case "${LB_INITRAMFS}" in + + case "${LB_INITRAMFS_COMPRESSION}" in + gzip) ++ if zcat -t "../../${INITRD}" >/dev/null 2>&1; then + zcat "../../${INITRD}" | cpio --quiet -id conf/uuid.conf ++ fi + ;; + + bzip2) ++ if bzip2 -t "$archive" >/dev/null 2>&1; then + bzcat "../../${INITRD}" | cpio --quiet -id conf/uuid.conf ++ fi + ;; + + lzma) +- lzcat -S "" "../../${INITRD}" | cpio --quiet -id conf/uuid.conf ++ if lzcat -t "$archive" >/dev/null 2>&1; then ++ lzcat "../../${INITRD}" | cpio --quiet -id conf/uuid.conf ++ fi + ;; + esac + +--- live-build-3.0~a57.orig/scripts/build/lb_chroot_hacks ++++ live-build-3.0~a57/scripts/build/lb_chroot_hacks +@@ -184,34 +184,14 @@ esac + + if [ "${LB_INITRAMFS}" != "none" ] + then ++ if [ -n "${LB_INITRAMFS_COMPRESSION}" ]; then ++ echo "COMPRESS=${LB_INITRAMFS_COMPRESSION}" \ ++ > chroot/etc/initramfs-tools/conf.d/live-build.conf ++ fi + Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u" ++ rm -f chroot//etc/initramfs-tools/conf.d/live-build.conf + fi + +-# We probably ought to use COMPRESS= in a temporary file in +-# /etc/initramfs-tools/conf.d/ instead, but it's hard to pass options that +-# way. +-case "${LB_INITRAMFS_COMPRESSION}" in +- gzip) +- ;; +- +- bzip2) +- for INITRAMFS in $(find chroot/boot -name 'initrd*' -not -type l); do +- zcat "${INITRAMFS}" | bzip2 -c ${BZIP2_OPTIONS} > "${INITRAMFS}.new" +- mv "${INITRAMFS}.new" "${INITRAMFS}" +- done +- ;; +- +- lzma) +- # We probably ought to use COMPRESS= in a temporary file in +- # /etc/initramfs-tools/conf.d/ instead, but it's hard to +- # pass options that way. +- for INITRAMFS in $(find chroot/boot -name 'initrd*' -not -type l); do +- zcat "${INITRAMFS}" | lzma -c ${LZMA_OPTIONS} > "${INITRAMFS}.new" +- mv "${INITRAMFS}.new" "${INITRAMFS}" +- done +- ;; +-esac +- + # Ensure readable permissions on initramfs. loop-aes-utils sets umask to + # protect GPG keys, which live-build does not support. + # Note: Use find rather than chmod on the wildcard, one never knows what