From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: isar-users <isar-users@googlegroups.com>
Cc: "Cirujano-Cuesta, Silvano" <silvano.cirujano-cuesta@siemens.com>
Subject: [PATCH] imagetypes_container: Enable customization of CMD and ENTRYPOINT
Date: Mon, 6 Jan 2025 16:41:48 +0100 [thread overview]
Message-ID: <9c383301-0a7c-471a-9d6d-454fe3a0be16@siemens.com> (raw)
From: Jan Kiszka <jan.kiszka@siemens.com>
Enable recipes to define their own CMD value and also ENTRYPOINT. This
permits to build more commonly useful containers.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/classes/imagetypes_container.bbclass | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/meta/classes/imagetypes_container.bbclass b/meta/classes/imagetypes_container.bbclass
index 862ce197..1a6f3669 100644
--- a/meta/classes/imagetypes_container.bbclass
+++ b/meta/classes/imagetypes_container.bbclass
@@ -1,5 +1,5 @@
# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2021
+# Copyright (C) Siemens AG, 2021-2025
#
# SPDX-License-Identifier: MIT
#
@@ -11,6 +11,8 @@ USING_CONTAINER = "${@bb.utils.contains_any('IMAGE_BASETYPES', d.getVar('CONTAIN
CONTAINER_IMAGE_NAME ?= "${PN}-${DISTRO}-${DISTRO_ARCH}"
CONTAINER_IMAGE_TAG ?= "${PV}-${PR}"
+CONTAINER_IMAGE_CMD ?= "/bin/dash"
+CONTAINER_IMAGE_ENTRYPOINT ?= ""
python() {
if not bb.utils.to_boolean(d.getVar('USING_CONTAINER')):
@@ -24,7 +26,8 @@ python() {
}
do_containerize() {
- local cmd="/bin/dash"
+ local cmd="${CONTAINER_IMAGE_CMD}"
+ local entrypoint="${CONTAINER_IMAGE_ENTRYPOINT}"
local empty_tag="empty"
local tag="${CONTAINER_IMAGE_TAG}"
local oci_img_dir="${WORKDIR}/oci-image"
@@ -35,8 +38,14 @@ do_containerize() {
sudo rm -rf "${oci_img_dir}" "${oci_img_dir}_unpacked"
sudo umoci init --layout "${oci_img_dir}"
sudo umoci new --image "${oci_img_dir}:${empty_tag}"
- sudo umoci config --image "${oci_img_dir}:${empty_tag}" \
- --config.cmd="${cmd}"
+ if [ -n "${cmd}" ]; then
+ sudo umoci config --image "${oci_img_dir}:${empty_tag}" \
+ --config.cmd="${cmd}"
+ fi
+ if [ -n "${entrypoint}" ]; then
+ sudo umoci config --image "${oci_img_dir}:${empty_tag}" \
+ --config.entrypoint="${entrypoint}"
+ fi
sudo umoci unpack --image "${oci_img_dir}:${empty_tag}" \
"${oci_img_dir}_unpacked"
--
2.43.0
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/9c383301-0a7c-471a-9d6d-454fe3a0be16%40siemens.com.
next reply other threads:[~2025-01-06 15:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-06 15:41 'Jan Kiszka' via isar-users [this message]
2025-01-16 7:01 ` Uladzimir Bely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9c383301-0a7c-471a-9d6d-454fe3a0be16@siemens.com \
--to=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=silvano.cirujano-cuesta@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox