summaryrefslogtreecommitdiff
path: root/arch-nspawn.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-06-22 10:55:51 +0200
committerErich Eckner <git@eckner.net>2019-01-22 08:27:34 +0100
commit4b8cf1e2411b828249c32e9f9643e027e0bfca44 (patch)
tree3f7eeea4f849de22c498b15b63958e42a02bc8b8 /arch-nspawn.in
parentb855f188d07765aa16fa4e1872bf408269c0d205 (diff)
downloaddevtools32-4b8cf1e2411b828249c32e9f9643e027e0bfca44.tar.xz
separate mirrorlist for i686 and x86_64
Diffstat (limited to 'arch-nspawn.in')
-rw-r--r--arch-nspawn.in29
1 files changed, 24 insertions, 5 deletions
diff --git a/arch-nspawn.in b/arch-nspawn.in
index b9c846e..a5e1957 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -58,9 +58,28 @@ else
cache_dirs=("$cache_dir")
fi
+if [[ -n $makepkg_conf ]]; then
+ eval "$(grep -a '^CARCH=' "$makepkg_conf")"
+else
+ eval "$(grep -a '^CARCH=' "$working_dir/etc/makepkg.conf")"
+fi
+
pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
-# shellcheck disable=2016
-host_mirror=$($pacconf_cmd --repo extra Server 2> /dev/null | head -1 | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
+if [[ ! "$CARCH" = 'x86_64' ]]; then
+ host_mirror="$(
+ sed -n '
+ /^\s*Server\s*=/{
+ s/^.*=\s*//
+ s/\s*\(#.*\)\?$//
+ p
+ q
+ }' \
+ '/etc/pacman.d/mirrorlist32'
+ )"
+else
+ # shellcheck disable=2016
+ host_mirror=$($pacconf_cmd --repo extra Server 2> /dev/null | head -1 | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
+fi
# shellcheck disable=2016
[[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
@@ -81,7 +100,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"
@@ -108,8 +129,6 @@ fi
build_mount_args
copy_hostconf
-eval "$(grep -a '^CARCH=' "$working_dir/etc/makepkg.conf")"
-
[[ -z $nosetarch ]] || unset CARCH
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \