This commit is contained in:
Disassembler 2018-09-12 16:12:23 +02:00
parent a25186b5ea
commit d6447bb437
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
3 changed files with 42 additions and 7 deletions

View File

@ -4,8 +4,8 @@ set -e
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))
# Install build scripts # Install build scripts
cp ${SOURCE_DIR}/zz-extra/lxc-build /usr/bin/lxc-build ln -s ${SOURCE_DIR}/zz-extra/lxc-build /usr/bin/lxc-build
cp ${SOURCE_DIR}/zz-extra/fix-apk /usr/bin/fix-apk ln -s ${SOURCE_DIR}/zz-extra/fix-apk /usr/bin/fix-apk
# Build basic Alpine LXC image # Build basic Alpine LXC image
mkdir -p /var/lib/lxc/shared/alpine mkdir -p /var/lib/lxc/shared/alpine

34
zz-extra/fix-apk Normal file
View File

@ -0,0 +1,34 @@
#!/usr/bin/python3
import os
import sys
def fix_installed(layers):
installed = []
for layer in layers[:-1]:
with open(os.path.join(layer, 'lib/apk/db/installed'), 'r') as fd:
buffer = []
for line in df:
if line.startswith('C:'):
buffer = ''.join(buffer)
if buffer not in installed:
installed.append(buffer)
buffer = []
buffer.append(line)
os.makedirs(os.path.join(layers[-1], 'lib/apk/db', 0o755, True))
with open(os.path.join(layers[-1], 'lib/apk/db/installed'), 'w') as fd:
fd.writelines(world_items)
def fix_world(layers):
world = []
for layer in layers[:-1]:
with open(os.path.join(layer, 'etc/apk/world'), 'r') as fd:
for line in fd:
if line in world:
world.append(world)
os.makedirs(os.path.join(layers[-1], 'etc/apk', 0o755, True))
with open(os.path.join(layers[-1], 'etc/apk/world'), 'w') as fd:
fd.writelines(world_items)
fix_installed(sys.argv)
fix_world(sys.argv)

View File

@ -73,7 +73,8 @@ class LXCImage:
script_eof = None script_eof = None
for line in lxcfile: for line in lxcfile:
if script_eof and line == script_eof: if script_eof:
if line == script_eof:
script_eof = None script_eof = None
self.run_script(script) self.run_script(script)
elif in_script: elif in_script: