]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
templatepkg: some fixes
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 5 Apr 2007 21:29:18 +0000 (21:29 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 5 Apr 2007 21:29:18 +0000 (21:29 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@267 04377dda-e619-0410-9926-eae83683ac58

trunk/src/templatepkg

index 6bcd286ab7d97e6c52462b9725e33a86d8aa80b5..912f5918faf610c85b9d981e2767e80580dbc9ca 100755 (executable)
@@ -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
 
 }