From 6e37ac460ec6a9ec34ff067bf6b74f1d2bdce13d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 24 Apr 2014 16:02:17 -0400 Subject: [PATCH 06/20] iutil: Transparently redirect anyone who asks root=/mnt/sysimage to sysroot 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.3