summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2022-03-04 13:31:56 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2022-03-04 13:34:57 +0100
commit3694633183ae70aeba062d53db3eeb4bf521d090 (patch)
treefa3ba26f5f045e232596ec3ebb807574ce0ded87 /scripts
parent56410abcee8d52a26797ed089749c84eb4ad1213 (diff)
downloadptxdist-3694633183ae70aeba062d53db3eeb4bf521d090.tar.gz
ptxdist-3694633183ae70aeba062d53db3eeb4bf521d090.tar.xz
rules: introduce new macros to install files to images/
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_make_install_image.sh48
-rw-r--r--scripts/lib/ptxd_make_world_clean.sh22
2 files changed, 70 insertions, 0 deletions
diff --git a/scripts/lib/ptxd_make_install_image.sh b/scripts/lib/ptxd_make_install_image.sh
new file mode 100644
index 000000000..c447d8c47
--- /dev/null
+++ b/scripts/lib/ptxd_make_install_image.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# Copyright (C) 2013 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+
+ptxd_make_image_install_record() {
+ (
+ if [ -e "${pkg_image_stamp}" ]; then
+ grep -v "^${pkg_image}$" "${pkg_image_stamp}"
+ fi
+ echo "${pkg_image}"
+ ) > "${pkg_image_stamp}.tmp" &&
+ mv "${pkg_image_stamp}.tmp" "${pkg_image_stamp}"
+}
+export -f ptxd_make_image_install_record
+
+ptxd_make_image_install() {
+ ptxd_make_world_init || return
+ local pkg_image_stamp="${ptx_state_dir}/${pkg_label}.images"
+
+ if [ -z "${pkg_image}" ]; then
+ pkg_image="$(basename "${pkg_file}")"
+ fi
+ pkg_image="${ptx_image_dir}/${pkg_image}"
+
+ echo "Installing '$(ptxd_print_path "${pkg_file}")' to '$(ptxd_print_path "${pkg_image}")'"
+
+ install -D -m644 "${pkg_file}" "${pkg_image}" &&
+ ptxd_make_image_install_record
+}
+export -f ptxd_make_image_install
+
+ptxd_make_image_install_link() {
+ ptxd_make_world_init || return
+ local pkg_image_stamp="${ptx_state_dir}/${pkg_label}.images"
+
+ pkg_image="${ptx_image_dir}/${pkg_image}"
+
+ echo "Linking '${pkg_file}' to '$(ptxd_print_path "${pkg_image}")'"
+
+ ln -sf "${pkg_file}" "${pkg_image}" &&
+ ptxd_make_image_install_record
+}
+export -f ptxd_make_image_install_link
diff --git a/scripts/lib/ptxd_make_world_clean.sh b/scripts/lib/ptxd_make_world_clean.sh
index 2fc8170e7..fa54be600 100644
--- a/scripts/lib/ptxd_make_world_clean.sh
+++ b/scripts/lib/ptxd_make_world_clean.sh
@@ -32,6 +32,27 @@ ptxd_make_world_clean_sysroot() {
}
export -f ptxd_make_world_clean_sysroot
+ptxd_make_world_image_clean_impl() {
+ local pkg_image_stamp="${ptx_state_dir}/${pkg_label}.images"
+
+ if [ -e "${pkg_image_stamp}" ]; then
+ echo "Deleting images:"
+ while read file; do
+ echo "${file}"
+ rm "${file}" || break
+ done < "${pkg_image_stamp}"
+ rm "${pkg_image_stamp}"
+ echo
+ fi
+}
+export -f ptxd_make_world_image_clean_impl
+
+ptxd_make_world_image_clean() {
+ ptxd_make_world_init &&
+ ptxd_make_world_image_clean_impl
+}
+export -f ptxd_make_world_image_clean
+
#
# clean
#
@@ -46,6 +67,7 @@ ptxd_make_world_clean() {
done
echo
fi
+ ptxd_make_world_image_clean_impl
if [ -n "$(ls "${ptx_state_dir}/${pkg_label}".* 2> /dev/null)" ]; then
echo "Deleting stage files:"
if [ -e "${pkg_xpkg_map}" ]; then