more fixes
This commit is contained in:
parent
dd955c5e59
commit
824af776d9
@ -1,7 +1,7 @@
|
||||
IMAGE build
|
||||
LAYER shared/alpine
|
||||
LAYER shared/libxml
|
||||
LAYER shared/python2
|
||||
LAYER shared/python3
|
||||
|
||||
SCRIPT
|
||||
apk --no-cache add python3
|
||||
|
14
lxc-build
14
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()
|
||||
|
Loading…
Reference in New Issue
Block a user