From 43c8962b0f592ada78a9382199de404062b8f28f Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 6 Sep 2018 09:41:40 +0200 Subject: [PATCH] fix vars --- lxc-build | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lxc-build b/lxc-build index 1652f73..c4c0ef3 100755 --- a/lxc-build +++ b/lxc-build @@ -49,10 +49,10 @@ class LXCImage: if os.path.isfile(build_path): self.lxcfile = os.path.realpath(build_path) - self.build_context = os.path.dirname(lxcfile) + self.build_dir = os.path.dirname(self.lxcfile) else: - self.build_context = os.path.realpath(build_path) - self.lxcfile = os.path.join(build_context, 'lxcfile') + self.build_dir = os.path.realpath(build_path) + self.lxcfile = os.path.join(self.build_dir, 'lxcfile') def build(self): with open(self.lxcfile, 'r') as fd: @@ -89,12 +89,12 @@ class LXCImage: self.add_layer('{}/delta0'.format(self.name)) def rebuild_config(self): - if len(layers) == 1: + if len(self.layers) == 1: rootfs_path = layers[0] else: # Multiple lower overlayfs layers are ordered from right to left (lower2:lower1:rootfs:upper) - rootfs_path = 'overlay:{}:{}'.format(':'.join(layers[:-1][::-1], layers[-1])) - mount_entries = '\n'.join(['lxc.mount.entry = {} none bind 0 0'.format(m) for m in mounts]) + rootfs_path = 'overlay:{}:{}'.format(':'.join(self.layers[:-1][::-1], self.layers[-1])) + mount_entries = '\n'.join(['lxc.mount.entry = {} none bind 0 0'.format(m) for m in self.mounts]) with open(os.path.join(LXC_ROOT, self.name, 'config'), 'w') as fd: fd.write(CONFIG_TEMPLATE.format(name=self.name, rootfs=rootfs_path, mounts=mount_entries, uid=self.uid, gid=self.gid, cmd=self.cmd)) @@ -118,7 +118,7 @@ class LXCImage: self.rebuild_config() def copy_files(self, src, dst): - src = os.path.join(build_context, src) + src = os.path.join(build_dir, src) dst = os.path.join(layers[-1], dst) copy_tree(src, dst)