1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01: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):
os.makedirs(cachedir, 0o755)
tmp = cachedir
while tmp != '/':
mode = os.stat(tmp).st_mode
if not (stat.S_IXUSR & mode and stat.S_IXGRP & mode and stat.S_IXOTH & mode):
print('ERROR:', tmp, 'will not be accessible to the VM! To fix, run:')
print(' chmod a+X', tmp)
sys.exit(1)
tmp = os.path.dirname(tmp)
if config['vm_provider'] == 'libvirt':
tmp = cachedir
while tmp != '/':
mode = os.stat(tmp).st_mode
if not (stat.S_IXUSR & mode and stat.S_IXGRP & mode and stat.S_IXOTH & mode):
print('ERROR:', tmp, 'will not be accessible to the VM! To fix, run:')
print(' chmod a+X', tmp)
sys.exit(1)
tmp = os.path.dirname(tmp)
if config['apt_package_cache']:
config['aptcachedir'] = cachedir + '/apt/archives'