[pacman-contrib] [PATCH] paccache: Support multiple CacheDirs
Fixes FS#47024. Signed-off-by: Johannes Löthberg <johannes@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[@]:-@localstatedir@/cache/pacman/pkg}") - fi + cachedir="$(get_cachedirs_from_config "@sysconfdir@/pacman.conf")" + cachedirs=("${cachedirs[@]:-@localstatedir@/cache/pacman/pkg}") fi # remaining args are a whitelist -- 2.10.0
participants (1)
-
Johannes Löthberg