diff options
author | Joseph Graham <joseph@xylon.me.uk> | 2017-06-22 11:43:23 +0100 |
---|---|---|
committer | Joseph Graham <joseph@xylon.me.uk> | 2017-06-22 11:43:23 +0100 |
commit | fbd9106378802c15c4475ecf4c49cdf6a2282cfa (patch) | |
tree | d80f4255711ad8090f46869990337d8736202e36 | |
parent | c6a3c2e4c06ce86f4f40852f31fd2a37ec672a09 (diff) |
Improved code to find out cache location.
-rw-r--r-- | pacman2pacman-get | 23 |
1 files 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 |