summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-09-11 19:25:54 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-09-11 19:25:54 +0200
commitdb7a90ccd280a84bdbdef078ed766aa321ed317a (patch)
treebbc7d3ed0f54a120ff388b9090e273877685fc65
parenta9bfd8d2c96567b03e827657d248d8e46c85ccff (diff)
Use pacman to determine the host's mirror
-rwxr-xr-xmkarchroot8
1 files changed, 4 insertions, 4 deletions
diff --git a/mkarchroot b/mkarchroot
index fe436f7..c57b7e7 100755
--- a/mkarchroot
+++ b/mkarchroot
@@ -73,13 +73,13 @@ if [ -z "$cache_dir" ]; then
fi
if [ -f /etc/pacman.d/mirrorlist ]; then
- host_mirror=$(grep -v '^#' -m1 /etc/pacman.d/mirrorlist | sed -E 's#/os/(i686|x86_64)#/os/\$arch#g')
+ host_mirror=$(pacman -Sdp extra/devtools 2>/dev/null | sed -E 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
fi
if [ -z "${host_mirror}" ]; then
- host_mirror='Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch'
+ host_mirror='http://mirrors.kernel.org/archlinux/$repo/os/$arch'
fi
if echo "${host_mirror}" | grep -q 'file://'; then
- host_mirror_path=$(echo "${host_mirror}" | sed -E 's#Server\s=\sfile://(/.*)/\$repo/os/(\$arch|i686|x86_64)#\1#g')
+ host_mirror_path=$(echo "${host_mirror}" | sed -E 's#file://(/.*)/\$repo/os/\$arch#\1#g')
fi
# {{{ functions
@@ -116,7 +116,7 @@ chroot_mount() {
copy_hostconf () {
chroot "${working_dir}" /bin/findmnt -rnu -o SOURCE,TARGET,FSTYPE,OPTIONS > "${working_dir}/etc/mtab"
cp /etc/resolv.conf "${working_dir}/etc/resolv.conf"
- echo "${host_mirror}" > ${working_dir}/etc/pacman.d/mirrorlist
+ echo "Server = ${host_mirror}" > ${working_dir}/etc/pacman.d/mirrorlist
}
chroot_umount () {