diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2012-07-03 11:25:46 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2012-07-03 11:27:39 +0200 |
commit | 767974c2335a3cbbed114c678f45de75f9ef48cb (patch) | |
tree | 8c5c02f9f72c8e066bb972d75be45d1e29188573 /scripts/lib/ptxd_lib_template.sh | |
parent | f8dda20b59a5adb515e024a5b62d714483373b0e (diff) | |
download | ptxdist-767974c2335a3cbbed114c678f45de75f9ef48cb.tar.gz ptxdist-767974c2335a3cbbed114c678f45de75f9ef48cb.tar.xz |
ptxd_lib_template: print paths relative to $PWD
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.sh | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh index 079d42aec..06ffca16c 100644 --- a/scripts/lib/ptxd_lib_template.sh +++ b/scripts/lib/ptxd_lib_template.sh @@ -31,6 +31,7 @@ ptxd_template_read() { read -e -p "${prompt}: " "${iargs[@]}" "${2}" && export "${2}" } +export -f ptxd_template_read ptxd_template_read_name() { ptxd_template_read "enter package name" package_name @@ -110,6 +111,14 @@ ptxd_template_read_local() { } export -f ptxd_template_read_local +ptxd_template_print_path() { + if [ $# -ne 1 ]; then + ptxd_bailout "number of arguments must be 1" + fi + echo "${1#${PWD}/}" +} +export -f ptxd_template_print_path + ptxd_template_setup_class() { export AUTOCONF_CLASS="${1}" export class="${action}-" @@ -130,14 +139,14 @@ ptxd_template_filter() { if [ -f "${filename}" ]; then echo local overwrite - read -e -p "${PTXDIST_LOG_PROMPT}warning: ${filename} does already exist, overwrite? [y/n] " overwrite + read -e -p "${PTXDIST_LOG_PROMPT}warning: $(ptxd_template_print_path "${filename}") does already exist, overwrite? [y/n] " overwrite if [ "${overwrite}" != "y" ]; then echo "${PTXDIST_LOG_PROMPT}aborted." echo exit fi fi - echo "generating $(ptxd_print_path ${filename})" + echo "generating $(ptxd_template_print_path ${filename})" mkdir -p "$(dirname "${filename}")" ptxd_replace_magic "${template_file}" > "${filename}" || return } @@ -394,7 +403,7 @@ ptxd_template_new_image_genimage() { local template_file="${TEMPLATESDIR}/${template}-config" local filename="${PTXDIST_PLATFORMCONFIGDIR}/config/images/${CONFIG}" if ptxd_get_alternative config/images "${CONFIG}"; then - echo "using existing config file $(ptxd_print_path ${ptxd_reply})" + echo "using existing config file $(ptxd_template_print_path ${ptxd_reply})" else ptxd_template_filter "${template_file}" "${filename}" fi |