Generate or copy a pacman.conf into the newroot's /tmp directory

This makes pacstrap more compatible with migrating from --root to
--sysroot, since the pacman.conf will be required to come from the
newroot itself.
This commit is contained in:
Eli Schwartz 2018-05-29 12:25:22 -04:00
parent e418a17468
commit 8f7fc3f5d7
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -81,10 +81,6 @@ if (( ! interactive )); then
pacman_args+=(--noconfirm)
fi
if [[ $pacman_config ]]; then
pacman_args+=(--config="$pacman_config")
fi
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
# create obligatory directories
@ -96,8 +92,14 @@ mkdir -m 0555 -p "$newroot"/{sys,proc}
# mount API filesystems
chroot_setup "$newroot" || die "failed to setup chroot %s" "$newroot"
if [[ $pacman_config ]]; then
pacman-conf --config "$pacman_config" "$newroot/tmp/pacman.conf"
else
pacman-conf > "$newroot/tmp/pacman.conf"
fi
msg 'Installing packages to %s' "$newroot"
if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
if ! pacman -r "$newroot" --config "$newroot"/tmp/pacman.conf -Sy "${pacman_args[@]}"; then
die 'Failed to install packages to new root'
fi