[pacman-contrib] [PATCH] paccache: Support multiple CacheDirs
Johannes Löthberg
johannes at kyriasis.com
Thu Oct 13 21:49:41 UTC 2016
Fixes FS#47024.
Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
---
src/paccache.sh.in | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/paccache.sh.in b/src/paccache.sh.in
index 643bb38..fcdf30b 100644
--- a/src/paccache.sh.in
+++ b/src/paccache.sh.in
@@ -40,17 +40,18 @@ die() {
exit 1
}
-get_cachedir_from_config() {
- local key value
+get_cachedirs_from_config() {
+ local key value ret
+ ret=1
while IFS=$'= \t' read -r key value _; do
if [[ $key = CacheDir ]]; then
echo "$value"
- return 0
+ ret=0
fi
done <"$1"
- return 1
+ return $ret
}
# reads a list of files on stdin and prints out deletion candidates
@@ -284,13 +285,10 @@ done
m4_include(../lib/term_colors.sh)
-# setting default cachedir
+# setting default cachedirs
if [[ -z $cachedirs ]]; then
- if cachedir=$(get_cachedir_from_config "@sysconfdir@/pacman.conf"); then
- cachedirs=("$cachedir")
- else
- cachedirs=("${cachedirs[@]:- at localstatedir@/cache/pacman/pkg}")
- fi
+ cachedir="$(get_cachedirs_from_config "@sysconfdir@/pacman.conf")"
+ cachedirs=("${cachedirs[@]:- at localstatedir@/cache/pacman/pkg}")
fi
# remaining args are a whitelist
--
2.10.0
More information about the pacman-contrib
mailing list