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
1=== modified file 'debian/changelog'
2--- debian/changelog 2018-05-28 14:39:53 +0000
3+++ debian/changelog 2018-06-06 17:48:05 +0000
4@@ -1,3 +1,13 @@
5+livecd-rootfs (2.529) cosmic; urgency=medium
6+
7+ * Improvements to the ubuntu-base (i.e. Docker) build:
8+ - Customize the unminimize script to not install ubuntu-minimal.
9+ - Divert /usr/bin/man to a script that points to the unminimize script.
10+ - Remove apt lists that are currently removed downstream anyway.
11+ (LP: #1699913)
12+
13+ -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 05 Jun 2018 14:19:17 +1200
14+
15 livecd-rootfs (2.528) cosmic; urgency=medium
16
17 * Don't divert grub-probe; otherwise we're missing the filesystem UUIDs that
18
19=== modified file 'live-build/auto/build'
20--- live-build/auto/build 2018-04-11 21:26:43 +0000
21+++ live-build/auto/build 2018-06-06 17:48:05 +0000
22@@ -115,7 +115,7 @@
23 echo "Reinstallation of packages may fail due to changes to the system"
24 echo "configuration, the presence of third-party packages, or for other"
25 echo "reasons."
26-read -p "Would you like to continue? [y/N]" REPLY
27+read -p "Would you like to continue? [y/N] " REPLY
28 echo # (optional) move to a new line
29 if [ "$REPLY" != "y" ] && [ "$REPLY" != "Y" ]
30 then
31@@ -153,6 +153,18 @@
32 fi
33 fi
34
35+if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then
36+ # Remove diverted man binary
37+ rm -f /usr/bin/man
38+ dpkg-divert --quiet --remove --rename /usr/bin/man
39+fi
40+EOF
41+
42+ if [ "$PROJECT" != "ubuntu-base" ]; then
43+ # ubuntu-minimal is too much for a docker container (it contains
44+ # systemd and other things)
45+ cat >> chroot/usr/local/sbin/unminimize <<'EOF'
46+
47 if ! dpkg-query --show --showformat='${db:Status-Status}\n' ubuntu-minimal 2> /dev/null | grep -q '^installed$'; then
48 echo "Installing ubuntu-minimal package to provide the familiar Ubuntu minimal system..."
49 DEBIAN_FRONTEND=noninteractive apt-get install -y ubuntu-minimal
50@@ -163,10 +175,12 @@
51 echo "Installing ubuntu-server recommends..."
52 DEBIAN_FRONTEND=noninteractive apt-get install -y landscape-common
53 fi
54+EOF
55+fi
56+ cat >> chroot/usr/local/sbin/unminimize <<'EOF'
57
58 # unminimization succeeded, there is no need to mention it in motd
59 rm -f /etc/update-motd.d/60-unminimize
60-
61 EOF
62 chmod +x chroot/usr/local/sbin/unminimize
63
64@@ -183,7 +197,19 @@
65 EOF
66
67 chmod +x chroot/etc/update-motd.d/60-unminimize
68- fi
69+ Chroot chroot "dpkg-divert --quiet --add \
70+ --divert /usr/bin/man.REAL --rename \
71+ /usr/bin/man"
72+ cat > chroot/usr/bin/man << EOF
73+#!/bin/sh
74+echo "This system has been minimized by removing packages and content that are"
75+echo "not required on a system that users do not log into."
76+echo ""
77+echo "To restore this content, including manpages, you can run the 'unminimize'"
78+echo "command. You will still need to ensure the 'man-db' package is installed."
79+EOF
80+ chmod +x chroot/usr/bin/man
81+ fi
82 Chroot chroot "dpkg-divert --quiet --add \
83 --divert /usr/sbin/update-initramfs.REAL --rename \
84 /usr/sbin/update-initramfs"
85@@ -232,6 +258,11 @@
86 # remove crufty files that shouldn't be left in an image
87 rm -f chroot/var/cache/debconf/*-old chroot/var/lib/dpkg/*-old
88 Chroot chroot apt clean
89+ if [ "${PROJECT}:${SUBPROJECT:-}" = "ubuntu-base:minimized" ]; then
90+ # Save even more size by removing apt lists (that are currently removed
91+ # downstream anyway)
92+ rm -rf chroot/var/lib/apt/lists/*
93+ fi
94
95 if [ -f config/oem-config-preinstalled ]; then
96

Subscribers

People subscribed via source and target branches