From c6a3c2e4c06ce86f4f40852f31fd2a37ec672a09 Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Thu, 22 Jun 2017 11:22:42 +0100 Subject: Added a config file and made it read the default cache location from /etc/pacman.conf --- pacman2pacman-get | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'pacman2pacman-get') diff --git a/pacman2pacman-get b/pacman2pacman-get index 581c793..929b6ca 100644 --- a/pacman2pacman-get +++ b/pacman2pacman-get @@ -29,15 +29,20 @@ shopt -s extglob torrent_folder='/srv/pacman2pacman/torrents' -pkg_cache_location='/var/cache/pacman/pkg' - prog_check_freq=1.4 # seconds to update download progress torrent_search_time=6 # seconds to spend scanning the mirrors for a torrent -# These variables to be moved into a config file -mirrorlist_location="/etc/pacman.d/mirrorlist" -stall_time=60 # if download is still at 0% after this much time, consider download stalled +# 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 -- cgit v1.2.2