summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Graham <joseph@xylon.me.uk>2017-06-22 11:22:42 +0100
committerJoseph Graham <joseph@xylon.me.uk>2017-06-22 11:22:42 +0100
commitc6a3c2e4c06ce86f4f40852f31fd2a37ec672a09 (patch)
tree528376eb9ced89c440ecb33b87cfaf49f9d972fe
parente704be65c4d8df9906e1a715c0ab58986a520be0 (diff)
Added a config file and made it read the default cache location from
/etc/pacman.conf
-rw-r--r--pacman2pacman-get15
-rw-r--r--pacman2pacman.conf4
2 files changed, 14 insertions, 5 deletions
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