livecd-rootfs/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary
Steve Langasek efbd6fd1c6 Import patches-unapplied version 2.454 to ubuntu/artful-proposed
Imported using git-ubuntu import.

Changelog parent: 6e53d32cd86faec5af29d1dd745934197b2cbdba

New changelog entries:
  [ Steve Langasek ]
  * live-build/functions: mount tmpfs on /var/cache/apt and var/lib/apt, so
    we don't have to leave empty space in our derivative images for packages
    that have been downloaded/installed/removed.  This normally isn't
    relevant for the installed system, since the root filesystem will
    auto-expand in place on the target disk, but lets us ship smaller
    images.
  * live-build/functions: also call 'apt-get update' after mounting the
    blank /var/lib/apt.
  * live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary: call apt-get
    update *before* installing packages, not after.
  [ Robert C Jennings ]
  * live-build/ubuntu-cpc/functions: Add a function, teardown_mountpoint,
    to reverse the work done in setup_mountpoint.  Lack of this function
    has forced users of setup_mountpoint to implement this separately
    and the implementations have diverged. (LP: #1716992)
  * live-build/ubuntu-cpc/functions: Remove umount_settle function.
    The was only used where teardown_mountpoint was lacking.
  [ Steve Langasek ]
  * Also adjust live-build/ubuntu-server/hooks/032-installer-squashfs.binary
    to use teardown_mountpoint.
2017-09-13 19:48:39 +00:00

49 lines
1.5 KiB
Bash
Executable File

#!/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
chroot binary/boot/squashfs.dir mkdir /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 )