]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
templatepkg: added -d option
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 9 Feb 2007 21:59:18 +0000 (21:59 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 9 Feb 2007 21:59:18 +0000 (21:59 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@176 04377dda-e619-0410-9926-eae83683ac58

src/templatepkg

index d2a23aa4268780fbc18c18e3fb81c1a6b9ab9500..1382759413b6612333ee926da8fe118baf60c6b7 100755 (executable)
@@ -47,7 +47,11 @@ function usage {
   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 "  -d | --delete: delete files or folders from a template; arguments are:"
+  echo ""
+  echo "      $BASENAME -d <template> <file-name>"
+  echo ""
+  echo "  in all cases (-c, -u and -a), jail-root defaults to /, if ommited"
   echo ""
   exit 1
 
@@ -192,6 +196,24 @@ elif [ "$1" == "-a" ] || [ "$1" == "--add" ]; then
 
   template_add $ROOT $3
 
+elif [ "$1" == "-d" ] || [ "$1" == "--delete" ]; then
+
+  if [ -z "$3" ]; then
+    usage
+  else
+
+    if [ -a "$TEMPLATE_BASE.d/$3" ]; then
+      if [ "$TEMPLATES_UNDER_SVN" == "1" ]; then
+        cd $TEMPLATE_BASE
+        svn del --force ./$3 || rm -rf ./$3
+        echo $BASENAME: please run jail-commit to del $3 in the svn repository
+      else
+        rm -rf $TEMPLATE_BASE.d/$3
+      fi
+    fi
+
+  fi
+
 else
   usage
 fi