From 4cf823756a099277083a5908ed5335882ad3cf2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Sun, 7 Jan 2018 22:27:51 +0100 Subject: [PATCH] Stop patching nsswitch.conf and make resolv.conf points to stub-resolv.conf on Arch Linux The `nsswitch.conf` file that comes by default on Arch Linux is now fully systemd-resolved compatible. Its `hosts:` line is now: ``` hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname ``` So, there is no need to patch this file when enabling systemd-resolved on Arch Linux anymore. Also make `/etc/resolv.conf` points to the new dynamic `/run/systemd/resolve/stub-resolv.conf` rather than the older static `/usr/lib/systemd/resolv.conf`. --- mkosi | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/mkosi b/mkosi index f11ec736d..9d05943e4 100755 --- a/mkosi +++ b/mkosi @@ -844,13 +844,6 @@ def patch_file(filepath, line_rewriter): os.remove(filepath) shutil.move(temp_new_filepath, filepath) -def fix_hosts_line_in_nsswitch(line): - if line.startswith("hosts:"): - sources = line.split(" ") - if 'resolve' not in sources: - return " ".join(["resolve" if w == "dns" else w for w in sources]) - return line - def enable_networkd(workspace): run(["systemctl", "--root", os.path.join(workspace, "root"), @@ -858,9 +851,7 @@ def enable_networkd(workspace): check=True) os.remove(os.path.join(workspace, "root", "etc/resolv.conf")) - os.symlink("../usr/lib/systemd/resolv.conf", os.path.join(workspace, "root", "etc/resolv.conf")) - - patch_file(os.path.join(workspace, "root", "etc/nsswitch.conf"), fix_hosts_line_in_nsswitch) + os.symlink("../run/systemd/resolve/stub-resolv.conf", os.path.join(workspace, "root", "etc/resolv.conf")) with open(os.path.join(workspace, "root", "etc/systemd/network/all-ethernet.network"), "w") as f: f.write("""\ -- 2.47.2