From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 01 Aug 2025 14:01:54 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uhoSQ-005vyk-33 for lore@lore.pengutronix.de; Fri, 01 Aug 2025 14:01:54 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1uhoSQ-0004x8-8d; Fri, 01 Aug 2025 14:01:54 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uhoSM-0004wf-Pz; Fri, 01 Aug 2025 14:01:50 +0200 Received: from dude06.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::5c]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uhoSM-00BNMG-1z; Fri, 01 Aug 2025 14:01:50 +0200 Received: from localhost ([::1] helo=dude06.red.stw.pengutronix.de) by dude06.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1uhoSM-00419k-1f; Fri, 01 Aug 2025 14:01:50 +0200 From: Lars Schmidt To: distrokit@pengutronix.de Date: Fri, 1 Aug 2025 14:01:31 +0200 Message-Id: <20250801120132.956876-1-l.schmidt@pengutronix.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250801-yoga-tamale-cc41d69ec18e@thorsis.com> References: <20250801-yoga-tamale-cc41d69ec18e@thorsis.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [DistroKit] [PATCH 1/2] script: add ptxd_make_world_inject from ptxdist X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lars Schmidt Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false Copy the script from ptxdist v2025.07.0 as preparation for upcoming changes. Signed-off-by: Lars Schmidt --- scripts/lib/ptxd_make_world_inject.sh | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 scripts/lib/ptxd_make_world_inject.sh diff --git a/scripts/lib/ptxd_make_world_inject.sh b/scripts/lib/ptxd_make_world_inject.sh new file mode 100644 index 0000000..e8e94fb --- /dev/null +++ b/scripts/lib/ptxd_make_world_inject.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Copyright (C) 2021 by Michael Riesch +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +ptxd_make_inject() { + local source target + + source="$(echo ${inject_file} | cut -d ":" -f 1)" + target="${inject_dest}/$(echo ${inject_file} | cut -d ":" -f 2)" + + if [[ "${source}" =~ ^/.* ]]; then + ptxd_bailout "'${source}' must not be an absolute path!" \ + "Use _INJECT_PATH to specify the search path." + fi + + if ! ptxd_in_path pkg_inject_path "${source}"; then + ptxd_bailout "Blob '${source}' not found in '${pkg_inject_path}'." + fi + source="${ptxd_reply}" + + echo -e "\nInject file $(ptxd_print_path ${source}) into" \ + "$(ptxd_print_path ${target})..." + cp ${source} ${target} +} +export -f ptxd_make_inject + + +ptxd_make_world_inject() { + ptxd_make_world_init || return + + if [ -z "${pkg_inject_oot}" ]; then + pkg_inject_oot=NO + fi + + case "${pkg_inject_oot}" in + "YES") inject_dest="${pkg_build_dir}" ;; + "NO") inject_dest="${pkg_dir}" ;; + *) ptxd_bailout "_INJECT_OOT: please set to YES or NO" ;; + esac + + if [ "${pkg_build_oot:-NO}" = 'NO' ] && [ "${pkg_inject_oot}" != 'NO' ]; then + ptxd_warning "_BUILD_OOT and _INJECT_OOT contradict each other." \ + "Using $(ptxd_print_path ${inject_dest}) as inject destination anyways." + fi + + if [ ! -d "${inject_dest}" ]; then + ptxd_bailout " inject destination dir missing." \ + "Correct placement of world/inject depends on _BUILD_OOT and _INJECT_OOT." \ + "Check order of calls in prepare stage!" + fi + + for inject_file in ${pkg_inject_files}; do + ptxd_make_inject || return + done +} +export -f ptxd_make_world_inject -- 2.39.5