mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 22:40:12 +01:00
Merge branch 'fix-post-kvm' into 'master'
Fix post KVM A couple of fixes to the KVM support that was just merged, as reported by @CiaranG See merge request !171
This commit is contained in:
commit
7cbdaedf2e
@ -72,7 +72,7 @@ if os.path.isfile('/usr/bin/systemd-detect-virt'):
|
|||||||
virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8')
|
virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8')
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
virt = 'none'
|
virt = 'none'
|
||||||
if virt == 'qemu' or virt == 'kvm':
|
if virt == 'qemu' or virt == 'kvm' or virt == 'bochs':
|
||||||
print('Running in a VM guest, defaulting to QEMU/KVM via libvirt')
|
print('Running in a VM guest, defaulting to QEMU/KVM via libvirt')
|
||||||
config['vm_provider'] = 'libvirt'
|
config['vm_provider'] = 'libvirt'
|
||||||
elif virt != 'none':
|
elif virt != 'none':
|
||||||
@ -96,20 +96,24 @@ if os.path.exists(boxfile):
|
|||||||
|
|
||||||
if options.clean:
|
if options.clean:
|
||||||
vagrant(['destroy', '-f'], cwd=serverdir, printout=options.verbose)
|
vagrant(['destroy', '-f'], cwd=serverdir, printout=options.verbose)
|
||||||
|
if config['vm_provider'] == 'libvirt':
|
||||||
|
subprocess.call(['virsh', 'undefine', 'buildserver_default'])
|
||||||
|
subprocess.call(['virsh', 'vol-delete', '/var/lib/libvirt/images/buildserver_default.img'])
|
||||||
|
|
||||||
# Update cached files.
|
# Update cached files.
|
||||||
cachedir = config['cachedir']
|
cachedir = config['cachedir']
|
||||||
if not os.path.exists(cachedir):
|
if not os.path.exists(cachedir):
|
||||||
os.makedirs(cachedir, 0o755)
|
os.makedirs(cachedir, 0o755)
|
||||||
|
|
||||||
tmp = cachedir
|
if config['vm_provider'] == 'libvirt':
|
||||||
while tmp != '/':
|
tmp = cachedir
|
||||||
mode = os.stat(tmp).st_mode
|
while tmp != '/':
|
||||||
if not (stat.S_IXUSR & mode and stat.S_IXGRP & mode and stat.S_IXOTH & mode):
|
mode = os.stat(tmp).st_mode
|
||||||
print('ERROR:', tmp, 'will not be accessible to the VM! To fix, run:')
|
if not (stat.S_IXUSR & mode and stat.S_IXGRP & mode and stat.S_IXOTH & mode):
|
||||||
print(' chmod a+X', tmp)
|
print('ERROR:', tmp, 'will not be accessible to the VM! To fix, run:')
|
||||||
sys.exit(1)
|
print(' chmod a+X', tmp)
|
||||||
tmp = os.path.dirname(tmp)
|
sys.exit(1)
|
||||||
|
tmp = os.path.dirname(tmp)
|
||||||
|
|
||||||
if config['apt_package_cache']:
|
if config['apt_package_cache']:
|
||||||
config['aptcachedir'] = cachedir + '/apt/archives'
|
config['aptcachedir'] = cachedir + '/apt/archives'
|
||||||
|
Loading…
Reference in New Issue
Block a user