2017-03-20 20:57:45 -04:00
|
|
|
#!/bin/bash -ex
|
|
|
|
# vi: ts=4 noexpandtab
|
|
|
|
#
|
|
|
|
# Generate a squashfs root and manifest
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
echo "032-installer-squashfs.binary"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-04-11 17:16:35 -04:00
|
|
|
. config/functions
|
2017-03-20 20:57:45 -04:00
|
|
|
|
|
|
|
SQUASH_ROOT=binary/boot/squashfs.dir
|
2017-09-19 19:18:09 +12:00
|
|
|
OVERLAY_ROOT=binary/overlay
|
2017-03-20 20:57:45 -04:00
|
|
|
|
2017-03-27 20:55:58 -04:00
|
|
|
mkdir -p "$OVERLAY_ROOT"
|
2017-03-20 20:57:45 -04:00
|
|
|
|
|
|
|
# Create an installer squashfs layer
|
|
|
|
mount_overlay "$SQUASH_ROOT/" "$OVERLAY_ROOT/" "$SQUASH_ROOT/"
|
|
|
|
|
2017-09-13 12:03:34 -07:00
|
|
|
setup_mountpoint binary/boot/squashfs.dir
|
|
|
|
|
2017-03-20 20:57:45 -04:00
|
|
|
# Prepare installer layer.
|
|
|
|
|
|
|
|
# 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
|
2017-03-21 18:22:58 -04:00
|
|
|
chroot $SQUASH_ROOT apt-get -y install curtin
|
2017-03-20 20:57:45 -04:00
|
|
|
|
2017-04-05 13:35:38 -04:00
|
|
|
# Don't let cloud-init run in the live session.
|
|
|
|
touch $SQUASH_ROOT/etc/cloud/cloud-init.disabled
|
|
|
|
|
2017-03-20 20:57:45 -04:00
|
|
|
# Do the snap seeding dance.
|
|
|
|
chroot $SQUASH_ROOT mkdir -p /var/lib/snapd/seed/snaps /var/lib/snapd/seed/assertions
|
|
|
|
chroot $SQUASH_ROOT sh -c '
|
|
|
|
set -x;
|
|
|
|
cd /var/lib/snapd/seed;
|
|
|
|
sudo SNAPPY_STORE_NO_CDN=1 snap download core;
|
2017-10-15 13:44:54 -07:00
|
|
|
sudo SNAPPY_STORE_NO_CDN=1 snap download subiquity;
|
2017-03-20 20:57:45 -04:00
|
|
|
|
|
|
|
CORE_SNAP=$(ls -1 core*.snap);
|
|
|
|
SUBIQUITY_SNAP=$(ls -1 subiquity*.snap);
|
|
|
|
|
|
|
|
mv *.assert /var/lib/snapd/seed/assertions/;
|
|
|
|
mv *.snap /var/lib/snapd/seed/snaps/;
|
|
|
|
|
|
|
|
cat <<EOF > /var/lib/snapd/seed/seed.yaml
|
|
|
|
snaps:
|
|
|
|
- name: core
|
|
|
|
channel: stable
|
|
|
|
file: ${CORE_SNAP}
|
|
|
|
- name: subiquity
|
2017-10-18 13:23:45 +13:00
|
|
|
channel: stable
|
2017-03-20 20:57:45 -04:00
|
|
|
classic: true
|
|
|
|
file: ${SUBIQUITY_SNAP}
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
2017-09-13 12:03:34 -07:00
|
|
|
teardown_mountpoint "$SQUASH_ROOT"
|
2017-03-20 20:57:45 -04:00
|
|
|
|
2017-09-13 12:03:34 -07:00
|
|
|
# Then unmount the overlay
|
2017-03-20 20:57:45 -04:00
|
|
|
umount "$SQUASH_ROOT"
|
|
|
|
|
2017-04-06 14:04:29 -04:00
|
|
|
squashfs_f="${PWD}/livecd.${PROJECT}.installer.squashfs"
|
2017-03-20 20:57:45 -04:00
|
|
|
|
|
|
|
(cd "$OVERLAY_ROOT/" &&
|
|
|
|
mksquashfs . ${squashfs_f} \
|
|
|
|
-no-progress -xattrs -comp xz )
|