forked from sig_core/toolkit
add rpi image
This commit is contained in:
parent
4bf7f6673d
commit
435206c1ca
@ -108,7 +108,8 @@ ALLOWED_TYPE_VARIANTS = {
|
|||||||
"EC2": ["Base", "LVM"],
|
"EC2": ["Base", "LVM"],
|
||||||
"GenericCloud": ["Base", "LVM"],
|
"GenericCloud": ["Base", "LVM"],
|
||||||
"Vagrant": ["Libvirt", "Vbox", "VMware"],
|
"Vagrant": ["Libvirt", "Vbox", "VMware"],
|
||||||
"OCP": None
|
"OCP": None,
|
||||||
|
"RPI": None,
|
||||||
}
|
}
|
||||||
def valid_type_variant(_type: str, variant: str="") -> bool:
|
def valid_type_variant(_type: str, variant: str="") -> bool:
|
||||||
if _type not in ALLOWED_TYPE_VARIANTS:
|
if _type not in ALLOWED_TYPE_VARIANTS:
|
||||||
|
@ -107,6 +107,11 @@ class ImageBuild:
|
|||||||
["tar", "-C", f"{self.outdir}", "--strip-components=1", "-x", "-f", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", "*/layer.tar"],
|
["tar", "-C", f"{self.outdir}", "--strip-components=1", "-x", "-f", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", "*/layer.tar"],
|
||||||
["xz", f"{self.outdir}/layer.tar"]
|
["xz", f"{self.outdir}/layer.tar"]
|
||||||
]
|
]
|
||||||
|
if self.image_type in ["RPI"]:
|
||||||
|
self.stage_commands = [
|
||||||
|
["tar", "-C", f"{self.outdir}", "--strip-components=1", "-x", "-f", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", "*/layer.tar"],
|
||||||
|
["xz", f"{self.outdir}/layer.tar"]
|
||||||
|
]
|
||||||
if self.image_type in ["GenericCloud", "OCP"]:
|
if self.image_type in ["GenericCloud", "OCP"]:
|
||||||
self.stage_commands = [
|
self.stage_commands = [
|
||||||
["qemu-img", "convert", "-c", "-f", "raw", "-O", "qcow2", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", f"{self.outdir}/{self.outname}.qcow2"]
|
["qemu-img", "convert", "-c", "-f", "raw", "-O", "qcow2", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", f"{self.outdir}/{self.outname}.qcow2"]
|
||||||
@ -192,13 +197,13 @@ class ImageBuild:
|
|||||||
return [param for name, param in args_mapping.items() if getattr(self.cli_args, name)]
|
return [param for name, param in args_mapping.items() if getattr(self.cli_args, name)]
|
||||||
|
|
||||||
def _package_args(self) -> List[str]:
|
def _package_args(self) -> List[str]:
|
||||||
if self.image_type == "Container":
|
if self.image_type in ["Container", "RPI"]:
|
||||||
return ["--parameter", "compress", "xz"]
|
return ["--parameter", "compress", "xz"]
|
||||||
return [""]
|
return [""]
|
||||||
|
|
||||||
def _common_args(self) -> List[str]:
|
def _common_args(self) -> List[str]:
|
||||||
args = []
|
args = []
|
||||||
if self.image_type == "Container":
|
if self.image_type in ["Container", "RPI"]:
|
||||||
args = ["--parameter", "offline_icicle", "true"]
|
args = ["--parameter", "offline_icicle", "true"]
|
||||||
if self.image_type in ["GenericCloud", "EC2", "Vagrant", "Azure", "OCP"]:
|
if self.image_type in ["GenericCloud", "EC2", "Vagrant", "Azure", "OCP"]:
|
||||||
args = ["--parameter", "generate_icicle", "false"]
|
args = ["--parameter", "generate_icicle", "false"]
|
||||||
@ -206,7 +211,8 @@ class ImageBuild:
|
|||||||
|
|
||||||
def image_format(self) -> str:
|
def image_format(self) -> str:
|
||||||
mapping = {
|
mapping = {
|
||||||
"Container": "docker"
|
"Container": "docker",
|
||||||
|
"RPI": "docker"
|
||||||
}
|
}
|
||||||
return mapping[self.image_type] if self.image_type in mapping.keys() else ''
|
return mapping[self.image_type] if self.image_type in mapping.keys() else ''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user