From 1d4e5952c9dbce338f744521ec7776f1df1f447a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Tue, 23 Oct 2018 16:38:34 +0200 Subject: [PATCH] move host vm warning to main block --- makebuildserver | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/makebuildserver b/makebuildserver index 0a53b89c..2015fa4f 100755 --- a/makebuildserver +++ b/makebuildserver @@ -104,18 +104,6 @@ config = { 'vm_provider': 'virtualbox', } -if os.path.isfile('/usr/bin/systemd-detect-virt'): - try: - virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8') - except subprocess.CalledProcessError: - virt = 'none' - if virt == 'qemu' or virt == 'kvm' or virt == 'bochs': - logging.info('Running in a VM guest, defaulting to QEMU/KVM via libvirt') - config['vm_provider'] = 'libvirt' - elif virt != 'none': - logging.info('Running in an unsupported VM guest (%s)!', virt) - logging.debug('detected virt: %s', virt) - # load config file, if present if os.path.exists('makebuildserver.config.py'): exec(compile(open('makebuildserver.config.py').read(), 'makebuildserver.config.py', 'exec'), config) @@ -689,6 +677,18 @@ if __name__ == '__main__': logging.critical('This must be run as ./makebuildserver in fdroidserver.git!') sys.exit(1) + if os.path.isfile('/usr/bin/systemd-detect-virt'): + try: + virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8') + except subprocess.CalledProcessError: + virt = 'none' + if virt == 'qemu' or virt == 'kvm' or virt == 'bochs': + logging.info('Running in a VM guest, defaulting to QEMU/KVM via libvirt') + config['vm_provider'] = 'libvirt' + elif virt != 'none': + logging.info('Running in an unsupported VM guest (%s)!', virt) + logging.debug('detected virt: %s', virt) + try: main() finally: