mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 18:26:15 +01:00
don't require root for kvm
This commit is contained in:
parent
b50d73b7d0
commit
f45017a55e
16
osc/build.py
16
osc/build.py
@ -693,6 +693,7 @@ def main(opts, argv):
|
|||||||
# before
|
# before
|
||||||
my_build_device = build_root + '/img'
|
my_build_device = build_root + '/img'
|
||||||
|
|
||||||
|
need_root = True
|
||||||
if config['build-type']:
|
if config['build-type']:
|
||||||
if config['build-swap']:
|
if config['build-swap']:
|
||||||
my_build_swap = config['build-swap'] % subst
|
my_build_swap = config['build-swap'] % subst
|
||||||
@ -702,6 +703,10 @@ def main(opts, argv):
|
|||||||
if config['build-type'] in ('kvm', 'xen'):
|
if config['build-type'] in ('kvm', 'xen'):
|
||||||
vm_options = '--%s %s' % (config['build-type'], my_build_device)
|
vm_options = '--%s %s' % (config['build-type'], my_build_device)
|
||||||
vm_options += ' --swap ' + my_build_swap
|
vm_options += ' --swap ' + my_build_swap
|
||||||
|
if config['build-type'] == 'kvm':
|
||||||
|
if os.access(build_root, os.W_OK) and os.access('/dev/kvm', os.W_OK):
|
||||||
|
# so let's hope there's also an fstab entry
|
||||||
|
need_root = False
|
||||||
build_root += '/.mount'
|
build_root += '/.mount'
|
||||||
elif config['build-type'] == 'lxc':
|
elif config['build-type'] == 'lxc':
|
||||||
vm_options = '--lxc'
|
vm_options = '--lxc'
|
||||||
@ -727,13 +732,14 @@ def main(opts, argv):
|
|||||||
buildargs,
|
buildargs,
|
||||||
build_descr)
|
build_descr)
|
||||||
|
|
||||||
if config['su-wrapper'].startswith('su '):
|
if need_root:
|
||||||
tmpl = '%s \'%s\''
|
if config['su-wrapper'].startswith('su '):
|
||||||
else:
|
tmpl = '%s \'%s\''
|
||||||
tmpl = '%s %s'
|
else:
|
||||||
|
tmpl = '%s %s'
|
||||||
|
cmd = tmpl % (config['su-wrapper'], cmd)
|
||||||
|
|
||||||
# change personality, if needed
|
# change personality, if needed
|
||||||
cmd = tmpl % (config['su-wrapper'], cmd)
|
|
||||||
if hostarch != bi.buildarch:
|
if hostarch != bi.buildarch:
|
||||||
cmd = (change_personality.get(bi.buildarch, '') + ' ' + cmd).strip()
|
cmd = (change_personality.get(bi.buildarch, '') + ' ' + cmd).strip()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user