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 ++++++++++----- pacman2pacman.conf | 4 ++++ 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 pacman2pacman.conf 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 diff --git a/pacman2pacman.conf b/pacman2pacman.conf new file mode 100644 index 0000000..c51d110 --- /dev/null +++ b/pacman2pacman.conf @@ -0,0 +1,4 @@ +# Config for pacman2pacman + +mirrorlist_location="/etc/pacman.d/mirrorlist" +stall_time=45 # if download % doesn't change in this many seconds, consider download stalled -- cgit v1.2.2