]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
templatepkg: small fix
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 9 Feb 2007 20:51:49 +0000 (20:51 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 9 Feb 2007 20:51:49 +0000 (20:51 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@172 04377dda-e619-0410-9926-eae83683ac58

src/templatepkg

index fb22e624704fce0eb64beb8b0e6bf45c1cdb0b32..84b2ac946e7afe146918fc5f7218929d018d3bd1 100755 (executable)
@@ -33,19 +33,22 @@ function usage {
   echo "usage: $BASENAME <option> <template> [arguments]"
   echo "options:"
   echo ""
-  echo "  -u: update a template acording a jail; arguments:"
+  echo "  -c | --create: create a template from a jail;"
+  echo "  -u | --update: update a template from a jail."
   echo ""
-  echo "      $BASENAME -u <template> [jail-root]"
+  echo "      -c and -u are equivalent and their arguments are:"
   echo ""
-  echo "      (if ommited, jail-root defaults to /)"
+  echo "      $BASENAME -u <template> [jail-root]"
   echo ""
-  echo "  -a: add files into a template; arguments:"
+  echo "  -a | --add: add files into a template; arguments for -a are:"
   echo ""
   echo "      $BASENAME -a <template> <file-name> [jail-root]"
   echo ""
   echo "      file-name: the file or directory to be added"
   echo "      jail-root: the jail under file-name is located"
   echo ""
+  echo "  in all cases, jail-root defaults to / if ommited"
+  echo ""
   exit 1
 
 }
@@ -114,17 +117,16 @@ function template_add {
     if [ -d "$TEMPLATE_BASE.d/$file" ]; then
 
       echo $BASENAME: folder $file already on $TEMPLATE_BASE.d, checking for contents
-      cd $jail/$file
-      for candidate in `find`; do
+
+      cd $jail
+      for candidate in `find $file`; do
         if [ ! -a "$TEMPLATE_BASE.d/$candidate" ]; then
           mkdir -p $TEMPLATE_BASE.d/`dirname $candidate`
-          cp -a $candidate $TEMPLATE_BASE.d/$candidate
-
+          cp -a $jail/$candidate $TEMPLATE_BASE.d/$candidate
           if [ "$TEMPLATES_UNDER_SVN" == "1" ]; then
             ( cd $TEMPLATE_BASE.d && svn add $candidate )
             info_commit="yes"
           fi
-
         fi
       done
 
@@ -164,7 +166,8 @@ fi
 search_template $2 --new
 TEMPLATE="$TEMPLATE_BASE.template"
 
-if [ "$1" == "-u" ] || [ "$1" == "--update" ]; then
+if [ "$1" == "-u" ] || [ "$1" == "--update" ] || \
+   [ "$1" == "-c" ] || [ "$1" == "--create" ]; then
 
   if [ -z "$3" ]; then
     ROOT="/"