aboutsummaryrefslogtreecommitdiff
path: root/src/simplaret
diff options
context:
space:
mode:
Diffstat (limited to 'src/simplaret')
-rwxr-xr-xsrc/simplaret22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/simplaret b/src/simplaret
index cdcf430..797c2d6 100755
--- a/src/simplaret
+++ b/src/simplaret
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# simplaret v0.1.1: simplepkg's package grabber
+# simplaret v0.1.1: simplepkg's retrieval tool
# feedback: rhatto at riseup.net | gpl
#
# Simplaret is free software; you can redistribute it and/or modify it under the
@@ -24,9 +24,9 @@
#
# config file repos.conf:
#
-# ROOT-i386="http://slack.sarava.org/packages/slackware"
+# ROOT-i386="http://slack.sarava.org/packages/slackware/"
# REPOS-i386-10.2="slack.sarava.org%http://slack.sarava.org/packages/slackware/slackware-10.2/"
-# ROOT-x86_64="http://darkstar.ist.utl.pt/pub/slamd64/"
+# ROOT-x86_64="http://mirror1.slackadelic.com/slamd64/"
# REPOS-x86_64-10.2="slack.sarava.org%http://slack.sarava.org/packages/slamd64/slamd64-10.2/"
#
# usage:
@@ -303,12 +303,24 @@ function simplaret_purge {
function simplaret_get {
+ # TODO: with no parameters, update the existing packages at the local repo?
+ # support to --get package-version-arch-build.tgz or just half the name
+
# search for an already downloaded package
for file in `find $STORAGE/$ARCH/$VERSION/ -name $1*tgz 2> /dev/null`; do
candidate="`basename $file`"
if [ "`package_name $candidate`" == "$1" ]; then
- echo package $candidate already downloaded and stored at `dirname $file`
- exit 0
+ # check if has the same version and build number, otherwise erase the old one
+ for result in `simplaret_search `basename $file tgz` --silent`; do
+ if [ "`package_name $candidate`" == "`package_name $result`" ] && \
+ [ "`package_version $candidate`" == "`package_version $result`" ] && \
+ [ "`package_build $candidate`" == "`package_build $result`" ]; then
+ echo package $candidate already downloaded and stored at `dirname $file`
+ exit 0
+ else
+ rm $file
+ fi
+ done
fi
done