From 8ca107b03ac6f124ec93bf35d1fd81ec95ac9a28 Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Mon, 5 May 2014 19:39:24 +0100 Subject: made it download stuff directly into the package cache. --- README | 24 ++++++++++-------------- pacman2pacman-get | 10 +++++++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README b/README index bd5c350..40b2381 100644 --- a/README +++ b/README @@ -1,17 +1,13 @@ -Install deps: - transmission-cli - curl - -Make directories /srv/pacman2pacman/torrents and /srv/pacman2pacman/downloads - +mkdir -p /srv/pacman2pacman/torrents chown -R transmission /srv/pacman2pacman/ - -Put the following into /etc/pacman.conf: XferCommand = /usr/bin/pacman2pacman-get %u %o - -Put the `pacman2pacman-get' script into /usr/bin and chmod +x - -Run: systemctl start transmission - -Now you can test it by installing something with pacman. +pacman -S transmission-cli +/etc/pacman.conf: + XferCommand = /usr/bin/pacman2pacman-get %u %o +cp pacman2pacman/pacman2pacman-get /usr/bin/ +chmod +x /usr/bin/pacman2pacman-get +chmod 777 /var/cache/pacman/pkg +systemctl start transmission If you want to see the packages being seeded, run: transmission-remote -l + +BUG: if you changed your package cache location (it's customizable in /etc/pacman.conf) you might be doomed. pacman2pacman assumes it is /var/cache/pacman/pkg diff --git a/pacman2pacman-get b/pacman2pacman-get index 7dde661..2b49adf 100644 --- a/pacman2pacman-get +++ b/pacman2pacman-get @@ -1,6 +1,8 @@ #! /bin/bash # /usr/bin/pacman2pacman-get # +# Version 1.1 +# # Copyright (C) 2014 Joseph Graham # # This program is free software: you can redistribute it and/or modify @@ -20,6 +22,8 @@ # Where Pacman2pacman will look to find .torrent files. torrents='http://repo.parabolagnulinux.org/torrents/' +pkg_cache_location='/var/cache/pacman/pkg' + # Pacman2pacman should be called like this from /etc/pacman.conf: # XferCommand = /usr/bin/pacman2pacman-get %u %o @@ -40,7 +44,7 @@ fi torrent_url="${torrents}${url##*/}.torrent" -cd /srv/pacman2pacman/torrents +cd "${pkg_cache_location}" # Find the name of the package that will be displayed pname="${url##*/}" @@ -50,7 +54,7 @@ pname="${pname%%-[[:digit:]]*}" if curl -O -f -L -s -A 'Pacman2pacman' "${torrent_url}" then # Add the torrent to transmission - transmission-remote -a "${url##*/}.torrent" -w /srv/pacman2pacman/downloads &>/dev/null + transmission-remote -a "${url##*/}.torrent" -w "${pkg_cache_location}" &>/dev/null # The torrent is now downloading. To get info about the torrent in # order to display a progress bar we need to know it's id. @@ -99,7 +103,7 @@ then echo - ln "/srv/pacman2pacman/downloads/${url##*/}" "${filename}" || exit 1 + ln -f "${pkg_cache_location}/${url##*/}" "${filename}" || exit 1 else # There's no .torrent so we download it by just HTTP. -- cgit v1.2.3