From 605b97de97d835a6ffd6271bf0fbae10df93dfbe Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Thu, 7 Jun 2018 14:23:18 -0700 Subject: [PATCH 1/3] ubuntu-cpc: Generate the root image contents once, and use it for both the -root.tar.xz and the .squashfs. --- debian/changelog | 7 +++ .../hooks/031-0-create-root-dir.binary | 25 ++++++++++ .../ubuntu-cpc/hooks/031-1-root-xz.binary | 17 +++++++ .../hooks/031-2-root-squashfs.binary | 29 +++++++++++ .../ubuntu-cpc/hooks/031-root-xz.binary | 29 ----------- .../ubuntu-cpc/hooks/032-root-squashfs.binary | 49 ------------------- 6 files changed, 78 insertions(+), 78 deletions(-) create mode 100755 live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary create mode 100755 live-build/ubuntu-cpc/hooks/031-1-root-xz.binary create mode 100755 live-build/ubuntu-cpc/hooks/031-2-root-squashfs.binary delete mode 100644 live-build/ubuntu-cpc/hooks/031-root-xz.binary delete mode 100755 live-build/ubuntu-cpc/hooks/032-root-squashfs.binary diff --git a/debian/changelog b/debian/changelog index 6d216eaf..37b848f4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +livecd-rootfs (2.532) cosmic; urgency=medium + + * ubuntu-cpc: Generate the root image contents once, and use it for both the + -root.tar.xz and the .squashfs. + + -- Daniel Watkins Thu, 07 Jun 2018 11:11:02 -0700 + livecd-rootfs (2.531) cosmic; urgency=medium [ Daniel Watkins ] diff --git a/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary b/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary new file mode 100755 index 00000000..786548cc --- /dev/null +++ b/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary @@ -0,0 +1,25 @@ +#!/bin/bash -ex +# vi: ts=4 expandtab +# +# Generate the root directory/manifest for rootfs.tar.xz and squashfs + +if [ -n "$SUBARCH" ]; then + echo "Skipping rootfs build for subarch flavor build" + exit 0 +fi + +. config/functions + +rootfs_dir=rootfs.dir +mkdir $rootfs_dir +cp -a chroot/* $rootfs_dir + +setup_mountpoint $rootfs_dir + +env DEBIAN_FRONTEND=noninteractive chroot $rootfs_dir apt-get --purge remove --assume-yes '^linux-.*' 'linux-base+' +env DEBIAN_FRONTEND=noninteractive chroot $rootfs_dir apt-get --purge remove --assume-yes '^grub-.*' +env DEBIAN_FRONTEND=noninteractive chroot $rootfs_dir apt-get autoremove --purge --assume-yes + +teardown_mountpoint $rootfs_dir + +dpkg-query --admindir=$rootfs_dir/var/lib/dpkg -W > $rootfs_dir.manifest diff --git a/live-build/ubuntu-cpc/hooks/031-1-root-xz.binary b/live-build/ubuntu-cpc/hooks/031-1-root-xz.binary new file mode 100755 index 00000000..8752f048 --- /dev/null +++ b/live-build/ubuntu-cpc/hooks/031-1-root-xz.binary @@ -0,0 +1,17 @@ +#!/bin/bash -ex +# vi: ts=4 expandtab +# +# Generate the rootfs.tar.xz and manifest + +if [ -n "$SUBARCH" ]; then + echo "Skipping rootfs build for subarch flavor build" + exit 0 +fi + +. config/functions + +# This is the directory created by 031-0-create-root-dir.binary +rootfs_dir=rootfs.dir + +cp $rootfs_dir.manifest livecd.ubuntu-cpc.rootfs.manifest +(cd "$rootfs_dir/" && tar -c *) | xz > "livecd.ubuntu-cpc.rootfs.tar.xz" diff --git a/live-build/ubuntu-cpc/hooks/031-2-root-squashfs.binary b/live-build/ubuntu-cpc/hooks/031-2-root-squashfs.binary new file mode 100755 index 00000000..5d2b0901 --- /dev/null +++ b/live-build/ubuntu-cpc/hooks/031-2-root-squashfs.binary @@ -0,0 +1,29 @@ +#!/bin/bash -ex +# vi: ts=4 noexpandtab +# +# Generate a squashfs root and manifest + +case $IMAGE_TARGETS in + ""|*squashfs*) + ;; + *) + echo "Skipping squashfs build" + exit 0 + ;; +esac + +if [ -n "$SUBARCH" ]; then + echo "Skipping rootfs build for subarch flavor build" + exit 0 +fi + +# This is the directory created by 031-0-create-root-dir.binary +rootfs_dir=rootfs.dir + +squashfs_f="${PWD}/livecd.ubuntu-cpc.squashfs" + +cp $rootfs_dir.manifest "${squashfs_f}.manifest" + +(cd "$rootfs_dir" && + mksquashfs . ${squashfs_f} \ + -no-progress -xattrs -comp xz ) diff --git a/live-build/ubuntu-cpc/hooks/031-root-xz.binary b/live-build/ubuntu-cpc/hooks/031-root-xz.binary deleted file mode 100644 index 62881cd8..00000000 --- a/live-build/ubuntu-cpc/hooks/031-root-xz.binary +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -ex -# vi: ts=4 expandtab -# -# Generate the rootfs.tar.xz and manifest - -if [ -n "$SUBARCH" ]; then - echo "Skipping rootfs build for subarch flavor build" - exit 0 -fi - -. config/functions - -tardir=filesystem.dir -mkdir $tardir -cp -a chroot/* $tardir - -setup_mountpoint $tardir - -env DEBIAN_FRONTEND=noninteractive chroot $tardir apt-get --purge remove --assume-yes '^linux-.*' 'linux-base+' -env DEBIAN_FRONTEND=noninteractive chroot $tardir apt-get --purge remove --assume-yes '^grub-.*' -env DEBIAN_FRONTEND=noninteractive chroot $tardir apt-get autoremove --purge --assume-yes - -teardown_mountpoint $tardir - -dpkg-query --admindir=$tardir/var/lib/dpkg -W > livecd.ubuntu-cpc.rootfs.manifest - -(cd "$tardir/" && tar -c *) | xz > "livecd.ubuntu-cpc.rootfs.tar.xz" - -rm -rf $tardir diff --git a/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary b/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary deleted file mode 100755 index ec6c1b05..00000000 --- a/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -ex -# vi: ts=4 noexpandtab -# -# Generate a squashfs root and manifest - -case $IMAGE_TARGETS in - ""|*squashfs*) - ;; - *) - echo "Skipping squashfs build" - exit 0 - ;; -esac - -if [ -n "$SUBARCH" ]; then - echo "Skipping rootfs build for subarch flavor build" - exit 0 -fi - -. config/functions - -mkdir binary/boot/squashfs.dir -cp -a chroot/* binary/boot/squashfs.dir - -setup_mountpoint binary/boot/squashfs.dir - -chroot binary/boot/squashfs.dir dpkg-divert --local --rename /usr/sbin/grub-probe -chroot binary/boot/squashfs.dir touch /usr/sbin/grub-probe -chroot binary/boot/squashfs.dir chmod +x /usr/sbin/grub-probe - -env DEBIAN_FRONTEND=noninteractive chroot binary/boot/squashfs.dir apt-get --purge remove --assume-yes '^linux-.*' 'linux-base+' -env DEBIAN_FRONTEND=noninteractive chroot binary/boot/squashfs.dir apt-get --purge remove --assume-yes '^grub-.*' -env DEBIAN_FRONTEND=noninteractive chroot binary/boot/squashfs.dir apt-get autoremove --purge --assume-yes -rm -rf binary/boot/squashfs.dir/boot/grub -chroot binary/boot/squashfs.dir mkdir -p /lib/modules - -chroot binary/boot/squashfs.dir rm /usr/sbin/grub-probe -chroot binary/boot/squashfs.dir dpkg-divert --remove --local --rename /usr/sbin/grub-probe - -teardown_mountpoint binary/boot/squashfs.dir - -squashfs_f="${PWD}/livecd.ubuntu-cpc.squashfs" -squashfs_f_manifest="${squashfs_f}.manifest" - -dpkg-query --admindir=binary/boot/squashfs.dir/var/lib/dpkg -W > ${squashfs_f_manifest} - -(cd "binary/boot/squashfs.dir/" && - mksquashfs . ${squashfs_f} \ - -no-progress -xattrs -comp xz ) From ab85167fb51443dba269a78b1bcd835a14b17c96 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Thu, 7 Jun 2018 16:24:29 -0700 Subject: [PATCH 2/3] Shell formatting cleanup --- live-build/ubuntu-cpc/hooks/031-1-root-xz.binary | 4 +--- live-build/ubuntu-cpc/hooks/031-2-root-squashfs.binary | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/live-build/ubuntu-cpc/hooks/031-1-root-xz.binary b/live-build/ubuntu-cpc/hooks/031-1-root-xz.binary index 8752f048..fab8a834 100755 --- a/live-build/ubuntu-cpc/hooks/031-1-root-xz.binary +++ b/live-build/ubuntu-cpc/hooks/031-1-root-xz.binary @@ -8,10 +8,8 @@ if [ -n "$SUBARCH" ]; then exit 0 fi -. config/functions - # This is the directory created by 031-0-create-root-dir.binary rootfs_dir=rootfs.dir cp $rootfs_dir.manifest livecd.ubuntu-cpc.rootfs.manifest -(cd "$rootfs_dir/" && tar -c *) | xz > "livecd.ubuntu-cpc.rootfs.tar.xz" +(cd $rootfs_dir/ && tar -c *) | xz > livecd.ubuntu-cpc.rootfs.tar.xz diff --git a/live-build/ubuntu-cpc/hooks/031-2-root-squashfs.binary b/live-build/ubuntu-cpc/hooks/031-2-root-squashfs.binary index 5d2b0901..f4c2ac3d 100755 --- a/live-build/ubuntu-cpc/hooks/031-2-root-squashfs.binary +++ b/live-build/ubuntu-cpc/hooks/031-2-root-squashfs.binary @@ -20,10 +20,10 @@ fi # This is the directory created by 031-0-create-root-dir.binary rootfs_dir=rootfs.dir -squashfs_f="${PWD}/livecd.ubuntu-cpc.squashfs" +squashfs_f="$PWD/livecd.ubuntu-cpc.squashfs" -cp $rootfs_dir.manifest "${squashfs_f}.manifest" +cp $rootfs_dir.manifest $squashfs_f.manifest -(cd "$rootfs_dir" && - mksquashfs . ${squashfs_f} \ +(cd $rootfs_dir && + mksquashfs . $squashfs_f \ -no-progress -xattrs -comp xz ) From f9cae3ff7fd6a77147f4faa68e474e9b35c0cbb6 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Thu, 7 Jun 2018 16:24:59 -0700 Subject: [PATCH 3/3] Restore removal of /boot/grub from rootfs artifacts --- live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary | 1 + 1 file changed, 1 insertion(+) diff --git a/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary b/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary index 786548cc..9a916658 100755 --- a/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary +++ b/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary @@ -19,6 +19,7 @@ setup_mountpoint $rootfs_dir env DEBIAN_FRONTEND=noninteractive chroot $rootfs_dir apt-get --purge remove --assume-yes '^linux-.*' 'linux-base+' env DEBIAN_FRONTEND=noninteractive chroot $rootfs_dir apt-get --purge remove --assume-yes '^grub-.*' env DEBIAN_FRONTEND=noninteractive chroot $rootfs_dir apt-get autoremove --purge --assume-yes +rm -rf $rootfs_dir/boot/grub teardown_mountpoint $rootfs_dir