Merge lp:~mwhudson/livecd-rootfs/ubuntu-base-less-unminimization into lp:livecd-rootfs

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 1675
Proposed branch: lp:~mwhudson/livecd-rootfs/ubuntu-base-less-unminimization
Merge into: lp:livecd-rootfs
Diff against target: 95 lines (+44/-3)
2 files modified
debian/changelog (+10/-0)
live-build/auto/build (+34/-3)
To merge this branch: bzr merge lp:~mwhudson/livecd-rootfs/ubuntu-base-less-unminimization
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Review via email: mp+347428@code.launchpad.net

Commit message

   * Improvements to the ubuntu-base (i.e. Docker) build:
     - Customize the unminimize script to not install so many packages.
     - Divert /usr/bin/man to a script that points to the unminimize script.

To post a comment you must log in.
1679. By Michael Hudson-Doyle

Remove apt lists that are currently removed downstream anyway.
(LP: #1699913)

Revision history for this message
Steve Langasek (vorlon) :
review: Needs Information
1680. By Michael Hudson-Doyle

go back to having docker unminimize not install any extra packages

update text of man diversion to mention need to install man-db package

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

On 6 June 2018 at 06:55, Steve Langasek <email address hidden>
wrote:

>
> What is the justification for this hard-coded whitelist of packages? I
> would argue that it's better to have 'unminimize' not install any
> additional packages at all on the grounds that the docker image is only
> defined in terms of the minimized package set (ubuntu-base) and has no
> corresponding un-minimized form.
>

Yes, updated (and changed the man diversion a little to match)

1681. By Michael Hudson-Doyle

rm -r the lists

Revision history for this message
Steve Langasek (vorlon) wrote :

one more minor tweak requested; otherwise +1

review: Needs Fixing
1682. By Michael Hudson-Doyle

man un-diverting man idempotent

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :
Revision history for this message
Steve Langasek (vorlon) wrote :

LGTM.

review: Approve
1683. By Michael Hudson-Doyle

fix version number

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2018-05-28 14:39:53 +0000
+++ debian/changelog 2018-06-06 17:48:05 +0000
@@ -1,3 +1,13 @@
1livecd-rootfs (2.529) cosmic; urgency=medium
2
3 * Improvements to the ubuntu-base (i.e. Docker) build:
4 - Customize the unminimize script to not install ubuntu-minimal.
5 - Divert /usr/bin/man to a script that points to the unminimize script.
6 - Remove apt lists that are currently removed downstream anyway.
7 (LP: #1699913)
8
9 -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 05 Jun 2018 14:19:17 +1200
10
1livecd-rootfs (2.528) cosmic; urgency=medium11livecd-rootfs (2.528) cosmic; urgency=medium
212
3 * Don't divert grub-probe; otherwise we're missing the filesystem UUIDs that13 * Don't divert grub-probe; otherwise we're missing the filesystem UUIDs that
414
=== modified file 'live-build/auto/build'
--- live-build/auto/build 2018-04-11 21:26:43 +0000
+++ live-build/auto/build 2018-06-06 17:48:05 +0000
@@ -115,7 +115,7 @@
115echo "Reinstallation of packages may fail due to changes to the system"115echo "Reinstallation of packages may fail due to changes to the system"
116echo "configuration, the presence of third-party packages, or for other"116echo "configuration, the presence of third-party packages, or for other"
117echo "reasons."117echo "reasons."
118read -p "Would you like to continue? [y/N]" REPLY118read -p "Would you like to continue? [y/N] " REPLY
119echo # (optional) move to a new line119echo # (optional) move to a new line
120if [ "$REPLY" != "y" ] && [ "$REPLY" != "Y" ]120if [ "$REPLY" != "y" ] && [ "$REPLY" != "Y" ]
121then121then
@@ -153,6 +153,18 @@
153 fi153 fi
154fi154fi
155155
156if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then
157 # Remove diverted man binary
158 rm -f /usr/bin/man
159 dpkg-divert --quiet --remove --rename /usr/bin/man
160fi
161EOF
162
163 if [ "$PROJECT" != "ubuntu-base" ]; then
164 # ubuntu-minimal is too much for a docker container (it contains
165 # systemd and other things)
166 cat >> chroot/usr/local/sbin/unminimize <<'EOF'
167
156if ! dpkg-query --show --showformat='${db:Status-Status}\n' ubuntu-minimal 2> /dev/null | grep -q '^installed$'; then168if ! dpkg-query --show --showformat='${db:Status-Status}\n' ubuntu-minimal 2> /dev/null | grep -q '^installed$'; then
157 echo "Installing ubuntu-minimal package to provide the familiar Ubuntu minimal system..."169 echo "Installing ubuntu-minimal package to provide the familiar Ubuntu minimal system..."
158 DEBIAN_FRONTEND=noninteractive apt-get install -y ubuntu-minimal170 DEBIAN_FRONTEND=noninteractive apt-get install -y ubuntu-minimal
@@ -163,10 +175,12 @@
163 echo "Installing ubuntu-server recommends..."175 echo "Installing ubuntu-server recommends..."
164 DEBIAN_FRONTEND=noninteractive apt-get install -y landscape-common176 DEBIAN_FRONTEND=noninteractive apt-get install -y landscape-common
165fi177fi
178EOF
179fi
180 cat >> chroot/usr/local/sbin/unminimize <<'EOF'
166181
167# unminimization succeeded, there is no need to mention it in motd182# unminimization succeeded, there is no need to mention it in motd
168rm -f /etc/update-motd.d/60-unminimize183rm -f /etc/update-motd.d/60-unminimize
169
170EOF184EOF
171 chmod +x chroot/usr/local/sbin/unminimize185 chmod +x chroot/usr/local/sbin/unminimize
172186
@@ -183,7 +197,19 @@
183EOF197EOF
184198
185 chmod +x chroot/etc/update-motd.d/60-unminimize199 chmod +x chroot/etc/update-motd.d/60-unminimize
186 fi200 Chroot chroot "dpkg-divert --quiet --add \
201 --divert /usr/bin/man.REAL --rename \
202 /usr/bin/man"
203 cat > chroot/usr/bin/man << EOF
204#!/bin/sh
205echo "This system has been minimized by removing packages and content that are"
206echo "not required on a system that users do not log into."
207echo ""
208echo "To restore this content, including manpages, you can run the 'unminimize'"
209echo "command. You will still need to ensure the 'man-db' package is installed."
210EOF
211 chmod +x chroot/usr/bin/man
212 fi
187 Chroot chroot "dpkg-divert --quiet --add \213 Chroot chroot "dpkg-divert --quiet --add \
188 --divert /usr/sbin/update-initramfs.REAL --rename \214 --divert /usr/sbin/update-initramfs.REAL --rename \
189 /usr/sbin/update-initramfs"215 /usr/sbin/update-initramfs"
@@ -232,6 +258,11 @@
232 # remove crufty files that shouldn't be left in an image258 # remove crufty files that shouldn't be left in an image
233 rm -f chroot/var/cache/debconf/*-old chroot/var/lib/dpkg/*-old259 rm -f chroot/var/cache/debconf/*-old chroot/var/lib/dpkg/*-old
234 Chroot chroot apt clean260 Chroot chroot apt clean
261 if [ "${PROJECT}:${SUBPROJECT:-}" = "ubuntu-base:minimized" ]; then
262 # Save even more size by removing apt lists (that are currently removed
263 # downstream anyway)
264 rm -rf chroot/var/lib/apt/lists/*
265 fi
235266
236 if [ -f config/oem-config-preinstalled ]; then267 if [ -f config/oem-config-preinstalled ]; then
237268

Subscribers

People subscribed via source and target branches