1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-03 17:50:11 +02:00

buildserver: only check cache permissions when using libvirt

VirtualBox runs as the same user as `fdroid`, so the cache does not need to
be accessible by the world.  On libvirt, libvirtd runs the VMs as its own
user, so in that case, the cache dirs must have permissions to let that
user access them.
This commit is contained in:
Hans-Christoph Steiner 2016-09-23 15:19:15 +02:00
parent f6a487eee4
commit 1e8fd01c1e

View File

@ -105,14 +105,15 @@ 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'