]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
changes in templatepkg: --delete now can remove files from the jail
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 5 May 2007 01:21:56 +0000 (01:21 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 5 May 2007 01:21:56 +0000 (01:21 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@367 04377dda-e619-0410-9926-eae83683ac58

trunk/doc/CHANGELOG
trunk/simplepkg.SlackBuild
trunk/src/templatepkg

index d3420044f4ea06b31744d684c58ded0e2a140288..bd570871726925cdb13fe83e1600586be567712f 100644 (file)
@@ -1,6 +1,12 @@
 simplepkg changelog
 ===================
 
+0.5pre21
+========
+
+  - templatepkg:
+    - now --delete can also remove the file from a jail
+
 0.5pre20
 ========
 
index ca4184a1fb67f6bf164ec87a92bc2456566d57d4..4b088d4fb5d374a8ce8809a2de51ba2a1302aab0 100755 (executable)
@@ -6,7 +6,7 @@
 PACKAGE="simplepkg"
 PACK_DIR="package-$PACKAGE"
 BUILD=${BUILD:=1rha}
-VERSION="0.5pre20"
+VERSION="0.5pre21"
 ARCH="noarch"
 LIBEXEC="/usr/libexec/$PACKAGE"
 BINDIR="/usr/bin"
index f56dc95d472b9076f553ff7bbce5f5bbbfa14990..4f2592f0e5168c607cdc87fa43eea4b7131939eb 100755 (executable)
@@ -91,7 +91,10 @@ function display_help {
       echo "      jail-root: the jail under file-name is located"
       ;;
     "-d" | "--delete")
-      echo "      $BASENAME $option <template> <file-name>"
+      echo "      $BASENAME $option <template> <file-name> [jail-root]"
+      echo ""
+      echo "      file-name: the file or directory to be removed"
+      echo "      jail-root: if specified, the file is also removed from the jail"
       ;;
     "-s" | "--sync")
       echo "      $BASENAME $option"
@@ -358,7 +361,7 @@ function template_create {
   fi
 
   if [ "$info_commit" == "yes" ] && [ -z "$SILENT" ]; then
-    echo "$BASENAME: please run 'jail-commit --all' to add files under $file into the svn repository"
+    echo "Please run 'jail-commit --all' to add files under $file into the svn repository"
   fi
 
 }
@@ -461,7 +464,7 @@ function template_add {
       done
 
       if [ "$info_commit" == "yes" ] && [ -z "$SILENT" ]; then
-        echo "$BASENAME: please run 'jail-commit --all' to add files under `slash $file` into the svn repository"
+        echo "Please run 'jail-commit --all' to add files under `slash $file` into the svn repository"
       fi
 
     else
@@ -491,7 +494,7 @@ function template_add {
           echo $BASENAME: error adding `slash $candidate` into the revision system
         else
           if [ -z "$SILENT" ]; then
-            echo "$BASENAME: please run 'jail-commit --all' to add `slash $file` into the svn repository"
+            echo "Please run 'jail-commit --all' to add `slash $file` into the svn repository"
           fi
         fi
 
@@ -558,7 +561,7 @@ function check_template_exist {
   done
 
   if [ "$info_commit" == "yes" ] && [ -z "$SILENT" ]; then
-    echo "$BASENAME: please run 'jail-commit --all' to add new files in the svn repository"
+    echo "Please run 'jail-commit --all' to add new files in the svn repository"
   fi  
 
 }
@@ -566,25 +569,40 @@ function check_template_exist {
 function template_delete {
 
   # delete a file from a template
-  # usage: template_delete <file>
+  # usage: template_delete <file> [jail-root]
 
   if [ -e "$TEMPLATE_BASE.d/$1" ]; then
+
+    # first try to remove the file from the template
     if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then
       cd $TEMPLATE_BASE.d
       svn del --force ./$1 || rm -rf ./$1
       if [ -z "$SILENT" ]; then
-        echo "$BASENAME: please run 'jail-commit --all' to del $1 in the svn repository"
+        echo "Please run 'jail-commit --all' to del $1 in the svn repository"
       fi
     else
       rm -rf $TEMPLATE_BASE.d/$1
       echo Removed $1 from $TEMPLATE_BASE.d
     fi
+
+    # then, if requested, remove the file from the jail
+    if [ ! -z "$2" ]; then
+      if [ ! -d "$2" ]; then
+        echo $BASENAME: jail not found: $2
+      elif [ -e "$2/$1" ]; then
+        rm -rf $2/$1
+        echo Removed $1 from jail $2
+      else
+        echo $BASENAME: file not found: $2/$1
+      fi
+    fi
+
   elif [ -e "$TEMPLATE_BASE.s/$1" ]; then
     if use_svn && [ -d "$TEMPLATE_BASE.s/.svn" ]; then
       cd $TEMPLATE_BASE.s
       svn del --force ./$1 || rm -rf ./$1
       if [ -z "$SILENT" ]; then
-        echo "$BASENAME: please run 'jail-commit --all' to del $1 in the svn repository"
+        echo "Please run 'jail-commit --all' to del $1 in the svn repository"
       fi
     else
       rm -rf $TEMPLATE_BASE.s/$1
@@ -705,7 +723,7 @@ function template_post_install_edit {
     fi
     if [ "$sha1sum" != "`sha1sum $TEMPLATE_BASE.s/$1`" ] && \
        [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then
-      echo "$BASENAME: please run 'jail-commit --all' to send changes to the repository"
+      echo "Please run 'jail-commit --all' to send changes to the repository"
     fi    
   else
 
@@ -722,7 +740,7 @@ function template_post_install_edit {
         cd $TEMPLATE_BASE.s
         svn add $1
         if [ -z "$SILENT" ]; then
-          echo "$BASENAME: please run 'jail-commit --all' to send the script to the repository"
+          echo "Please run 'jail-commit --all' to send the script to the repository"
         fi
       fi
 
@@ -750,7 +768,7 @@ function template_edit {
     fi
     if [ "$sha1sum" != "`sha1sum $TEMPLATE_BASE.template`" ] && \
        [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then
-      echo "$BASENAME: please run 'jail-commit --all' to send changes to the repository"
+      echo "Please run 'jail-commit --all' to send changes to the repository"
     fi
   elif [ -e "$TEMPLATE_BASE.template" ]; then
     echo $BASENAME: file $TEMPLATE_BASE.template not a regular file
@@ -907,7 +925,7 @@ elif [ "$1" == "-d" ] || [ "$1" == "--delete" ]; then
   if [ -z "$3" ]; then
     usage
   else
-    template_delete $3
+    template_delete $3 $4
   fi
 
 elif [ "$1" == "-s" ] || [ "$1" == "--sync" ]; then