From eed8f5ad968c3af4562075763689b1009ebf71e9 Mon Sep 17 00:00:00 2001 From: rhatto Date: Thu, 5 Apr 2007 21:29:18 +0000 Subject: templatepkg: some fixes git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@267 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/templatepkg | 54 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 15 deletions(-) (limited to 'trunk') diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg index 6bcd286..912f591 100755 --- a/trunk/src/templatepkg +++ b/trunk/src/templatepkg @@ -167,7 +167,7 @@ function template_create { # create a new template - local template_base info_commit orig_template + local template_base info_commit orig_template list if [ ! -d "`dirname $TEMPLATE_BASE`" ]; then @@ -245,15 +245,39 @@ function template_create { cat $orig_template/$ROOT.template > $TEMPLATE_BASE.template if use_svn && [ -d "$orig_template/.svn" ]; then - rsync -av --exclude=.svn $orig_template/$ROOT.d/ $TEMPLATE_BASE.d/ - rsync -av --exclude=.svn $orig_template/$ROOT.s/ $TEMPLATE_BASE.s/ + cd `dirname $TEMPLATE_BASE` - svn add `basename $TEMPLATE_BASE`.d/* - svn add `basename $TEMPLATE_BASE`.s/* - info_commit="yes" + + list="`ls $orig_template/$ROOT.d/ 2> /dev/null`" + if [ ! -z "$list" ]; then + echo Copying files to the new template... + rsync -av --exclude=.svn $orig_template/$ROOT.d/ $TEMPLATE_BASE.d/ + svn add `basename $TEMPLATE_BASE`.d/* + info_commit="yes" + fi + + list="`ls $orig_template/$ROOT.s/ 2> /dev/null`" + if [ ! -z "$list" ]; then + echo Copying scripts to the new template... + rsync -av --exclude=.svn $orig_template/$ROOT.s/ $TEMPLATE_BASE.s/ + svn add `basename $TEMPLATE_BASE`.s/* + info_commit="yes" + fi + else - rsync -av $orig_template/$ROOT.d/ $TEMPLATE_BASE.d/ - rsync -av $orig_template/$ROOT.d/ $TEMPLATE_BASE.s/ + + list="`ls $orig_template/$ROOT.d/ 2> /dev/null`" + if [ ! -z "$list" ]; then + echo Copying files to the new template... + rsync -av $orig_template/$ROOT.d/ $TEMPLATE_BASE.d/ + fi + + list="`ls $orig_template/$ROOT.s/ 2> /dev/null`" + if [ ! -z "$list" ]; then + echo Copying scripts to the new template... + rsync -av $orig_template/$ROOT.s/ $TEMPLATE_BASE.s/ + fi + fi else @@ -489,18 +513,18 @@ function template_list { # list templates # usage: template_list [template_name] - local ls + local list - ls="`ls $BASE_CONF/defaults/templates/$1 2> /dev/null`" + list="`ls $BASE_CONF/defaults/templates/$1 2> /dev/null`" if [ "$?" == "0" ]; then - ls="`echo $ls | xargs`" - echo "Default templates: $ls" + list="`echo $list | xargs`" + echo "Default templates: $list" fi - ls="`ls $BASE_CONF/templates/$1 2> /dev/null`" + list="`ls $BASE_CONF/templates/$1 2> /dev/null`" if [ "$?" == "0" ]; then - ls="`echo $ls | xargs`" - echo "Custom templates: $ls" + list="`echo $list | xargs`" + echo "Custom templates: $list" fi } -- cgit v1.2.3