[PATCH 05/16] iutil: Transparently redirect anyone who asks root=/mnt/sysimage to sysroot

Radek Vykydal rvykydal at redhat.com
Mon Jul 14 11:15:39 UTC 2014


From: Colin Walters <walters at verbum.org>

This is a followup from the previous commit to split the physical
mount and OS root path.  No code should be asking to run code directly
in the physical root, so just redirect them to the OS root.

Resolves: rhbz#1113535
Port of rpmostreepayload patches from master
commit 6bfa5c1c7b0b3a2301ac1468438d096407fb0a8f
---
 pyanaconda/iutil.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index 46f8079..41853f7 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -96,9 +96,15 @@ def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None, log_ou
     if env_prune is None:
         env_prune = []
 
+    # Transparently redirect callers requesting root=ROOT_PATH to the
+    # configured system root.
+    target_root = root
+    if target_root == ROOT_PATH:
+        target_root = getSysroot()
+
     def chroot():
-        if root and root != '/':
-            os.chroot(root)
+        if target_root and target_root != '/':
+            os.chroot(target_root)
             os.chdir("/")
 
     with program_log_lock:
-- 
1.9.0



More information about the anaconda-patches mailing list