chiark / gitweb /
buildserver: make sure cachedir is accessible to VM instance
authorHans-Christoph Steiner <hans@eds.org>
Tue, 6 Sep 2016 12:22:29 +0000 (14:22 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Mon, 19 Sep 2016 14:33:12 +0000 (16:33 +0200)
It seems that KVM/QEMU's 9p sharing is more sensitive to file perms.  If
~/.cache is 0700, then ~/.cache/fdroidserver cannot be mounted in the guest

makebuildserver

index 365c03da63b954c7a016001d39b299ac1337ae6a..3a26bf512f1c5ee014c11ae3cd7e1e4506cf694a 100755 (executable)
@@ -2,6 +2,7 @@
 
 import os
 import requests
+import stat
 import sys
 import subprocess
 import time
@@ -89,6 +90,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['apt_package_cache']:
     config['aptcachedir'] = cachedir + '/apt/archives'