diff options
author | Daniil Baturin <daniil@vyos.io> | 2024-04-25 13:17:52 +0000 |
---|---|---|
committer | Daniil Baturin <daniil@vyos.io> | 2024-04-25 13:17:52 +0000 |
commit | f6b0809f47691a8c21718c4256d99b40c73c1564 (patch) | |
tree | 7e5a69c1e831ed527234cdf32f8134c4fb7e55cc | |
parent | 53c3486d46e247a059bfe6131a93a07a708a99b8 (diff) | |
download | vyos-build-f6b0809f47691a8c21718c4256d99b40c73c1564.tar.gz vyos-build-f6b0809f47691a8c21718c4256d99b40c73c1564.zip |
build: T3664: typo fixes and small refactoring
-rwxr-xr-x | scripts/image-build/build-vyos-image | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/scripts/image-build/build-vyos-image b/scripts/image-build/build-vyos-image index f9544054..2295df1f 100755 --- a/scripts/image-build/build-vyos-image +++ b/scripts/image-build/build-vyos-image @@ -68,7 +68,7 @@ except Exception as e: # so that we can import modules from it. VYOS1X_DIR = os.path.join(os.getcwd(), 'packages/vyos-1x/python') if not os.path.exists(VYOS1X_DIR): - print("E: vyos-1x subdirectory does not exist, did git submodules fail to initialize?") + print("E: packages/vyos-1x subdirectory does not exist, did git submodules fail to initialize?") else: sys.path.append(VYOS1X_DIR) @@ -327,7 +327,7 @@ if __name__ == "__main__": if "boot_settings" not in build_config: build_config["boot_settings"] = defaults.boot_settings else: - build_config["boot_settings"] = merge_dicts(defaults.default_consolede, build_config["boot_settings"]) + build_config["boot_settings"] = merge_dicts(defaults.boot_settings, build_config["boot_settings"]) ## Convert the image_format field to a single-item list if it's a scalar ## (like `image_format = "iso"`) @@ -607,15 +607,17 @@ if __name__ == "__main__": if build_config["image_format"] != ["iso"]: raw_image = raw_image.create_raw_image(build_config, iso_file, "tmp/") - other_formats = filter(lambda x: x not in ["iso", "raw"], build_config["image_format"]) - for f in other_formats: - target = f"{os.path.splitext(raw_image)[0]}.{f}" - print(f"I: building {f} file {target}") - os.system(f"qemu-img convert -f raw -O {f} {raw_image} {target}") - - # Some flavors require special procedures that aren't covered by qemu-img - # (most notable, the VMware OVA that requires a custom tool to make and sign the image). - # Such procedures are executed as post-build hooks. if has_nonempty_key(build_config, "post_build_hook"): + # Some flavors require special procedures that aren't covered by qemu-img + # (most notably, the VMware OVA that requires a custom tool to make and sign the image). + # For those cases, we support running a post-build hook on the raw image. + # The image_format field should be 'raw' if a post-build hook is used. hook_path = build_config["post_build_hook"] os.system(f"{hook_path} {raw_image}") + else: + # Most other formats, thankfully, can be produced with just `qemu-img convert` + other_formats = filter(lambda x: x not in ["iso", "raw"], build_config["image_format"]) + for f in other_formats: + target = f"{os.path.splitext(raw_image)[0]}.{f}" + print(f"I: Building {f} file {target}") + os.system(f"qemu-img convert -f raw -O {f} {raw_image} {target}") |