summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2023-10-04 10:02:12 -0600
committerBruce Ashfield <bruce.ashfield@gmail.com>2023-11-06 16:21:12 +0000
commit4275f25388f13ffdd69a12c13e37f731c80e5126 (patch)
treecaa0f6c7abad69369b5a03761015ab2817a14fe3 /classes
parentd1d50f9861786ec21d0a0dcc1028dfc3c310300f (diff)
downloadmeta-virtualization-4275f25388f13ffdd69a12c13e37f731c80e5126.tar.gz
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 <JPEWhacker@gmail.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'classes')
-rw-r--r--classes/image-oci-umoci.inc10
1 files changed, 7 insertions, 3 deletions
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() {
106 fi 106 fi
107 umoci config --image $image_name:${OCI_IMAGE_TAG} --author ${OCI_IMAGE_AUTHOR_EMAIL} 107 umoci config --image $image_name:${OCI_IMAGE_TAG} --author ${OCI_IMAGE_AUTHOR_EMAIL}
108 108
109 # OCI_IMAGE_TAG may contain ":", but these are not allowed in OCI file
110 # names so replace them
111 image_tag="${@d.getVar("OCI_IMAGE_TAG").replace(":", "_")}"
112
109 # make a tar version of the image direcotry 113 # make a tar version of the image direcotry
110 # 1) image_name.tar: compatible with oci tar format, blobs and rootfs 114 # 1) image_name.tar: compatible with oci tar format, blobs and rootfs
111 # are at the top level. Can load directly from something like podman 115 # are at the top level. Can load directly from something like podman
@@ -119,13 +123,13 @@ IMAGE_CMD:oci() {
119 tar -cf "$image_name-dir.tar" "$image_name" 123 tar -cf "$image_name-dir.tar" "$image_name"
120 124
121 # create a convenience symlink 125 # create a convenience symlink
122 ln -sf "$image_name.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci.tar" 126 ln -sf "$image_name.tar" "${IMAGE_BASENAME}-$image_tag-oci.tar"
123 ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci-dir.tar" 127 ln -sf "$image_name-dir.tar" "${IMAGE_BASENAME}-$image_tag-oci-dir.tar"
124 fi 128 fi
125 129
126 # We could make this optional, since the bundle is directly runnable via runc 130 # We could make this optional, since the bundle is directly runnable via runc
127 rm -rf $image_bundle_name 131 rm -rf $image_bundle_name
128 132
129 # This is the OCI image directory, which is technically the "image" as specified 133 # This is the OCI image directory, which is technically the "image" as specified
130 ln -sf $image_name ${IMAGE_BASENAME}-${OCI_IMAGE_TAG}-oci 134 ln -sf $image_name ${IMAGE_BASENAME}-$image_tag-oci
131} 135}