summaryrefslogtreecommitdiffstats
path: root/py
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2010-01-18 14:03:18 -0600
committerClark Williams <williams@redhat.com>2010-01-18 14:03:18 -0600
commitc1168d3fee69207c71201270ce3dac734ceb23a2 (patch)
tree66f434efc7c7870462c230da6049789acbacdc1c /py
parenta0dde91ac38d1fa2d050668e09bb0b9c46e3df77 (diff)
downloadmock-c1168d3fee69207c71201270ce3dac734ceb23a2.tar.gz
mock-c1168d3fee69207c71201270ce3dac734ceb23a2.tar.xz
mock-c1168d3fee69207c71201270ce3dac734ceb23a2.zip
add --unpriv logic to --shell
Add logic to run with unprivleged uid:gid in interactive chroot shell. (BZ# 522505) Signed-off-by: Clark Williams <williams@redhat.com>
Diffstat (limited to 'py')
-rwxr-xr-xpy/mock.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/py/mock.py b/py/mock.py
index 46ffbbb..f4794ac 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -574,7 +574,11 @@ def main(ret):
chroot._setupDev()
chroot._mountall()
cmd = ' '.join(args)
- status = os.system("PS1='mock-chroot> ' /usr/sbin/chroot %s %s" % (chroot.makeChrootPath(), cmd))
+ if options.unpriv:
+ arg = '--userspec=%s:%s' % (chroot.chrootuid, chroot.chrootgid)
+ else:
+ arg = ''
+ status = os.system("PS1='mock-chroot> ' /usr/sbin/chroot %s %s %s" % (arg, chroot.makeChrootPath(), cmd))
ret['exitStatus'] = os.WEXITSTATUS(status)
finally: