]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
simplaret: simplaret_search_and_delete and simplaret_get fixes
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 12 Jan 2007 19:38:56 +0000 (19:38 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 12 Jan 2007 19:38:56 +0000 (19:38 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@101 04377dda-e619-0410-9926-eae83683ac58

src/simplaret

index 03af06cd9f2fbb5c82d32c11ce2a198e9a034904..0f968fa4f0860d6bc11e0dbcec1673f460445bee 100755 (executable)
@@ -383,6 +383,8 @@ function simplaret_purge {
 
 function simplaret_search_and_delete {
 
+  local file candidate
+
   for file in `find $2/ -name $1*tgz 2> /dev/null`; do
     candidate="`basename $file`"
     if [ "`package_name $candidate`" == "$1" ]; then
@@ -391,11 +393,11 @@ function simplaret_search_and_delete {
         if [ "`package_name $candidate`" == "`package_name $result`" ] &&       \
            [ "`package_version $candidate`" == "`package_version $result`" ] && \
            [ "`package_build $candidate`" == "`package_build $result`" ]; then
-          if [ "$2" != "--silent" ]; then
+          if [ "$3" != "--silent" ]; then
             echo package $candidate already downloaded and stored at `dirname $file`
           else echo $file
           fi
-          return 0
+          return 1
         else
           rm $file
           break
@@ -420,13 +422,20 @@ function simplaret_get {
   for repos_type in patches root repos noarch; do
 
     simplaret_set_storage_folder
-    simplaret_search_and_delete $1 $storage
+    simplaret_search_and_delete $1 $storage $2
+
+    if [ "$?" == "1" ]; then
+      return 0
+    fi
 
     # if repos_type == root, check also if
     # there is a package on $PATCHES_DIR/root-$repository_name
     if [ "$repos_type" == "root" ]; then
       simplaret_repository_name
       simplaret_search_and_delete $1 $PATCHES_DIR/$ARCH/$VERSION/root-$repository_name
+      if [ "$?" == "1" ]; then
+        return 0
+      fi
     fi
 
   done