diff options
-rwxr-xr-x | src/simplaret | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/simplaret b/src/simplaret index 776e1b4..ffc703d 100755 --- a/src/simplaret +++ b/src/simplaret @@ -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 |