From: Antonio Terceiro Date: Fri, 7 Sep 2018 14:53:24 +0000 (-0300) Subject: debian: also remove docs installed by debootstrap X-Git-Tag: v5~54^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F263%2Fhead;p=thirdparty%2Fmkosi.git debian: also remove docs installed by debootstrap On my tests, this reduces a minimal Debian stable rootfs from ~204 MB to ~157 MB --- 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)