From 9bf2bbaa735cc634b4ba6581f611ff1a47409f70 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 19 Feb 2010 15:05:04 +0100 Subject: [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 --- bin/ptxdist | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'bin') 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 -- cgit v1.2.3