From 824af776d9163102c935bac5834fd3dccbad748d Mon Sep 17 00:00:00 2001 From: Disassembler Date: Wed, 5 Sep 2018 19:44:23 +0200 Subject: [PATCH] more fixes --- basic-runtimes/python3.lxcfile | 2 +- lxc-build | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/basic-runtimes/python3.lxcfile b/basic-runtimes/python3.lxcfile index 66ee91d..155039e 100644 --- a/basic-runtimes/python3.lxcfile +++ b/basic-runtimes/python3.lxcfile @@ -1,7 +1,7 @@ IMAGE build LAYER shared/alpine LAYER shared/libxml -LAYER shared/python2 +LAYER shared/python3 SCRIPT apk --no-cache add python3 diff --git a/lxc-build b/lxc-build index 3cfe621..879d2fb 100755 --- a/lxc-build +++ b/lxc-build @@ -81,8 +81,7 @@ def fix_world(): def run_script(): script_filename = os.path.join(LXC_ROOT, layers[-1], 'run.sh') with open(script_filename, 'w') as fd: - fd.write('#!/bin/sh\nset -ev\n') - fd.write(' && '.join([s for s in script])) + fd.write('#!/bin/sh\nset -ev\n\n{}\n'.format('\n'.join(script))) os.chmod(script_filename, 0o700) subprocess.run(['lxc-execute', '-n', image, '--', '/bin/sh', '-lc', '/run.sh'], check=True) os.unlink(script_filename) @@ -93,14 +92,16 @@ def copy_files(src, dst): shutil.copytree(src, dst) with open(lxcfile, 'r') as fd: - recipe = fd.read().splitlines() + recipe = fd.readlines() for line in recipe: + line = line.strip() if line == 'RUN': in_script = False run_script() - elif in_script and line and not line.startswith('#'): - script.append(line) + elif in_script: + if line and not line.startswith('#'): + script.append(line) elif line == 'SCRIPT': script = [] in_script = True @@ -113,7 +114,8 @@ for line in recipe: elif line == 'FIXWORLD': fix_world() elif line.startswith('COPY'): - copy_files(*line.split()[1:2]) + srcdst = line.split() + copy_files(srcdst[1], srcdst[2]) elif line.startswith('MOUNT'): mounts.append(line.split()[1]) rebuild_config()