arch-nspawn: get all mirrors from host
Now that pacconf gives us all mirrors we can use them, instead of just the first one. Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
parent
6645701cb1
commit
d9b7350448
|
@ -60,17 +60,19 @@ fi
|
||||||
|
|
||||||
pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
|
pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
|
||||||
# shellcheck disable=2016
|
# shellcheck disable=2016
|
||||||
host_mirror=$($pacconf_cmd --repo extra Server 2> /dev/null | head -1 | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
|
host_mirrors=($($pacconf_cmd --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#'))
|
||||||
# shellcheck disable=2016
|
# shellcheck disable=2016
|
||||||
[[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
|
||||||
|
|
||||||
# {{{ functions
|
# {{{ functions
|
||||||
build_mount_args() {
|
build_mount_args() {
|
||||||
declare -g mount_args=()
|
declare -g mount_args=()
|
||||||
|
|
||||||
if [[ -n $host_mirror_path ]]; then
|
for host_mirror in "${host_mirrors[@]}"; do
|
||||||
mount_args+=("--bind-ro=$host_mirror_path")
|
if [[ $host_mirror == *file://* ]]; then
|
||||||
fi
|
host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
||||||
|
mount_args+=("--bind-ro=$host_mirror_path")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
mount_args+=("--bind=${cache_dirs[0]}")
|
mount_args+=("--bind=${cache_dirs[0]}")
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ build_mount_args() {
|
||||||
|
|
||||||
copy_hostconf () {
|
copy_hostconf () {
|
||||||
cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d"
|
cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d"
|
||||||
echo "Server = $host_mirror" >"$working_dir/etc/pacman.d/mirrorlist"
|
printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist"
|
||||||
|
|
||||||
[[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf"
|
[[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf"
|
||||||
[[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf"
|
[[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf"
|
||||||
|
|
Loading…
Reference in New Issue