buildextend-installer: require metal4k image for live build
In practice it's required for all release images, and we've forgotten
about this before:
This increases build time for local development, but improves the
consistency of build artifacts and reduces code complexity a bit.
@@ -149,17 +149,19 @@ def generate_iso():
initramfs_img = 'initramfs.img'
tmpisofile = os.path.join(tmpdir, iso_name)
- img_metal_obj = buildmeta['images'].get('metal')
- if img_metal_obj is None:
- raise Exception("ISO generation requires `metal` image")
-
- img_metal = os.path.join(builddir, img_metal_obj['path'])
- img_metal_checksum = img_metal_obj['sha256']
+ img_metal_obj = buildmeta['images'].get('metal')
img_metal4k_obj = buildmeta['images'].get('metal4k')
- if img_metal4k_obj is not None:
+ if is_live:
+ if img_metal_obj is None or img_metal4k_obj is None:
+ raise Exception("Live image generation requires `metal` and `metal4k` images")
img_metal4k = os.path.join(builddir, img_metal4k_obj['path'])
img_metal4k_checksum = img_metal4k_obj['sha256']
+ else:
+ if img_metal_obj is None:
+ raise Exception("ISO image generation requires `metal` image")
+ img_metal = os.path.join(builddir, img_metal_obj['path'])
+ img_metal_checksum = img_metal_obj['sha256']
# Find the directory under `/usr/lib/modules/<kver>` where the
# kernel/initrd live. It will be the 2nd entity output by
@@ -190,15 +192,13 @@ def generate_iso():
# Add osmet files
if is_live:
tmp_osmet = os.path.join(tmpinitrd_base, img_metal_obj['path'] + '.osmet')
+ tmp_osmet4k = os.path.join(tmpinitrd_base, img_metal4k_obj['path'] + '.osmet')
print(f'Generating osmet file for 512b metal image')
run_verbose(['/usr/lib/coreos-assembler/osmet-pack',
img_metal, '512', tmp_osmet, img_metal_checksum])
- if img_metal4k_obj is not None:
- tmp_osmet4k = os.path.join(tmpinitrd_base, img_metal4k_obj['path'] + '.osmet')
print(f'Generating osmet file for 4k metal image')
run_verbose(['/usr/lib/coreos-assembler/osmet-pack',
- img_metal4k, '4096', tmp_osmet4k,
- img_metal4k_checksum])
+ img_metal4k, '4096', tmp_osmet4k, img_metal4k_checksum])
# Generate root squashfs
tmp_squashfs = None
