|
|
|
#!/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" && "$SUBARCH" != "intel-iot" ]; then
|
|
|
|
echo "Skipping rootfs build for subarch flavor build"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
. config/binary
|
|
|
|
. config/functions
|
|
|
|
. config/common
|
|
|
|
|
|
|
|
FILESYSTEM_ROOT=binary/boot/squashfs.dir
|
|
|
|
INSTALLER_ROOT=binary/boot/installer.squashfs.dir
|
|
|
|
OVERLAY_ROOT=binary/overlay
|
|
|
|
|
|
|
|
PROJECT=$PROJECT${SUBARCH:+-$SUBARCH}
|
|
|
|
|
|
|
|
mkdir -p "$INSTALLER_ROOT" "$OVERLAY_ROOT"
|
|
|
|
|
|
|
|
# Create an installer squashfs layer
|
|
|
|
mount_overlay "$FILESYSTEM_ROOT/" "$OVERLAY_ROOT/" "$INSTALLER_ROOT/"
|
|
|
|
|
|
|
|
setup_mountpoint "$INSTALLER_ROOT"
|
|
|
|
|
|
|
|
# Override JobRunningTimeoutSec to 0s on the .device unit that
|
|
|
|
# subiquity_config.mount depends on to avoid a 5s delay on switching
|
|
|
|
# to a new VT when there is no device there (LP: #1750117).
|
|
|
|
# It would be better to have this in ../includes.binary/overlay but
|
|
|
|
# you can't have backslashes in filenames in bzr branches!
|
|
|
|
ANSWERS_DEVICE_UNIT='dev-disk-by\x2duuid-00c629d6\x2d06ab\x2d4dfd\x2db21e\x2dc3186f34105d.device'
|
|
|
|
mkdir -p "$INSTALLER_ROOT/etc/systemd/system/$ANSWERS_DEVICE_UNIT.d"
|
|
|
|
cat > "$INSTALLER_ROOT/etc/systemd/system/$ANSWERS_DEVICE_UNIT.d/override.conf" <<EOF
|
|
|
|
[Unit]
|
|
|
|
JobRunningTimeoutSec=0s
|
|
|
|
Wants=subiquity_config.mount
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Prepare installer layer.
|
|
|
|
|
|
|
|
# Install:
|
|
|
|
# 1. linux-firmware for kernel to upload into hardware.
|
|
|
|
# 2. casper for live session magic.
|
|
|
|
# 3. openssh-server to enable the "ssh into live session" feature
|
|
|
|
chroot $INSTALLER_ROOT apt-get -y install linux-firmware lupin-casper openssh-server
|
|
|
|
|
|
|
|
# Make sure NoCloud is last
|
|
|
|
values=$(echo get cloud-init/datasources | chroot $INSTALLER_ROOT debconf-communicate | sed 's/^0 //;s/NoCloud, //;s/None/NoCloud, None/')
|
|
|
|
printf "%s\t%s\t%s\t%s\n" \
|
|
|
|
cloud-init cloud-init/datasources multiselect "$values" |
|
|
|
|
chroot $INSTALLER_ROOT debconf-set-selections
|
|
|
|
chroot $INSTALLER_ROOT dpkg-reconfigure --frontend=noninteractive cloud-init
|
|
|
|
|
|
|
|
if [ `dpkg --print-architecture` = s390x ]; then
|
|
|
|
chroot $INSTALLER_ROOT apt-get -y install s390-tools-zkey
|
|
|
|
# because z/VM x3270 is just ttyS0
|
|
|
|
cp -r $INSTALLER_ROOT/usr/lib/systemd/system/serial-getty@sclp_line0.service.d $INSTALLER_ROOT/usr/lib/systemd/system/serial-getty@ttyS0.service.d
|
|
|
|
fi
|
|
|
|
chroot $INSTALLER_ROOT apt-get clean
|
|
|
|
|
|
|
|
# For bug #1743643 "Install to dirty disk with swap fails" remove the
|
|
|
|
# "helpful" casper script that mounts any swap partitions it finds.
|
|
|
|
rm -f $INSTALLER_ROOT/usr/share/initramfs-tools/scripts/casper-bottom/*swap
|
|
|
|
|
|
|
|
# Preseed subiquity into installer layer
|
|
|
|
snap_prepare $INSTALLER_ROOT
|
|
|
|
snap_preseed $INSTALLER_ROOT subiquity/classic
|
|
|
|
# Drop lxd from the installer layer preseed
|
|
|
|
sed -i -e'N;/name: lxd/,+2d' $INSTALLER_ROOT/var/lib/snapd/seed/seed.yaml
|
|
|
|
|
|
|
|
teardown_mountpoint "$INSTALLER_ROOT"
|
|
|
|
|
|
|
|
# Drop snaps that got copied up from base layer, due to snap-preseed
|
|
|
|
# tool doing --reset & speedup
|
|
|
|
for snap in $(cd $OVERLAY_ROOT; find var/lib/snapd/ -name '*.snap'); do
|
|
|
|
if [ -f $FILESYSTEM_ROOT/$snap ]; then
|
|
|
|
rm $OVERLAY_ROOT/$snap;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
squashfs_f="${PWD}/livecd.${PROJECT}.installer.squashfs"
|
|
|
|
|
|
|
|
(cd "$OVERLAY_ROOT/" &&
|
|
|
|
mksquashfs . ${squashfs_f} \
|
|
|
|
-no-progress -xattrs -comp xz )
|