public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH] imagetypes_container: Enable customization of CMD and ENTRYPOINT
Date: Thu, 16 Jan 2025 10:01:41 +0300	[thread overview]
Message-ID: <4ed31e979ba932719cf9131b759e579176abd09f.camel@ilbers.de> (raw)
In-Reply-To: <9c383301-0a7c-471a-9d6d-454fe3a0be16@siemens.com>

On Mon, 2025-01-06 at 16:41 +0100, 'Jan Kiszka' via isar-users wrote:
> 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
> 

Applied to next, thanks.

-- 
Best regards,
Uladzimir.

-- 
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/4ed31e979ba932719cf9131b759e579176abd09f.camel%40ilbers.de.

      reply	other threads:[~2025-01-16  7:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-06 15:41 'Jan Kiszka' via isar-users
2025-01-16  7:01 ` Uladzimir Bely [this message]

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=4ed31e979ba932719cf9131b759e579176abd09f.camel@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@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