From 5ff043cb7e53981c47a660ef9d392523fada3fb4 Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Sat, 10 Jun 2017 18:11:27 +0100 Subject: Stopped it winging unnecessarily downloading databases (bug #1355). --- pacman2pacman-get | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pacman2pacman-get b/pacman2pacman-get index 58ef90c..1a82b4c 100644 --- a/pacman2pacman-get +++ b/pacman2pacman-get @@ -96,8 +96,11 @@ function look_for_torrent() } # If it's a .db file then we don't even check for a .torrent -if ! (( dbfile )) +if (( dbfile )) then + response='httptime' +else + response='torrenttime' # OK so for three random mirrors we look for a torrent. The first # one that responds, we use it. Give up and go to HTTP after 6 seconds. while read mirror @@ -117,14 +120,15 @@ then (( debugmode )) && echoerr "response var: '${response}'" fi +# We were looking for a torrent, but we didn't find one :o +[[ "${response}" == 'torrenttime' ]] && echo "Can't find a torrent file for this package :S" + gotourbaby=0 # to record if we've got the torrent yet. # If there's a .torrent we download the package with transmission # otherwize we just download it by http. -if [[ "${response}" != 'found_torrent:'* ]] +if [[ "${response}" == 'found_torrent:'* ]] then - echo "Can't find a torrent file for this package :S" -else gotourbaby=1 # assume success unless proven otherwize cd "${pkg_cache_location}" @@ -297,6 +301,7 @@ else rm -f "${transmission_output}" fi +# If we haven't got the package by this point then we use HTTP. if ! (( gotourbaby )) then cd "${pkg_cache_location}" -- cgit v1.2.2