From 3af4198426e1d42404eebafaac1c563b77a9d76c Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Sun, 15 Jun 2014 10:08:47 +0100 Subject: Made it re-write the webseeds in the torrent to use the user's default mirror. --- pacman2pacman-get | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- cgit v1.2.2