summaryrefslogtreecommitdiff
path: root/pacman2pacman-get
diff options
context:
space:
mode:
authorJoseph Graham <joseph@fibreglass.tunachunks>2014-06-15 10:08:47 +0100
committerJoseph Graham <joseph@fibreglass.tunachunks>2014-06-15 10:08:47 +0100
commit3af4198426e1d42404eebafaac1c563b77a9d76c (patch)
tree8d568b72166f2af8ef6bf2693adf342eca9c64af /pacman2pacman-get
parent01131dbcec43fa0d3cbaef476b11f70f2b35c94e (diff)
Made it re-write the webseeds in the torrent to use the user's default mirror.
Diffstat (limited to 'pacman2pacman-get')
-rw-r--r--pacman2pacman-get11
1 files changed, 11 insertions, 0 deletions
diff --git a/pacman2pacman-get b/pacman2pacman-get
index 99cf6e9..c1e93d1 100644
--- a/pacman2pacman-get
+++ b/pacman2pacman-get
@@ -96,6 +96,17 @@ fi
if [[ "${response}" == 'found_torrent' ]]
then
cd "${pkg_cache_location}"
+
+ # Re-write the webseeds in the torrent to make it use the user's
+ # own mirror. We can just use the ${url} var.
+
+ # We need to find out the length of the ${url} var.
+ len="${#url}"
+
+ sed "s#url-listl[[:digit:]]\+.\+.pkg.tar.xz#url-listl${len}:${url}#" < "${torrent_folder}/${url##*/}.torrent" > "${torrent_folder}/${url##*/}.torrent.modified"
+
+ mv "${torrent_folder}/${url##*/}.torrent.modified" "${torrent_folder}/${url##*/}.torrent"
+
# Add the torrent to transmission
transmission-remote -a "${torrent_folder}/${url##*/}.torrent" -w "${pkg_cache_location}" &>/dev/null