Skip to content

Commit 29b4ee6

Browse files
author
MarcoFalke
committed
Merge #13714: contrib: Add lxc network setup for Bionic host
60c3c23 [contrib] Add automatic setup for Ubuntu Bionic (Chun Kuan Lee) Pull request description: Tree-SHA512: db7a67df34c143647098bd5cb499b5ebc8d6847bf5e20dc3b4d6093a1649dcf42007d02b40e95b1fa76c0aadecc1eb2374ca9ca247bdd6358a08a6c4358f4b9c
2 parents 2d41af1 + 60c3c23 commit 29b4ee6

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

contrib/gitian-build.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ def setup():
1111
if args.kvm:
1212
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
1313
elif args.docker:
14-
programs += ['docker.io']
14+
dockers = ['docker.io', 'docker-ce']
15+
for i in dockers:
16+
return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i])
17+
if return_code == 0:
18+
break
19+
if return_code != 0:
20+
print('Cannot find any way to install docker', file=sys.stderr)
21+
exit(1)
1522
else:
1623
programs += ['lxc', 'debootstrap']
1724
subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs)
@@ -31,6 +38,10 @@ def setup():
3138
make_image_prog += ['--lxc']
3239
subprocess.check_call(make_image_prog)
3340
os.chdir(workdir)
41+
if args.is_bionic and not args.kvm and not args.docker:
42+
subprocess.check_call(['sudo', 'sed', '-i', 's/lxcbr0/br0/', '/etc/default/lxc-net'])
43+
print('Reboot is required')
44+
exit(0)
3445

3546
def build():
3647
global args, workdir
@@ -147,6 +158,8 @@ def main():
147158
args.windows = 'w' in args.os
148159
args.macos = 'm' in args.os
149160

161+
args.is_bionic = b'bionic' in subprocess.check_output(['lsb_release', '-cs'])
162+
150163
if args.buildsign:
151164
args.build=True
152165
args.sign=True
@@ -161,6 +174,10 @@ def main():
161174
os.environ['USE_DOCKER'] = '1'
162175
elif not args.kvm:
163176
os.environ['USE_LXC'] = '1'
177+
if not 'GITIAN_HOST_IP' in os.environ.keys():
178+
os.environ['GITIAN_HOST_IP'] = '10.0.3.1'
179+
if not 'LXC_GUEST_IP' in os.environ.keys():
180+
os.environ['LXC_GUEST_IP'] = '10.0.3.5'
164181

165182
# Disable for MacOS if no SDK found
166183
if args.macos and not os.path.isfile('gitian-builder/inputs/MacOSX10.11.sdk.tar.gz'):

0 commit comments

Comments
 (0)