From 4275f25388f13ffdd69a12c13e37f731c80e5126 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Wed, 4 Oct 2023 10:02:12 -0600 Subject: classes/image-oci-umoci: Replace ":" in image file name The OCI_IMAGE_TAG variable can contain a ":" if the user wants to give the image a name and a tag, as in: OCI_IMAGE_TAG = "${IMAGE_BASENAME}:latest" However, while this is valid for tag name, the ":" is illegal in OCI image file names so replace it with "_" when naming the symlinks Signed-off-by: Joshua Watt Signed-off-by: Bruce Ashfield --- classes/image-oci-umoci.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'classes') diff --git a/classes/image-oci-umoci.inc b/classes/image-oci-umoci.inc index 9ece0404..c77750fb 100644 --- a/classes/image-oci-umoci.inc +++ b/classes/image-oci-umoci.inc @@ -106,6 +106,10 @@ IMAGE_CMD:oci() { fi umoci config --image $image_name:${OCI_IMAGE_TAG} --author ${OCI_IMAGE_AUTHOR_EMAIL} + # OCI_IMAGE_TAG may contain ":", but these are not allowed in OCI file + # names so replace them + image_tag="${@d.getVar("OCI_IMAGE_TAG").replace(":", "_")}" + # make a tar version of the image direcotry # 1) image_name.tar: compatible with oci tar format, blobs and rootfs # are at the top level. Can load directly from something like podman @@ -119,13 +123,13 @@ IMAGE_CMD:oci() { tar -cf "$image_name-dir.tar" "$image_name" # create a convenience symlink - ln -sf "$image_name.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci.tar" - ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci-dir.tar" + ln -sf "$image_name.tar" "${IMAGE_BASENAME}-$image_tag-oci.tar" + ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-$image_tag-oci-dir.tar" fi # We could make this optional, since the bundle is directly runnable via runc rm -rf $image_bundle_name # This is the OCI image directory, which is technically the "image" as specified - ln -sf $image_name ${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci + ln -sf $image_name ${IMAGE_BASENAME}-$image_tag-oci } -- cgit v1.2.3-54-g00ecf