X-Git-Url: https://git.distorted.org.uk/~mdw/distorted-chroot/blobdiff_plain/a98c9dba94d44ada3a7e7f3b4ce8b6df6911a2d2..83641d1b50e9f9bce27eabd06d1c5208549b3a86:/bin/chroot-maint diff --git a/bin/chroot-maint b/bin/chroot-maint index 5b63037..4dba315 100755 --- a/bin/chroot-maint +++ b/bin/chroot-maint @@ -618,7 +618,8 @@ def mkdir_p(dir, mode = 0777): Unlike `OS.makedirs', this doesn't fail if DIR already exists. """ - d = "" + if dir.startswith("/"): d = "/"; dir = dir[1:] + else: d = "" for p in dir.split("/"): d = OS.path.join(d, p) if d == "": continue @@ -1476,6 +1477,12 @@ with toplevel_handler(): C = Config() CREATE = Tag("CREATE") FORCE = Tag("FORCE") +DEBCONF_TWEAKS = """ + DEBIAN_FRONTEND=noninteractive; export DEBIAN_FRONTEND + DEBIAN_PRIORITY=critical export DEBIAN_PRIORITY + DEBCONF_NONINTERACTIVE_SEEN=true; export DEBCONF_NONINTERACTIVE_SEEN +""" + def check_fresh(fresh, update): """ Compare a refresh mode FRESH against an UPDATE time. @@ -1937,7 +1944,7 @@ class ChrootJob (BaseJob): continue ff.append(f) path = OS.path.join(dir, f) - if not OS.path.isdir(path): examine(path) + if OS.path.islink(path) or not OS.path.isdir(path): examine(path) files[:] = ff OS.path.walk(crossdir, visit, None) OS.path.walk(OS.path.join(crossdir, "TOOLCHAIN", gnuarch), @@ -2109,7 +2116,7 @@ class ChrootJob (BaseJob): ## Install the base system. progress("install base system") - run_root(["eatmydata", "debootstrap"] + + run_root(["eatmydata", "debootstrap", "--no-merged-usr"] + (arch in C.FOREIGN_ARCHS and ["--foreign"] or []) + ["--arch=" + arch, "--variant=minbase", "--include=" + ",".join(C.BASE_PACKAGES), @@ -2149,12 +2156,12 @@ class ChrootJob (BaseJob): with safewrite_root\ (OS.path.join(mnt, "fs/etc/apt/apt.conf.d/20arch")) as f: f.write("""\ - ### -*-conf-*- +### -*-conf-*- - APT { - Architecture "%s"; - }; - """ % arch) +APT { + Architecture "%s"; +}; +""" % arch) ## Set up the locale and time zone from the host system. progress("configure locales and timezone") @@ -2177,10 +2184,10 @@ class ChrootJob (BaseJob): with safewrite_root(OS.path.join(mnt, "fs/usr/sbin/policy-rc.d"), mode = "755") as f: f.write("""\ - #! /bin/sh - echo >&2 "policy-rc.d: Services disabled by policy." - exit 101 - """) +#! /bin/sh +echo >&2 "policy-rc.d: Services disabled by policy." +exit 101 +""") ## Hack the dynamic linker to prefer libraries in `/usr' over ## `/usr/local'. This prevents `dpkg-shlibdeps' from becoming @@ -2192,10 +2199,10 @@ class ChrootJob (BaseJob): with safewrite_root\ (OS.path.join(mnt, "fs/etc/ld.so.conf.d/zzz-local.conf")) as f: f.write("""\ - ### -*-conf-*- - ### Local hack to make /usr/local/ late. - /usr/local/lib - """) +### -*-conf-*- +### Local hack to make /usr/local/ late. +/usr/local/lib +""") ## If this is a foreign architecture then we need to set it up. if arch in C.FOREIGN_ARCHS: @@ -2221,7 +2228,8 @@ class ChrootJob (BaseJob): ## Finishing touches. progress("finishing touches") - run_schroot_source(dist, arch, ["eatmydata", "sh", "-e", "-c", """ + run_schroot_source(dist, arch, ["eatmydata", "sh", "-e", "-c", + DEBCONF_TWEAKS + """ apt-get update apt-get -y upgrade apt-get -y install "$@" @@ -2239,11 +2247,13 @@ class ChrootJob (BaseJob): with Cleanup() as clean: dist, arch = me._dist, me._arch clean.enter(lockfile(chroot_src_lockfile(dist, arch))) - run_schroot_source(dist, arch, ["eatmydata", "sh", "-e", "-c", """ + run_schroot_source(dist, arch, ["eatmydata", "sh", "-e", "-c", + DEBCONF_TWEAKS + """ apt-get update apt-get -y dist-upgrade apt-get -y autoremove apt-get -y clean + ldconfig """], stdin = DISCARD) if arch in C.FOREIGN_ARCHS: me._install_cross_tools() me._meta.update = zulu(); me._meta.write() @@ -2310,7 +2320,8 @@ class CrossToolsJob (BaseJob): ## Make sure the donor tree is up-to-date, and install the extra ## packages we need. progress("install tools packages") - run_schroot_session(session, ["eatmydata", "sh", "-e", "-c", """ + run_schroot_session(session, ["eatmydata", "sh", "-e", "-c", + DEBCONF_TWEAKS + """ apt-get update apt-get -y upgrade apt-get -y install "$@" @@ -2365,7 +2376,7 @@ class CrossToolsJob (BaseJob): try: dest = dest[:dest.rindex("/")] except ValueError: dest = "" if path == "": path = link - else: path = "%s/%s" % (path, link) + else: path = "%s/%s" % (link, path) ## Work through the shopping list, copying the things it names into the ## cross-tools tree.