Fix docker args conditional

This commit is contained in:
setpill 2021-01-25 15:33:07 +01:00
parent d0852f39a7
commit 624091b7b9

View File

@ -13,15 +13,16 @@ def setup():
programs = ['ruby', 'git', 'make', 'wget', 'curl'] programs = ['ruby', 'git', 'make', 'wget', 'curl']
if args.kvm: if args.kvm:
programs += ['apt-cacher-ng', 'python-vm-builder', 'qemu-kvm', 'qemu-utils'] programs += ['apt-cacher-ng', 'python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker and not os.path.isfile('/lib/systemd/system/docker.service'): elif args.docker:
dockers = ['docker.io', 'docker-ce'] if not os.path.isfile('/lib/systemd/system/docker.service'):
for i in dockers: dockers = ['docker.io', 'docker-ce']
return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i]) for i in dockers:
if return_code == 0: return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i])
break if return_code == 0:
if return_code != 0: break
print('Cannot find any way to install Docker.', file=sys.stderr) if return_code != 0:
sys.exit(1) print('Cannot find any way to install Docker.', file=sys.stderr)
sys.exit(1)
else: else:
programs += ['apt-cacher-ng', 'lxc', 'debootstrap'] programs += ['apt-cacher-ng', 'lxc', 'debootstrap']
subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs) subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs)