From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 01 Aug 2025 11:15:04 +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 1uhlqy-005tlD-0B for lore@lore.pengutronix.de; Fri, 01 Aug 2025 11:15:04 +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 1uhlqx-0005qQ-B2; Fri, 01 Aug 2025 11:15:03 +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 1uhlqu-0005nr-Kg; Fri, 01 Aug 2025 11:15:00 +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 1uhlqu-00BMJT-1U; Fri, 01 Aug 2025 11:15:00 +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 1uhlqu-002Srw-0k; Fri, 01 Aug 2025 11:15:00 +0200 From: Lars Schmidt To: distrokit@pengutronix.de Date: Fri, 1 Aug 2025 11:14:55 +0200 Message-Id: <20250801091456.582976-2-l.schmidt@pengutronix.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250801091456.582976-1-l.schmidt@pengutronix.de> References: <20250731155129.2464376-1-l.schmidt@pengutronix.de> <20250801091456.582976-1-l.schmidt@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [DistroKit] [PATCH 2/3] 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 This inject script just copies from source to target and does not create the target directory. So if the target dir does not exist yet, the injection of files is not happening. Until a ptxdist patch is upstream, this script is copied we will apply the patch here. 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