[devtools,v2,1/1] arch-nspawn: get mirror url from chroot's pacman.conf

Message ID 20170714193329.2474-1-list@eworm.de
State New
Headers show
Series [devtools,v2,1/1] arch-nspawn: get mirror url from chroot's pacman.conf | expand

Commit Message

Christian Hesse July 14, 2017, 7:33 p.m. UTC
From: Christian Hesse <mail@eworm.de>

My system has a mirror configuration where only the host can access a
special url from pacman.conf but chroots and containers fail.

Instead of host's pacman.conf use $pac_conf or pacman.conf from chroot.
This still uses host's /etc/pacman.d/mirrorlist and should achieve the
expected results.

Signed-off-by: Christian Hesse <mail@eworm.de>
 arch-nspawn.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/arch-nspawn.in b/arch-nspawn.in
index c21b2ce..bc9beb7 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -59,7 +59,7 @@  else
 # shellcheck disable=2016
-host_mirror=$(pacman --cachedir /doesnt/exist -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
+host_mirror=$(pacman --config "${pac_conf:-$working_dir/etc/pacman.conf}" --dbpath "$working_dir/var/lib/pacman" --cachedir /doesnt/exist -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
 # shellcheck disable=2016
 [[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')