]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
simplaret: simplaret_purge fixes
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 9 Dec 2006 15:40:20 +0000 (15:40 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 9 Dec 2006 15:40:20 +0000 (15:40 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@52 04377dda-e619-0410-9926-eae83683ac58

src/simplaret

index 776e1b43ad7c0699208efa3dea18840084174351..ffc703d375e5cf89b17d95e480308cbe17504758 100755 (executable)
@@ -55,6 +55,7 @@ function simplaret_eval_config {
   PASSIVE_FTP="`simplaret_eval_parameter PASSIVE_FTP 0`"
   WARNING="`simplaret_eval_parameter WARNING 0`"
   ROOT_PRIORITY="`simplaret_eval_parameter ROOT_PRIORITY patches slackware extra testing pasture`"
+  SIMPLARET_PURGE_WEEKS="`simplaret_eval_parameter SIMPLARET_PURGE_WEEKS 0`"
 
 }
 
@@ -309,6 +310,9 @@ function simplaret_purge {
   if [ "$2" == "-w" ] && [ ! -z "$3" ]; then
     mtime="-mtime +`echo "$3*7" | bc -l`"
     mtime_message="older than $3 weeks"
+  elif [ "$SIMPLARET_PURGE_WEEKS" != "0" ]; then
+    mtime="-mtime +`echo "$SIMPLARET_PURGE_WEEKS*7" | bc -l`"
+    mtime_message="older than $SIMPLARET_PURGE_WEEKS weeks"
   else
     mtime=""
     mtime_mesage=""
@@ -343,6 +347,7 @@ function simplaret_purge {
 
 function simplaret_get {
 
+  # get the first matching package $1
   # TODO: support to --get package-version-arch-build.tgz or just part of the name
 
   # first search for an already downloaded package
@@ -385,7 +390,7 @@ function simplaret_get {
       simplaret_download $repository_url $file $storage/$repository_name
       if [ ! -f "$storage/$repository_name/$candidate" ]; then
         echo error downloading $candidate from $repos_type repository $repository_url, please check your settings
-        exit 1
+        return 1
       else
         echo package $candidate stored at $storage/$repository_name
         simplaret_checksum $storage/$repository_name/CHECKSUMS.md5 $storage/$repository_name/$candidate
@@ -512,7 +517,7 @@ case $1 in
   --search) simplaret_search $2 ;;
   --get) simplaret_get $2 ;;
   --get-patches) simplaret_get_patches ;;
-  --purge) simplaret_purge ;;
+  --purge) shift ; simplaret_purge $* ;;
   *) simplaret_usage ;;
 esac