]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Use shutil.move() to move /etc/resolv.conf symlink
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 9 Feb 2023 16:16:47 +0000 (17:16 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 9 Feb 2023 16:19:22 +0000 (17:19 +0100)
mkosi/run.py

index 5ac230e368d81642e16fd6a6aa26ae71a83600dc..2008443362a34bab27a4756c3b06e6d3df810898 100644 (file)
@@ -307,7 +307,7 @@ def run_workspace_command(
         # Bubblewrap does not mount over symlinks and /etc/resolv.conf might be a symlink. Deal with this by
         # temporarily moving the file somewhere else.
         if resolve.is_symlink():
-            shutil.copy2(resolve, state.workspace / "resolv.conf", follow_symlinks=False)
+            shutil.move(resolve, state.workspace / "resolv.conf")
 
         # If we're using the host network namespace, use the same resolver
         cmdline += ["--ro-bind", "/etc/resolv.conf", "/etc/resolv.conf"]
@@ -333,4 +333,4 @@ def run_workspace_command(
         die(f"\"{shlex.join(str(s) for s in cmd)}\" returned non-zero exit code {e.returncode}.")
     finally:
         if state.workspace.joinpath("resolv.conf").exists():
-            shutil.copy2(state.workspace.joinpath("resolv.conf"), resolve, follow_symlinks=False)
+            shutil.move(state.workspace.joinpath("resolv.conf"), resolve)