Merge branch 'minimal-server-layer-3' into ubuntu/master

impish-sru-lp-1946520
Michael Hudson-Doyle 3 years ago
commit 8fcaf94c3b

8
debian/changelog vendored

@ -1,3 +1,11 @@
livecd-rootfs (2.733) UNRELEASED; urgency=medium
* Add a minimal server layer underneath the full server layer. Continue to
mount the full server layer at /media/filesystem for now to keep
compatibility with current subiquity.
-- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 03 Aug 2021 16:34:57 +1200
livecd-rootfs (2.732) impish; urgency=medium livecd-rootfs (2.732) impish; urgency=medium
[ Michael Hudson-Doyle ] [ Michael Hudson-Doyle ]

@ -169,7 +169,10 @@ Expire-Date: 0
rm -f chroot/etc/localtime chroot/etc/timezone rm -f chroot/etc/localtime chroot/etc/timezone
fi fi
if [ "${SUBPROJECT:-}" = minimized ]; then if [ "${SUBPROJECT:-}" = minimized ] || [ "${PROJECT}" = "ubuntu-server" ]; then
# ubuntu-server has a minimized base layer so needs
# minimizations applied to the chroot
# set up dpkg filters to skip installing docs on minimized system # set up dpkg filters to skip installing docs on minimized system
mkdir -p chroot/etc/dpkg/dpkg.cfg.d mkdir -p chroot/etc/dpkg/dpkg.cfg.d
cat > chroot/etc/dpkg/dpkg.cfg.d/excludes <<EOF cat > chroot/etc/dpkg/dpkg.cfg.d/excludes <<EOF
@ -278,7 +281,7 @@ if dpkg-query --show --showformat='${db:Status-Status}\n' ubuntu-server 2> /dev/
fi fi
EOF EOF
fi fi
if [ "$PROJECT" = "ubuntu-cpc" ]; then if [ "$PROJECT" = "ubuntu-cpc" ] || [ "$PROJECT" = "ubuntu-server" ]; then
cat >> chroot/usr/local/sbin/unminimize <<'EOF' cat >> chroot/usr/local/sbin/unminimize <<'EOF'
echo "Removing lxd installer package..." echo "Removing lxd installer package..."

@ -772,16 +772,19 @@ case $PROJECT in
ubuntu-server) ubuntu-server)
case ${SUBPROJECT:-} in case ${SUBPROJECT:-} in
live) live)
OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal"
PASSES_TO_LAYERS=true PASSES_TO_LAYERS=true
add_task ubuntu-server minimal standard server add_task ubuntu-server-minimal server-minimal
add_package ubuntu-server-minimal lxd-installer
add_task ubuntu-server-minimal.ubuntu-server minimal standard server
# add_task really should do this itself but for now... # add_task really should do this itself but for now...
snap_from_seed server config/package-lists/livecd-rootfs.snaplist.chroot_ubuntu-server.full snap_from_seed server config/package-lists/livecd-rootfs.snaplist.chroot_ubuntu-server-minimal.ubuntu-server.full
add_package ubuntu-server cloud-init add_package ubuntu-server-minimal.ubuntu-server cloud-init
add_package ubuntu-server.installer linux-firmware lupin-casper openssh-server add_package ubuntu-server-minimal.ubuntu-server.installer linux-firmware lupin-casper openssh-server
add_snap ubuntu-server.installer subiquity/classic add_snap ubuntu-server-minimal.ubuntu-server.installer subiquity/classic
if [ $ARCH = s390x ]; then if [ $ARCH = s390x ]; then
add_package ubuntu-server.installer s390-tools-zkey add_package ubuntu-server-minimal.ubuntu-server.installer s390-tools-zkey
fi fi
# Live server ISOs for LTS point releases past .2 offer both # Live server ISOs for LTS point releases past .2 offer both
@ -804,8 +807,8 @@ case $PROJECT in
exit 1 exit 1
fi fi
add_package ubuntu-server.installer.$flavor $kernel_metapkg add_package ubuntu-server-minimal.ubuntu-server.installer.$flavor $kernel_metapkg
LIVE_PASSES="${LIVE_PASSES:+$LIVE_PASSES }ubuntu-server.installer.$flavor" LIVE_PASSES="${LIVE_PASSES:+$LIVE_PASSES }ubuntu-server-minimal.ubuntu-server.installer.$flavor"
done done
;; ;;
*) *)

@ -0,0 +1,20 @@
#!/bin/bash
set -ex
case ${PASS} in
ubuntu-server-minimal.ubuntu-server)
;;
*)
exit 0
;;
esac
# The unminimize script will try to install the lxd snap. We can't
# do that at this stage so just neuter the snap command (the snap
# will get properly seeded by generic machinery).
dpkg-divert --add --divert /usr/bin/snap.REAL --rename /usr/bin/snap
ln -s /bin/true /usr/bin/snap
yes | /usr/local/sbin/unminimize
rm /usr/bin/snap
dpkg-divert --remove --rename /usr/bin/snap

@ -1,7 +1,7 @@
#!/bin/bash -ex #!/bin/bash -ex
# vi: ts=4 noexpandtab # vi: ts=4 noexpandtab
if [ "${PASS}" != "ubuntu-server.installer" ]; then if [ "${PASS}" != "ubuntu-server-minimal.ubuntu-server.installer" ]; then
exit 0 exit 0
fi fi

@ -2,7 +2,7 @@
# vi: ts=4 noexpandtab # vi: ts=4 noexpandtab
case $PASS in case $PASS in
ubuntu-server.installer.*) ubuntu-server-minimal.ubuntu-server.installer.*)
flavor=${PASS##*.} flavor=${PASS##*.}
if [ "$flavor" = "generic" ]; then if [ "$flavor" = "generic" ]; then
kernel_metapkg=linux-generic kernel_metapkg=linux-generic
@ -18,6 +18,14 @@ case $PASS in
;; ;;
esac esac
# Add a script to record which kernel meta-package to use and to set
# up the /media/filesystem mount that subiquity currently depends
# on. It would be cleaner to do this mount in a systemd mount unit but
# that doesn't work because we mask the cdrom mount to avoid strange
# issues with the handover from the initrd to systemd in the live
# session. In any case, subiquity will sooner or later not require
# this mount to be here at all and then we can delete these mount commands.
cat <<EOF > /etc/initramfs-tools/scripts/init-bottom/live-server cat <<EOF > /etc/initramfs-tools/scripts/init-bottom/live-server
#!/bin/sh #!/bin/sh
case \$1 in case \$1 in
@ -25,6 +33,11 @@ prereqs) exit 0;;
esac esac
echo ${kernel_metapkg} > /run/kernel-meta-package echo ${kernel_metapkg} > /run/kernel-meta-package
mkdir -p \${rootmnt}/media/filesystem \${rootmnt}/media/full \${rootmnt}/media/minimal
mount -o ro -t squashfs \${rootmnt}/cdrom/casper/ubuntu-server-minimal.squashfs \${rootmnt}/media/minimal
mount -o ro -t squashfs \${rootmnt}/cdrom/casper/ubuntu-server-minimal.ubuntu-server.squashfs \${rootmnt}/media/full
mount -o ro,lowerdir=\${rootmnt}/media/full:\${rootmnt}/media/minimal -t overlay overlay \${rootmnt}/media/filesystem
EOF EOF
chmod +x /etc/initramfs-tools/scripts/init-bottom/live-server chmod +x /etc/initramfs-tools/scripts/init-bottom/live-server

@ -2,7 +2,7 @@
# vi: ts=4 noexpandtab # vi: ts=4 noexpandtab
case $PASS in case $PASS in
ubuntu-server.installer.*) ubuntu-server-minimal.ubuntu-server.installer.*)
flavor=${PASS##*.} flavor=${PASS##*.}
;; ;;
*) *)

@ -1,5 +0,0 @@
[Mount]
What=/cdrom/casper/ubuntu-server.squashfs
Where=/media/filesystem
Type=squashfs
Options=ro
Loading…
Cancel
Save