summaryrefslogtreecommitdiff
path: root/arch-nspawn.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-04-01 10:38:05 +0200
committerErich Eckner <git@eckner.net>2019-04-02 11:04:10 +0200
commit32acef2c7eba545080966adb92cf07a679dbd113 (patch)
treef46c3b0b200df1f89198c5c89728d36d91adf462 /arch-nspawn.in
parenta49f55cbed51c815a9392c9f7fff5f8cec385935 (diff)
downloaddevtools-32acef2c7eba545080966adb92cf07a679dbd113.tar.xz
arch-nspawn should use the correct pacman config file
If arch-nspawn is called with -C, pacman inside the chroot will use the provided configuration file. This should also be the case for $pacconf_cmd and pacman outside the chroot. If arch-nspawn is called without -C, pacman inside the chroot will use $workdir/etc/pacman.conf -- again, $pacconf_cmd and pacman outside the chroot should use that, too. So lets just set $pac_conf in that case. For example, Arch Linux 32 provides separate pacman configurations inside /usr/share/devtools which use /etc/pacman.d/mirrorlist32 as mirrorlist for their build commands (extra-i686-build, etc.). This way, we can build i686 and x86_64 packages on the same x86_64 host with very minimal changes to devtools.
Diffstat (limited to 'arch-nspawn.in')
-rw-r--r--arch-nspawn.in7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch-nspawn.in b/arch-nspawn.in
index e68e2e7..cebeb2e 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -52,16 +52,17 @@ shift 1
[[ -z $working_dir ]] && die 'Please specify a working directory.'
+[[ -z $pac_conf ]] && pac_conf="$working_dir/etc/pacman.conf"
+
if [[ -z $cache_dir ]]; then
- cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
+ cache_dirs=($(pacman --config "$pac_conf" -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
else
cache_dirs=("$cache_dir")
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
+host_mirrors=($($pacconf_cmd --conf "$pac_conf" --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#'))
# {{{ functions
build_mount_args() {