diff options
Diffstat (limited to 'trunk/src/simplaret')
-rwxr-xr-x | trunk/src/simplaret | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/trunk/src/simplaret b/trunk/src/simplaret index 374c988..719063c 100755 --- a/trunk/src/simplaret +++ b/trunk/src/simplaret @@ -489,7 +489,7 @@ function simplaret_get { # get a package # usage: simplaret_get <package-name> [--silent] - local silent generate_patches + local silent generate_patches search search_results # prevent user to stay in $storage cd @@ -507,7 +507,13 @@ function simplaret_get { done # then search for the package in the repositories - for result in `simplaret_search $1 --formatted`; do + search="`simplaret_search $1 --formatted`" + search_results="`echo $search | bc -l`" + + for result in $search; do + + # remaining search results + let search_results-- file="`echo $result | cut -d , -f 1`" repos_type="`echo $result | cut -d , -f 2`" @@ -558,11 +564,14 @@ function simplaret_get { if [ "$2" != "--silent" ]; then echo Error downloading $candidate from $repos_type repository $repository_url, please check your settings fi - # TODO: must check if there's also more repositories to try, - # otherwise this function will never return an error code - #if [ "$SIMPLARET_DOWNLOAD_FROM_NEXT_REPO" != "1" ]; then + # check if there's also more repositories to try + if [ "$SIMPLARET_DOWNLOAD_FROM_NEXT_REPO" != "1" ]; then return 1 - #fi + else + if (($search_results <= 0)); then + return 1 + fi + fi else LAST_DOWNLOADED_PACKAGE="$folder/$candidate" if [ "$2" != "--silent" ]; then |