From c1168d3fee69207c71201270ce3dac734ceb23a2 Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Mon, 18 Jan 2010 14:03:18 -0600 Subject: add --unpriv logic to --shell Add logic to run with unprivleged uid:gid in interactive chroot shell. (BZ# 522505) Signed-off-by: Clark Williams --- py/mock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'py') 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: -- cgit