summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2012-09-20 14:56:50 +0800
committerGui Chen <gui.chen@intel.com>2012-09-20 14:56:50 +0800
commit6fa7be66571d94bb0dbe6fb7c56c62896664e181 (patch)
treeef8782cc3126da355157a5f5b16b55c5af3ef3df
parented5ab343d2d6efb9b925563590defa4ae3364d4f (diff)
downloadmic-6fa7be66571d94bb0dbe6fb7c56c62896664e181.tar.gz
mic-6fa7be66571d94bb0dbe6fb7c56c62896664e181.tar.bz2
mic-6fa7be66571d94bb0dbe6fb7c56c62896664e181.zip
add bootstrap defined path to PATH variable
env variable PATH should be defined in bootstrap, and they should be append to PATH when chroot Signed-off-by: Gui Chen <gui.chen@intel.com>
-rw-r--r--mic/bootstrap.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/mic/bootstrap.py b/mic/bootstrap.py
index 6db2aab..f3a23d3 100644
--- a/mic/bootstrap.py
+++ b/mic/bootstrap.py
@@ -27,6 +27,8 @@ from mic.utils import errors, proxy, misc
from mic.utils.rpmmisc import readRpmHeader, RPMInstallCallback
from mic.chroot import cleanup_mounts, setup_chrootenv, cleanup_chrootenv
+PATH_BOOTSTRAP = "/usr/sbin:/usr/bin:/sbin:/bin"
+
RPMTRANS_FLAGS = [
rpm.RPMTRANS_FLAG_ALLFILES,
rpm.RPMTRANS_FLAG_NOSCRIPTS,
@@ -217,12 +219,15 @@ class Bootstrap(object):
else:
shell = True
+ env = os.environ
+ env['PATH'] = "%s:%s" % (PATH_BOOTSTRAP, env['PATH'])
+
retcode = 0
gloablmounts = None
try:
proxy.set_proxy_environ()
gloablmounts = setup_chrootenv(self.rootdir, bindmounts)
- retcode = subprocess.call(cmd, preexec_fn = mychroot, shell=shell)
+ retcode = subprocess.call(cmd, preexec_fn=mychroot, env=env, shell=shell)
except (OSError, IOError), err:
raise RuntimeError(err)
finally: