diff --git a/Config.in.legacy b/Config.in.legacy index 95b9d784d3..3d5df3abbb 100644 --- a/Config.in.legacy +++ b/Config.in.legacy @@ -195,6 +195,26 @@ config BR2_PACKAGE_BOOST_LAYOUT_VERSIONED comment "Legacy options removed in 2022.02" +config BR2_TARGET_ROOTFS_OCI_ENTRYPOINT_ARGS + string "entrypoint argumetns has been changed as command" + help + The OCI image BR2_TARGET_ROOTFS_OCI_ENTRYPOINT_ARGS option + has been renamed to BR2_TARGET_ROOTFS_OCI_CMD to better + reflect its relation to the actual 'command' of the OCI + image. + + The new semantic for BR2_TARGET_ROOTFS_OCI_CMD is slightly + differnt in relation to how it is interpreted, so be sure to + review the help entry for it. + + Due to this breaking change, the old value here could not be + set to the new variable. + +config BR2_TARGET_ROOTFS_OCI_ENTRYPOINT_ARGS_WRAP + bool + default y if BR2_TARGET_ROOTFS_OCI_ENTRYPOINT_ARGS != "" + select BR2_LEGACY + config BR2_PACKAGE_LIBCURL_LIBNSS bool "libcurl NSS removed" select BR2_LEGACY diff --git a/fs/oci/Config.in b/fs/oci/Config.in index 8f36c91c8f..5e7aff282f 100644 --- a/fs/oci/Config.in +++ b/fs/oci/Config.in @@ -42,10 +42,26 @@ config BR2_TARGET_ROOTFS_OCI_ENTRYPOINT help Command to execute when the container starts. -config BR2_TARGET_ROOTFS_OCI_ENTRYPOINT_ARGS - string "entrypoint arguments" + Spaces must be quoted or escaped, like for a shell string: + /usr/bin/env sh -c + /bin/my-init --some-option "1 2 3 4" some\ arg -- + + See the Docker documentation on how entrypoint and command + interact together: + https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact + +config BR2_TARGET_ROOTFS_OCI_CMD + string "command (or entrypoint arguments)" help - Default arguments to the entrypoint of the container. + Default command, or entrypoint arguments, of the container. + + Spaces must be quoted or escaped, like for a shell string: + "your shell scriptlet" + /usr/bin/env sh + + See the Docker documentation on how entrypoint and command + interact together: + https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact config BR2_TARGET_ROOTFS_OCI_WORKDIR string "working directory" diff --git a/fs/oci/oci.mk b/fs/oci/oci.mk index aa81920d36..4458cf8ef9 100644 --- a/fs/oci/oci.mk +++ b/fs/oci/oci.mk @@ -12,17 +12,23 @@ OCI_SLOCI_IMAGE_OPTS = --arch $(GO_GOARCH) # architecture variant (typically used only for arm) OCI_SLOCI_IMAGE_OPTS += $(and $(GO_GOARM),--arch-variant v$(GO_GOARM)) -# entrypoint -OCI_ENTRYPOINT = $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_ENTRYPOINT)) -ifneq ($(OCI_ENTRYPOINT),) -OCI_SLOCI_IMAGE_OPTS += --entrypoint "$(OCI_ENTRYPOINT)" -endif - -# entrypoint arguments -OCI_ENTRYPOINT_ARGS = $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_ENTRYPOINT_ARGS)) -ifneq ($(OCI_ENTRYPOINT_ARGS),) -OCI_SLOCI_IMAGE_OPTS += --cmd "$(OCI_ENTRYPOINT_ARGS)" -endif +# entrypoint and command +# Special treatment: both the entrypoint and arguments (aka command) are +# a double-quoted, space-separated, escaped-double-quoted string, like: +# "foo \"1 2 3 4\" ' a b c d ' bar\ buz" +# which should be interpreted as a 4-item list (using single quotes to +# delimit them and see leading/trailing spaces): +# 'foo' +# '1 2 3 4' +# ' a b c d ' +# 'bar buz' +# +# We use some trickery to have the shell properly expand this into a list +# where each item is single-quoted and prefixed with the appropriate +# option string: +OCI_SLOCI_IMAGE_OPTS += \ + $(shell eval printf -- "--entrypoint\ \'%s\'\ " $(BR2_TARGET_ROOTFS_OCI_ENTRYPOINT)) \ + $(shell eval printf -- "--cmd\ \'%s\'\ " $(BR2_TARGET_ROOTFS_OCI_CMD)) # author OCI_AUTHOR = $(call qstrip,$(BR2_TARGET_ROOTFS_OCI_AUTHOR))