Spotter-VM/build/usr/lib/python3.6/lxcbuild/lxcimage.py

35 lines
891 B
Python

# -*- coding: utf-8 -*-
import os
from .lxcbuilder import LXCBuilder
from .lxcpacker import LXCPacker
class LXCImage:
def __init__(self, build_path):
self.name = None
self.version = None
self.meta = {}
self.layers = []
self.upper_layer = None
self.mounts = []
self.env = []
self.uid = 0
self.gid = 0
self.cmd = None
self.cwd = None
self.halt = None
if os.path.isfile(build_path):
self.lxcfile = os.path.realpath(build_path)
self.build_dir = os.path.dirname(self.lxcfile)
else:
self.build_dir = os.path.realpath(build_path)
self.lxcfile = os.path.join(self.build_dir, 'lxcfile')
def build_and_pack(self):
builder = LXCBuilder(self)
builder.build()
packer = LXCPacker(self)
packer.pack()