summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Graham <joseph@xylon.me.uk>2017-06-10 18:11:27 +0100
committerJoseph Graham <joseph@xylon.me.uk>2017-06-10 18:11:27 +0100
commit5ff043cb7e53981c47a660ef9d392523fada3fb4 (patch)
treec6d00340ce25a4e0c3563ef25e2feb3303be91c3
parent3cd8c2fc35f77b539243a58ad389492de7c975d6 (diff)
Stopped it winging unnecessarily downloading databases (bug #1355).
-rw-r--r--pacman2pacman-get13
1 files 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}"