Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-07-30 23:15:51 +0000
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-07-30 23:15:51 +0000
commit196d4a178e75c7e3017ca097cb51f34ea4a1472c (patch)
tree20729bb28e00a224fc13bb55a505b06b005e24c5 /archinstall
parent5b0f4f99d6b0e0f212e5926db55920703fa73278 (diff)
Added add_custom_mirrors(). The function appends custom mirrors to /etc/pacman.conf
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/mirrors.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index 63eb4678..6cfccf19 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -18,6 +18,21 @@ def filter_mirrors_by_region(regions, *args, **kwargs):
return True
+def add_custom_mirrors(mirrors:list, *args, **kwargs):
+ """
+ This will append custom mirror definitions in pacman.conf
+
+ :param mirrors: A list of mirror data according to: `{'url': 'http://url.com', 'signcheck': 'Optional', 'signoptions': 'TrustAll', 'name': 'testmirror'}`
+ :type mirrors: dict
+ """
+ with open('/etc/pacman.conf', 'a') as pacman:
+ for mirror in mirrors:
+ pacman.write(f"[{mirror['name']}]\n")
+ pacman.write(f"SigLevel = {mirror['signcheck']} {mirror['signoptions']}\n")
+ pacman.write(f"Server = {mirror['url']}\n")
+
+ return True
+
def insert_mirrors(mirrors, *args, **kwargs):
"""
This function will insert a given mirror-list at the top of `/etc/pacman.d/mirrorlist`.