Path(dst / "etc/resolv.conf").unlink(missing_ok=True)
Path(dst / "etc/resolv.conf").touch()
+ if not (dst / "etc/nsswitch.conf").exists():
+ (dst / "etc/nsswitch.conf").write_text(
+ textwrap.dedent(
+ """\
+ passwd: files
+ shadow: files
+ group: files
+ hosts: files myhostname resolve [!UNAVAIL=return] dns
+ services: files
+ netgroup: files
+ automount: files
+
+ aliases: files
+ ethers: files
+ gshadow: files
+ networks: files dns
+ protocols: files
+ publickey: files
+ rpc: files
+ """
+ )
+ )
+
Path(dst / "etc/static").unlink(missing_ok=True)
if (config.tools() / "etc/static").is_symlink():
(dst / "etc/static").symlink_to((config.tools() / "etc/static").readlink())
else:
cmdline += ["--dev", "/dev"]
- if network and Path("/etc/resolv.conf").exists():
- cmdline += ["--ro-bind", "/etc/resolv.conf", "/etc/resolv.conf"]
+ if network:
+ for p in (Path("/etc/resolv.conf"), Path("/run/systemd/resolve")):
+ if p.exists():
+ cmdline += ["--ro-bind", p, p]
home = None
*chroot_options(),
] # fmt: skip
- if network and Path("/etc/resolv.conf").exists():
- cmdline += ["--ro-bind", "/etc/resolv.conf", "/etc/resolv.conf"]
+ if network:
+ for p in (Path("/etc/resolv.conf"), Path("/run/systemd/resolve")):
+ if p.exists():
+ cmdline += ["--ro-bind", p, p]
with vartmpdir() as dir:
yield [*cmdline, "--bind", dir, "/var/tmp", *options]