aboutsummaryrefslogtreecommitdiff
path: root/trunk/src/templatepkg
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/src/templatepkg')
-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
}