aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-04-05 21:29:18 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-04-05 21:29:18 +0000
commiteed8f5ad968c3af4562075763689b1009ebf71e9 (patch)
treebc4ac37ae4801fb33606b22af6269c87d7660453
parentfb31cf4ed341efd572a175106a199ef152fc6220 (diff)
downloadsimplepkg-eed8f5ad968c3af4562075763689b1009ebf71e9.tar.gz
simplepkg-eed8f5ad968c3af4562075763689b1009ebf71e9.tar.bz2
templatepkg: some fixes
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@267 04377dda-e619-0410-9926-eae83683ac58
-rwxr-xr-xtrunk/src/templatepkg54
1 files changed, 39 insertions, 15 deletions
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
}