From b951a9902d36c3ff0d54141dfb32f0c9fa988dc9 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 22 Jun 2017 10:55:51 +0200 Subject: separate mirrorlist for i686 and x86_64 --- arch-nspawn.in | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'arch-nspawn.in') diff --git a/arch-nspawn.in b/arch-nspawn.in index 8b3d84e..656bc3c 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -58,7 +58,26 @@ else cache_dirs=("$cache_dir") fi -host_mirror=$(pacman --cachedir /doesnt/exist -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#;s#(.*/)[^/]+/extra/[^/]+#\1$arch/$repo#') +if [[ -n $makepkg_conf ]]; then + eval $(grep '^CARCH=' "$makepkg_conf") +else + eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf") +fi + +if [[ "$CARCH" = 'i'*'86' ]]; then + host_mirror="$( + sed -n ' + /^\s*Server\s*=/{ + s/^.*=\s*// + s/\s*\(#.*\)\?$// + p + q + }' \ + '/etc/pacman.d/mirrorlist32' + )" +else + host_mirror=$(pacman --cachedir /doesnt/exist -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#;s#(.*/)[^/]+/extra/[^/]+#\1$arch/$repo#') +fi [[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g') # {{{ functions @@ -78,7 +97,9 @@ build_mount_args() { copy_hostconf () { cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d" - echo "Server = $host_mirror" >"$working_dir/etc/pacman.d/mirrorlist" + echo "Server = $host_mirror" | \ + tee "$working_dir/etc/pacman.d/mirrorlist" > \ + "$working_dir/etc/pacman.d/mirrorlist32" [[ -n $pac_conf ]] && cp $pac_conf "$working_dir/etc/pacman.conf" [[ -n $makepkg_conf ]] && cp $makepkg_conf "$working_dir/etc/makepkg.conf" @@ -90,7 +111,6 @@ copy_hostconf () { done sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i "$working_dir/etc/pacman.conf" - eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf") sed -i '/^Architecture = /s| auto$| '"$CARCH|" "$working_dir/etc/pacman.conf" } # }}} -- cgit v1.2.3-70-g09d2