summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael E Brown <michael_e_brown@dell.com>2007-06-14 11:43:44 -0500
committerMichael E Brown <michael_e_brown@dell.com>2007-06-14 11:43:44 -0500
commit680203b6388d67c34d5022cd3fad1956c138a5bc (patch)
treeeff52299f26c8f23ae4ec3066b768179d73a686f
parent3b6ea0ffbcd6c9142415b611b0e95d3ad8331580 (diff)
downloadmock-680203b6388d67c34d5022cd3fad1956c138a5bc.tar.gz
mock-680203b6388d67c34d5022cd3fad1956c138a5bc.tar.xz
mock-680203b6388d67c34d5022cd3fad1956c138a5bc.zip
resolv.conf fixes. use 'mock' group for multiuser goodness.
-rw-r--r--etc/defaults.cfg6
-rw-r--r--mock.py9
2 files changed, 10 insertions, 5 deletions
diff --git a/etc/defaults.cfg b/etc/defaults.cfg
index 993ff6d..f9a57ed 100644
--- a/etc/defaults.cfg
+++ b/etc/defaults.cfg
@@ -12,11 +12,15 @@ config_opts['chrootgroup'] = 'mockbuild'
config_opts['chroothome'] = '/builddir'
config_opts['clean'] = True
+import grp
+config_opts['chrootuid'] = os.geteuid()
+config_opts['chrootgid'] = grp.getgrnam("mock")[2]
+
# copy the host resolv.conf to the chroot
config_opts['use_host_resolv'] = True
# caching related options
-config_opts['rebuild_cache'] = True
+config_opts['rebuild_cache'] = False
config_opts['use_cache'] = True
config_opts['cache_topdir'] = "root-cache"
config_opts['max_cache_age_days'] = 15
diff --git a/mock.py b/mock.py
index c827b02..051a92e 100644
--- a/mock.py
+++ b/mock.py
@@ -717,17 +717,18 @@ class Root:
yumdir = os.path.join(self.rootdir, 'etc', 'yum')
self._ensure_dir(yumdir)
yumlink = os.path.join(yumdir, 'yum.conf')
- if not os.path.exists(yumlink):
+ if os.path.exists(yumlink):
cmd = '%s -rf %s' % (self.config['rm'], yumlink)
(retval, output) = self.do(cmd)
os.symlink('../yum.conf', yumlink)
if self.config.setdefault('use_host_resolv', True) == True:
- resolvpath = os.path.join(self.rootdir, 'etc')
+ resolvdir = os.path.join(self.rootdir, 'etc')
+ resolvpath = os.path.join(self.rootdir, 'etc', 'resolv.conf')
if os.path.exists(resolvpath):
- cmd = '%s -rf %s' % (self.config['rm'], os.path.join(resolvpath, "resolv.conf"))
+ cmd = '%s -rf %s' % (self.config['rm'], resolvpath)
(retval, output) = self.do(cmd)
- shutil.copy2('/etc/resolv.conf', resolvpath)
+ shutil.copy2('/etc/resolv.conf', resolvdir)
os.chmod(resolvpath, 0664)
# files in /etc that need doing