22 lines
415 B
Python
Executable File
22 lines
415 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
import os,sys,re,subprocess
|
|
|
|
i=1
|
|
repo=sys.argv[i]
|
|
i += 1
|
|
chroot_path=sys.argv[i]
|
|
i += 1
|
|
args=sys.argv[i:]
|
|
|
|
def run_in_chroot(args):
|
|
proc_path=os.path.join(chroot_path, 'proc')
|
|
subprocess.check_call(['mount', '-t', 'proc', 'proc', proc_path])
|
|
|
|
try:
|
|
subprocess.check_call(['chroot', chroot_path])
|
|
finally:
|
|
subprocess.call(['umount', proc_path])
|
|
|
|
run_in_chroot(args)
|