diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-02-19 15:05:04 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-03-03 09:07:40 +0100 |
commit | 9bf2bbaa735cc634b4ba6581f611ff1a47409f70 (patch) | |
tree | 7eca08ee6c24c8e7ebc31d06b6ba5133cea2011e | |
parent | 8b05c6f0590811dfd1b6448ced3be820d3f9f717 (diff) | |
download | ptxdist-9bf2bbaa735cc634b4ba6581f611ff1a47409f70.tar.gz ptxdist-9bf2bbaa735cc634b4ba6581f611ff1a47409f70.tar.xz |
[newpackage] improve source tree template generation
This patch improves the generation of source tree templates.
- add default "yes" to create a source tree template
- "wizard.sh" isn't mandatory anymore
- use "bash" instead of "sh" to call wizard.sh
- handle packages without version number gracefully;
don't add a "-" after the pacakge name
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rwxr-xr-x | bin/ptxdist | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/bin/ptxdist b/bin/ptxdist index 4a7501005..5557b7be6 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -1143,19 +1143,30 @@ newpackage() { # case "${action}" in src-*) - if [ -d "${PTXDIST_WORKSPACE}/local_src/${package}-${version}" ]; then + local dst="${PTXDIST_WORKSPACE}/local_src/${package}${version:+-${version}}" + + if [ -d "${dst}" ]; then return fi - echo -e -n "\nlocal_src/${package}-${version} does not exist, create? [y/n] " - [ "$(local r; read r; echo "${r}")" = "y" ] || return + echo -e -n "\n${dst#${PTXDIST_WORKSPACE}/} does not exist, create? [Y/n] " + local r + read r + case "${r}" in + y|Y|"") ;; + *) return ;; + esac - mkdir -p "${PTXDIST_WORKSPACE}/local_src/${package}-${version}" + mkdir -p "${dst}" && tar -C "${template_src}" -cf - --exclude .svn . | \ - tar -C "${PTXDIST_WORKSPACE}/local_src/${package}-${version}" -xvf - + tar -C "${dst}" -xvf - && + + if [ \! -e "${dst}/wizard.sh" ]; then + return + fi && - (cd "${PTXDIST_WORKSPACE}/local_src/${package}-${version}" && sh wizard.sh ${package}) - rm -f ${PTXDIST_WORKSPACE}/local_src/${package}-${version}/wizard.sh + ( cd "${dst}" && bash wizard.sh "${package}" ) && + rm -f "${dst}/wizard.sh" "${package}" ;; esac |