arch-nspawn: rely on deduplication to avoid making multiple host_mirror mounts

Instead of comparing exact mirror urls to see if they are in
host_mirrors in order to "skip" the official mirrors

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
This commit is contained in:
Eli Schwartz 2019-10-02 11:21:33 -04:00 committed by Levente Polyak
parent 20eec484fa
commit f85a58a0a6
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 7 additions and 9 deletions

View File

@ -75,15 +75,13 @@ done
while read -r line; do
mapfile -t lines < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" \
--repo $line Server | sed -r 's#(.*/)[^/]+/os/.+#\1$repo/os/$arch#')
if [[ ${lines[0]} != ${host_mirrors[0]} ]]; then
for line in "${lines[@]}"; do
if [[ $line = file://* ]]; then
line=${line#file://}
in_array "$line" "${cache_dirs[@]}" || cache_dirs+=("$line")
fi
done
fi
--repo $line Server | sed -r 's#(.*/)[^/]+/os/.+#\1#')
for line in "${lines[@]}"; do
if [[ $line = file://* ]]; then
line=${line#file://}
in_array "$line" "${cache_dirs[@]}" || cache_dirs+=("$line")
fi
done
done < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list)
mount_args+=("--bind=${cache_dirs[0]//:/\\:}")