From 59fe9b1550273de750636957956654fb898077cc Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Fri, 29 Sep 2017 15:16:25 -0400 Subject: [PATCH 1/7] Bump needed live-build version which can build images without initrd --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index d54dd207..4646547f 100644 --- a/debian/control +++ b/debian/control @@ -20,7 +20,7 @@ Depends: ${misc:Depends}, gnupg, grep-dctrl, kpartx, - live-build (>= 3.0~a57-1ubuntu12~), + live-build (>= 3.0~a57-1ubuntu31~), lsb-release, lzma, parted, From 69c1eb6d26bf8a8ecfa7dc2bb2a4da802c4f9194 Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Fri, 29 Sep 2017 15:16:25 -0400 Subject: [PATCH 2/7] Mention unminimize script in motd --- live-build/auto/build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/live-build/auto/build b/live-build/auto/build index d3afccc1..b74473f8 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -114,10 +114,26 @@ if ! dpkg-query --show --showformat='${db:Status-Status}\n' ubuntu-minimal 2> /d DEBIAN_FRONTEND=noninteractive apt-get install -y ubuntu-minimal fi +# unminimization succeeded, there is no need to mention it in motd +rm -f /etc/update-motd.d/60-unminimize + EOF chmod +x chroot/usr/local/sbin/unminimize fi + # inform users about the unminimize script + cat > "chroot/etc/update-motd.d/60-unminimize" << EOF +#!/bin/sh +# +# This file is not managed by a package. If you no longer want to +# see this message you can safely remove the file. +echo "" +echo "This system does not provide part of the tools and documentation" +echo "which are available on standard Ubuntu systems." +echo "To make them available please run the "unminimize" command." +EOF + + chmod +x chroot/etc/update-motd.d/60-unminimize Chroot chroot "dpkg-divert --quiet --add \ --divert /usr/sbin/update-initramfs.REAL --rename \ /usr/sbin/update-initramfs" From d49691574171af1e4291d277521db0d6f2bc03ea Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Fri, 29 Sep 2017 15:20:11 -0400 Subject: [PATCH 3/7] Warn users that unminimize may fail reinstalling packages --- live-build/auto/build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/live-build/auto/build b/live-build/auto/build index b74473f8..96b35004 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -78,6 +78,22 @@ EOF set -e +echo "This system was optimized for smaller footprint by reducing the available" +echo "installed documentation, removal of rarely used tools, and by other means." +echo "" +echo "This script reverts part of the optimization and makes documentation and" +echo "tools available again to match the familiar Ubuntu minimial system." +echo "" +echo "Be warned that reinstallation of packages may fail due to changes to the" +echo "system configuration, due to installation of 3rd party packages, or for" +echo "other reasons." +read -p "Would you like to continue? [y/N]" REPLY +echo # (optional) move to a new line +if [ "$REPLY" != "y" ] && [ "$REPLY" != "Y" ] +then + exit 1 +fi + if [ -f /etc/dpkg/dpkg.cfg.d/excludes ] || [ -f /etc/dpkg/dpkg.cfg.d/excludes.dpkg-tmp ]; then echo "Re-enabling installation of all documentation in dpkg..." if [ -f /etc/dpkg/dpkg.cfg.d/excludes ]; then From 2ef2aee456bbc87a2c819bafa90aa1ea44808ecd Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Fri, 29 Sep 2017 15:20:14 -0400 Subject: [PATCH 4/7] Use SUBPROJECT=minimized name instead of SUBPROJECT=minimize for consistency --- live-build/auto/build | 6 +++--- live-build/auto/config | 4 ++-- live-build/ubuntu-cpc/hooks/032-disk-image.binary | 2 +- live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary | 2 +- live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 96b35004..aa67ef7b 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -45,14 +45,14 @@ Expire-Date: 0 lb bootstrap "$@" - if [ "$SUBPROJECT" = minimize ] \ + if [ "$SUBPROJECT" = minimized ] \ && ! Chroot chroot dpkg -l tzdata 2>&1 |grep -q ^ii; then # workaround for tzdata purge not removing these files rm -f chroot/etc/localtime chroot/etc/timezone fi - if [ "$SUBPROJECT" = minimize ]; then - # set up dpkg filters to skip installing docs on minimized system + if [ "$SUBPROJECT" = minimized ]; then + # set up dpkg filters to skip installing docs on minimizedd system mkdir -p chroot/etc/dpkg/dpkg.cfg.d cat > chroot/etc/dpkg/dpkg.cfg.d/excludes <> mountpoint/etc/default/grub.d/40-force-partuuid diff --git a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary index 5827a6fe..ca201bb7 100755 --- a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary @@ -62,7 +62,7 @@ install_grub() { efi_boot_dir="/boot/efi/EFI/BOOT" chroot mountpoint mkdir -p "${efi_boot_dir}" - if [ "$SUBPROJECT" = minimize ] && [ -n "$partuuid" ]; then + if [ "$SUBPROJECT" = minimized ] && [ -n "$partuuid" ]; then # FIXME: code duplicated between 032-disk-image.binary # and 033-disk-image-uefi.binary. We want to fix this to not # have initramfs-tools installed at all on these images. diff --git a/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot b/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot index d1fc8abf..e59e38c8 100755 --- a/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot +++ b/live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot @@ -59,7 +59,7 @@ _xchroot "${rootd}" sh -c 'sed -i "/^127.0.1.1/d" /etc/hosts' _xchroot "${rootd}" sh -c 'rm -f /etc/ssh/ssh_host_[rd]sa_key*' ## -------------- -if [ "${SUBPROJECT:-}" != minimize ]; then +if [ "${SUBPROJECT:-}" != minimized ]; then _xchroot "${rootd}" locale-gen en_US.utf8 fi From 2dcf16634bafb7bf44c1ec437c4a61646e459551 Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Fri, 29 Sep 2017 15:20:14 -0400 Subject: [PATCH 5/7] Run autopkgtest for SUBPROJECT=minimized --- debian/tests/control | 4 ++++ debian/tests/default-bootstraps | 1 + debian/tests/minimized | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 debian/tests/minimized diff --git a/debian/tests/control b/debian/tests/control index b40640f9..671e49e9 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,3 +1,7 @@ Tests: default-bootstraps Depends: @, lsb-release Restrictions: needs-root isolation-machine + +Tests: minimized +Depends: @, lsb-release +Restrictions: needs-root isolation-machine diff --git a/debian/tests/default-bootstraps b/debian/tests/default-bootstraps index 47c9ae13..433cd327 100755 --- a/debian/tests/default-bootstraps +++ b/debian/tests/default-bootstraps @@ -30,6 +30,7 @@ ALL_TRIPLETS=" ubuntu-budgie-live:: ubuntu-core:system-image:ubuntu-core ubuntu-cpc::ubuntu-cpc + ubuntu-cpc:minimized:ubuntu-cpc ubuntu-desktop-next:system-image:ubuntu-desktop-next ubuntu-desktop-next::ubuntu-desktop-next ubuntu-dvd:: diff --git a/debian/tests/minimized b/debian/tests/minimized new file mode 100644 index 00000000..a78a95fa --- /dev/null +++ b/debian/tests/minimized @@ -0,0 +1,3 @@ +#!/bin/bash + +env SELECTED_TRIPLETS=ubuntu-cpc:minimized:ubuntu-cpc debian/tests/default-bootstraps From f0cb85a506e904f3c99c11ac9a109b790f27e18a Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Fri, 29 Sep 2017 15:20:14 -0400 Subject: [PATCH 6/7] When SUBPROJECT environment variable is not set assume it to be "" --- live-build/auto/build | 8 ++--- live-build/auto/config | 30 +++++++++---------- .../ubuntu-cpc/hooks/032-disk-image.binary | 2 +- .../hooks/033-disk-image-uefi.binary | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index aa67ef7b..71d7bd56 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -45,13 +45,13 @@ Expire-Date: 0 lb bootstrap "$@" - if [ "$SUBPROJECT" = minimized ] \ + if [ "${SUBPROJECT:-}" = minimized ] \ && ! Chroot chroot dpkg -l tzdata 2>&1 |grep -q ^ii; then # workaround for tzdata purge not removing these files rm -f chroot/etc/localtime chroot/etc/timezone fi - if [ "$SUBPROJECT" = minimized ]; then + if [ "${SUBPROJECT:-}" = minimized ]; then # set up dpkg filters to skip installing docs on minimizedd system mkdir -p chroot/etc/dpkg/dpkg.cfg.d cat > chroot/etc/dpkg/dpkg.cfg.d/excludes <> config/chroot -echo "SUBPROJECT=\"$SUBPROJECT\"" >> config/chroot +echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/chroot echo "LB_BINARY_HOOKS=\"$BINARY_HOOKS\"" >> config/binary echo "BUILDSTAMP=\"$NOW\"" >> config/binary -echo "SUBPROJECT=\"$SUBPROJECT\"" >> config/binary +echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/binary case $ARCH+$SUBARCH in armhf+raspi2) @@ -768,7 +768,7 @@ EOF ;; esac -if [ $PROJECT = ubuntu-server ] && [ $SUBPROJECT != live ]; then +if [ $PROJECT = ubuntu-server ] && [ ${SUBPROJECT:-} != live ]; then cat > config/hooks/100-remove-fstab.chroot <> mountpoint/etc/default/grub.d/40-force-partuuid diff --git a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary index ca201bb7..932484ea 100755 --- a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary @@ -62,7 +62,7 @@ install_grub() { efi_boot_dir="/boot/efi/EFI/BOOT" chroot mountpoint mkdir -p "${efi_boot_dir}" - if [ "$SUBPROJECT" = minimized ] && [ -n "$partuuid" ]; then + if [ "${SUBPROJECT:-}" = minimized ] && [ -n "$partuuid" ]; then # FIXME: code duplicated between 032-disk-image.binary # and 033-disk-image-uefi.binary. We want to fix this to not # have initramfs-tools installed at all on these images. From 3d57c2af179eb34c1743b3e2a489e46d643b9cdc Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Fri, 29 Sep 2017 15:38:59 -0400 Subject: [PATCH 7/7] Update changelog --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 477f9261..b8a9ae36 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +livecd-rootfs (2.462) UNRELEASED; urgency=medium + + * Bump needed live-build version which can build images without initrd + * Mention unminimize script in motd + * Warn users that unminimize may fail reinstalling packages + * Use SUBPROJECT=minimized name instead of SUBPROJECT=minimize for + consistency + * Run autopkgtest for SUBPROJECT=minimized + * When SUBPROJECT environment variable is not set assume it to be "" + + -- Balint Reczey Fri, 29 Sep 2017 15:38:33 -0400 + livecd-rootfs (2.461) artful; urgency=medium * In subiquity, loadkeys to setup Shift+Tab key combination.