From fbd9106378802c15c4475ecf4c49cdf6a2282cfa Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Thu, 22 Jun 2017 11:43:23 +0100 Subject: Improved code to find out cache location. --- pacman2pacman-get | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/pacman2pacman-get b/pacman2pacman-get index 929b6ca..9c94ab5 100644 --- a/pacman2pacman-get +++ b/pacman2pacman-get @@ -33,28 +33,23 @@ prog_check_freq=1.4 # seconds to update download progress torrent_search_time=6 # seconds to spend scanning the mirrors for a torrent -# Find out the cache location -pkg_cache_location='/var/cache/pacman/pkg' # default location - -if cachesearch=$(grep '^[[:space:]]*CacheDir' /etc/pacman.conf) # uncommented 'CacheDir' -then - pkg_cache_location="${cachesearch##*[[:space:]=]}" # everything before the last space or = -fi - -# Read the config -source /etc/pacman2pacman.conf - -# Pacman2pacman should be called like this from /etc/pacman.conf: -# XferCommand = /usr/bin/pacman2pacman-get %u %o - # Check that the args are not empty. [[ -z ${1} ]] && { echoerr $"The first argument should be the download url." ; exit 1 ; } [[ -z ${2} ]] && { echoerr $"The second argument should be the local filename, plus a \".part\" extension." ; exit 1 ; } +# Pacman2pacman should be called like this from /etc/pacman.conf: +# XferCommand = /usr/bin/pacman2pacman-get %u %o + url="${1}" # The download url. filename="${2}" # This is where the downloaded file needs to be saved # or hardlinked +# Find out the cache location +pkg_cache_location="${filename%/*}/" + +# Read the config +source /etc/pacman2pacman.conf + # Check if transmission daemon is running. if ! systemctl show --property='ActiveState' transmission | grep -q 'ActiveState=active' then -- cgit v1.2.3