diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2018-06-10 17:20:48 -0400 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2019-08-09 19:39:45 +0200 |
commit | 58374246c4e32d14354345aef516d49207881ce2 (patch) | |
tree | 0037f29930b5490404a0e3a165e3f3936d03fc45 /arch-nspawn.in | |
parent | f522ce2277100a147baa2656753231b14cf1f71d (diff) | |
download | devtools32-58374246c4e32d14354345aef516d49207881ce2.tar.xz |
Migrate pacman.conf CacheDir parsing to pacman-conf
And while we're at it, make this more consistent. Currently we
unnecessarily support only one -c /path/to/cachedir option.
This requires slightly more thorough handling in mkarchroot to ensure
all custom cachedirs are passed on to arch-nspawn. Rework
to simply forward all arguments to arch-nspawn (minus final arguments
used for pacman -Sy packagelist).
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'arch-nspawn.in')
-rw-r--r-- | arch-nspawn.in | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/arch-nspawn.in b/arch-nspawn.in index e68e2e7..3d03c91 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -35,7 +35,7 @@ while getopts 'hC:M:c:f:s' arg; do case "$arg" in C) pac_conf="$OPTARG" ;; M) makepkg_conf="$OPTARG" ;; - c) cache_dir="$OPTARG" ;; + c) cache_dirs+=("$OPTARG") ;; f) files+=("$OPTARG") ;; s) nosetarch=1 ;; h|?) usage ;; @@ -52,13 +52,12 @@ shift 1 [[ -z $working_dir ]] && die 'Please specify a working directory.' -if [[ -z $cache_dir ]]; then - cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g')) -else - cache_dirs=("$cache_dir") +pacconf_cmd=$(command -v pacman-conf || command -v pacconf) + +if (( ${#cache_dirs[@]} == 0 )); then + mapfile -t cache_dirs < <($pacconf_cmd CacheDir) fi -pacconf_cmd=$(command -v pacman-conf || command -v pacconf) # shellcheck disable=2016 host_mirrors=($($pacconf_cmd --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')) # shellcheck disable=2016 |