summaryrefslogtreecommitdiffstats
path: root/scripts/lib/ptxd_lib_template.sh
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2014-03-05 10:05:53 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2014-03-07 14:19:42 +0100
commitfc9a429819b420faecf5fc2fec19d3f7c4b1da9e (patch)
tree238f583c4ae92fc23ca18d877d79f1501b088d5b /scripts/lib/ptxd_lib_template.sh
parent0537557ae85c297bf7f60039cf9560dc45bfb4e5 (diff)
downloadptxdist-fc9a429819b420faecf5fc2fec19d3f7c4b1da9e.tar.gz
ptxdist-fc9a429819b420faecf5fc2fec19d3f7c4b1da9e.tar.xz
templates: allow overwriting template files in the BSP
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/lib/ptxd_lib_template.sh')
-rw-r--r--scripts/lib/ptxd_lib_template.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh
index 5204b3aa5..3c0529b95 100644
--- a/scripts/lib/ptxd_lib_template.sh
+++ b/scripts/lib/ptxd_lib_template.sh
@@ -152,11 +152,19 @@ ptxd_template_filter() {
}
export -f ptxd_template_filter
+ptxd_template_file() {
+ if ! ptxd_in_path PTXDIST_PATH_TEMPLATES "${1}"; then
+ ptxd_bailout "Failed to find '${1}' in '${PTXDIST_PATH_TEMPLATES}'!"
+ fi
+ echo "${ptxd_reply}"
+}
+export -f ptxd_template_file
+
ptxd_template_write_rules() {
local template_suffix
echo
for template_suffix in "make" "in"; do
- local template_file="${TEMPLATESDIR}/${template}-${template_suffix}"
+ local template_file="$(ptxd_template_file "${template}-${template_suffix}")"
local filename="${PTXDIST_WORKSPACE}/rules/${class}${package_filename}.${template_suffix}"
ptxd_template_filter "${template_file}" "${filename}"
done
@@ -167,11 +175,11 @@ ptxd_template_write_platform_rules() {
local template_file filename
echo
- template_file="${TEMPLATESDIR}/${template}-make"
+ template_file="$(ptxd_template_file "${template}-make")"
filename="${PTXDIST_PLATFORMCONFIGDIR}/rules/${class}${package_filename}.make"
ptxd_template_filter "${template_file}" "${filename}"
- template_file="${TEMPLATESDIR}/${template}-in"
+ template_file="$(ptxd_template_file "${template}-in")"
filename="${PTXDIST_PLATFORMCONFIGDIR}/platforms/${class}${package_filename}.in"
ptxd_template_filter "${template_file}" "${filename}"
}
@@ -179,6 +187,7 @@ export -f ptxd_template_write_rules
ptxd_template_write_src() {
local dst="${PTXDIST_WORKSPACE}/local_src/${package}"
+ local template_src
if [ -d "${dst}" ]; then
return
@@ -192,6 +201,7 @@ ptxd_template_write_src() {
*) return ;;
esac
+ template_src="$(ptxd_template_file "${action}")" &&
mkdir -p "${dst}" &&
tar -C "${template_src}" -cf - --exclude .svn . | \
tar -C "${dst}" -xvf - &&
@@ -223,7 +233,6 @@ ptxd_template_new() {
(
export action="${1}"
export template="template-${action}"
- export template_src="${RULESDIR}/templates/${action}"
export YEAR="$(date +%Y)"
local func="ptxd_template_new_${action//-/_}"
@@ -414,7 +423,7 @@ ptxd_template_new_image_genimage() {
ptxd_template_read "add archives" FILES "\$(IMAGEDIR)/root.tgz"
ptxd_template_read "genimage config" CONFIG "${package_name}.config"
ptxd_template_write_platform_rules
- local template_file="${TEMPLATESDIR}/${template}-config"
+ local template_file="$(ptxd_template_file "${template}-config")"
local filename="${PTXDIST_PLATFORMCONFIGDIR}/config/images/${CONFIG}"
if ptxd_get_alternative config/images "${CONFIG}"; then
echo "using existing config file $(ptxd_template_print_path ${ptxd_reply})"