From f3b0acd261ed42ee4484c8b9f7098543ff2b663d Mon Sep 17 00:00:00 2001 From: Jon Ringle Date: Wed, 11 Jul 2018 09:17:39 -0400 Subject: image-root-tgz: Add IMAGE_ROOT_TGZ_LABEL option Signed-off-by: Jon Ringle Signed-off-by: Michael Olbrich --- doc/ref_manual.rst | 4 ++++ platforms/image-root-tgz.in | 19 +++++++++++++++++-- rules/image-root-tgz.make | 1 + rules/post/ptxd_make_image_common.make | 3 ++- scripts/lib/ptxd_make_image_archive.sh | 8 ++++++-- scripts/lib/ptxd_make_image_common.sh | 6 ++++++ 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/doc/ref_manual.rst b/doc/ref_manual.rst index 63b0a9ccf..a23a657c7 100644 --- a/doc/ref_manual.rst +++ b/doc/ref_manual.rst @@ -399,6 +399,10 @@ different. conflicting files from multiple images. The created nfsroot directory is ``/nfsroot/``. +``_LABEL`` + This is a tar label to put on an image. This is supported by + ``image-root-tgz`` and images created with the ``image-tgz`` template. + .. _reference_macros: Rule File Macro Reference diff --git a/platforms/image-root-tgz.in b/platforms/image-root-tgz.in index fce1516e7..c325209de 100644 --- a/platforms/image-root-tgz.in +++ b/platforms/image-root-tgz.in @@ -1,7 +1,22 @@ ## SECTION=image -config IMAGE_ROOT_TGZ +menuconfig IMAGE_ROOT_TGZ tristate - prompt "Generate images/root.tgz" + prompt "Generate images/root.tgz " help FIXME + +if IMAGE_ROOT_TGZ + +config IMAGE_ROOT_TGZ_LABEL + string + prompt "label" + help + This string gets expanded to form the label. An empty string produces no label. + For example, this could be set to: + ${PTXCONF_PROJECT_VENDOR}-${PTXCONF_PROJECT}${PTXCONF_PROJECT_VERSION} + + The label on the generate image can be checked with the command: + $ tar --test-label -f images/root.tgz +endif + diff --git a/rules/image-root-tgz.make b/rules/image-root-tgz.make index c93e8c9c0..07a8370cc 100644 --- a/rules/image-root-tgz.make +++ b/rules/image-root-tgz.make @@ -20,6 +20,7 @@ IMAGE_ROOT_TGZ := image-root-tgz IMAGE_ROOT_TGZ_DIR := $(BUILDDIR)/$(IMAGE_ROOT_TGZ) IMAGE_ROOT_TGZ_IMAGE := $(IMAGEDIR)/root.tgz IMAGE_ROOT_TGZ_PKGS = $(PTX_PACKAGES_INSTALL) +IMAGE_ROOT_TGZ_LABEL := $(call remove_quotes, $(PTXCONF_IMAGE_ROOT_TGZ_LABEL)) # ---------------------------------------------------------------------------- # Image diff --git a/rules/post/ptxd_make_image_common.make b/rules/post/ptxd_make_image_common.make index a1a5e7846..8aa8c0afb 100644 --- a/rules/post/ptxd_make_image_common.make +++ b/rules/post/ptxd_make_image_common.make @@ -21,7 +21,8 @@ world/image/env/impl = \ image_env="$(call ptx/escape,$($(1)_ENV))" \ image_pkgs="$(call ptx/escape,$($(1)_PKGS))" \ image_files="$(call ptx/escape,$($(1)_FILES))" \ - image_image="$(call ptx/escape,$($(1)_IMAGE))" + image_image="$(call ptx/escape,$($(1)_IMAGE))" \ + image_label="$(call ptx/escape,$($(1)_LABEL))" world/image/env = \ $(call world/image/env/impl,$(strip $(1))) diff --git a/scripts/lib/ptxd_make_image_archive.sh b/scripts/lib/ptxd_make_image_archive.sh index 650679a2e..e21da5c74 100644 --- a/scripts/lib/ptxd_make_image_archive.sh +++ b/scripts/lib/ptxd_make_image_archive.sh @@ -16,8 +16,12 @@ ptxd_make_image_archive_impl() { ptxd_get_ipkg_files ${image_pkgs} && ptxd_make_image_extract_xpkg_files "${pkg_dir}" && cd "${pkg_dir}" && - echo -e "\nCreating $(ptxd_print_path "${image_image}") ...\n" && - tar -zcf "${image_image}" . && + echo -ne "\nCreating $(ptxd_print_path "${image_image}") " + if [ -n "${image_label}" ]; then + echo -n "with label \"${image_label}\" " + fi + echo -ne "...\n" && + tar ${image_label_args} -zcf "${image_image}" . && rm -r "${pkg_dir}" } export -f ptxd_make_image_archive_impl diff --git a/scripts/lib/ptxd_make_image_common.sh b/scripts/lib/ptxd_make_image_common.sh index 402ff532b..a92544615 100644 --- a/scripts/lib/ptxd_make_image_common.sh +++ b/scripts/lib/ptxd_make_image_common.sh @@ -66,6 +66,12 @@ ptxd_make_image_init() { image_ipkg_repo_dirs=( "${image_repo_dist_dir}" ) fi + if [ -n "${image_label}" ]; then + image_label_args="--label \"${image_label}\"" + else + image_label_args="" + fi + exec 2>&${PTXDIST_FD_LOGERR} } export -f ptxd_make_image_init -- cgit v1.2.3