else:
server = f"Server = {args.mirror}/$repo/os/$arch"
else:
- # Instead of harcoding a single mirror, we retrieve a list of mirrors from Arch's mirrorlist
- # generator ordered by mirror score. This usually results in a solid mirror and also ensures that we
- # have fallback mirrors available if necessary. Finally, the mirrors will be more likely to be up to
- # date and we won't end up with a stable release that hardcodes a broken mirror.
- mirrorlist = workspace(root) / "mirrorlist"
- with urllib.request.urlopen(
- "https://www.archlinux.org/mirrorlist/?country=all&protocol=https&ip_version=4&use_mirror_status=on"
- ) as r:
- mirrors = r.readlines()
- uncommented = [line.decode("utf-8")[1:] for line in mirrors]
- with mirrorlist.open("w") as f:
- f.writelines(uncommented)
- server = f"Include = {mirrorlist}"
+ # This should not happen, but for good measure.
+ die("No repository mirror has been selected.")
# Create base layout for pacman and pacman-key
os.makedirs(root / "var/lib/pacman", 0o755, exist_ok=True)