From 880f55bae963617f756f105232c1fd92515524b1 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Fri, 7 Sep 2018 11:53:24 -0300 Subject: [PATCH] debian: also remove docs installed by debootstrap On my tests, this reduces a minimal Debian stable rootfs from ~204 MB to ~157 MB --- mkosi | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/mkosi b/mkosi index 5f9ecfd7b..c48979ed5 100755 --- a/mkosi +++ b/mkosi @@ -1323,19 +1323,24 @@ def install_debian_or_ubuntu(args, workspace, run_build_script, mirror): f.write("#!/bin/sh\n") f.write("exit 101") os.chmod(policyrcd, 0o755) + + doc_paths = [ + '/usr/share/locale', + '/usr/share/doc', + '/usr/share/man', + '/usr/share/groff', + '/usr/share/info', + '/usr/share/lintian', + '/usr/share/linda', + ] if not args.with_docs: - # Create dpkg.cfg to ingore documentation + # remove documentation installed by debootstrap + cmdline = ["rm", "-rf"] + doc_paths + run_workspace_command(args, workspace, *cmdline) + # Create dpkg.cfg to ingore documentation on new packages dpkg_conf = os.path.join(workspace, "root/etc/dpkg/dpkg.cfg.d/01_nodoc") with open(dpkg_conf, "w") as f: - f.writelines([ - 'path-exclude /usr/share/locale/*\n', - 'path-exclude /usr/share/doc/*\n', - 'path-exclude /usr/share/man/*\n', - 'path-exclude /usr/share/groff/*\n', - 'path-exclude /usr/share/info/*\n', - 'path-exclude /usr/share/lintian/*\n', - 'path-exclude /usr/share/linda/*\n', - ]) + f.writelines(["path-exclude %s/*\n" % d for d in doc_paths]) cmdline = ["/usr/bin/apt-get", "--assume-yes", "--no-install-recommends", "install"] + extra_packages run_workspace_command(args, workspace, network=True, env={'DEBIAN_FRONTEND': 'noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN': 'true'}, *cmdline) -- 2.47.2