Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-10-27 11:58:17 +0200
committerGitHub <noreply@github.com>2021-10-27 11:58:17 +0200
commitd25a20a7f28dcd873747c2a2842504c919b6e884 (patch)
tree2e82fa7f5e8d1c19f67b20b04f2a5bfd8106d648 /archinstall/lib
parentea1cf70ae3f1cabca89a5fc9008bfc4760edea49 (diff)
parent427492d7c9a386dbeb08561f163b9a68870f6e71 (diff)
Merge pull request #666 from olekthunder/re_rank_mirrors_fix
Fix re_rank_mirrors
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/mirrors.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index 739bf1a8..ed34b5d5 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -125,10 +125,17 @@ def use_mirrors(
mirrorlist.write(f'Server = {mirror}\n')
-def re_rank_mirrors(top=10, *positionals, **kwargs):
- if SysCommand(f'/usr/bin/rankmirrors -n {top} /etc/pacman.d/mirrorlist > /etc/pacman.d/mirrorlist').exit_code == 0:
- return True
- return False
+def re_rank_mirrors(
+ top: int = 10,
+ src: str = '/etc/pacman.d/mirrorlist',
+ dst: str = '/etc/pacman.d/mirrorlist',
+) -> bool:
+ cmd = SysCommand(f"/usr/bin/rankmirrors -n {top} {src}")
+ if cmd.exit_code != 0:
+ return False
+ with open(dst, 'w') as f:
+ f.write(str(cmd))
+ return True
def list_mirrors(sort_order=["https", "http"]):