Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-09-01 14:04:47 +0200
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-09-01 14:04:47 +0200
commit323af39ed57191747604b64d1c6ed6a46719c84f (patch)
tree79cd02e39a04ca050cf2e39847511d2e69496e1a
parent6744d7ac1bc37bc4db3b1cbf6e0562fa6ae2e0ff (diff)
Added archinstall.Installer().set_mirrors, which allows to modify the mirrors in the finished installed medium.
-rw-r--r--archinstall/lib/installer.py4
-rw-r--r--archinstall/lib/mirrors.py2
-rw-r--r--examples/guided.py3
3 files changed, 7 insertions, 2 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 3ab0adc2..e69f25bf 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -5,6 +5,7 @@ from .disk import *
from .general import *
from .user_interaction import *
from .profiles import Profile
+from .mirrors import *
class Installer():
"""
@@ -82,6 +83,9 @@ class Installer():
else:
log(f'Could not sync mirrors: {sync_mirrors.exit_code}')
+ def set_mirrors(self, mirrors):
+ return use_mirrors(mirrors, destination=f'{self.mountpoint}/etc/pacman.d/mirrorlist')
+
def genfstab(self, flags='-Pu'):
o = b''.join(sys_command(f'/usr/bin/genfstab -pU {self.mountpoint} >> {self.mountpoint}/etc/fstab'))
if not os.path.isfile(f'{self.mountpoint}/etc/fstab'):
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index fc2048ca..a4aade9c 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -57,7 +57,7 @@ def insert_mirrors(mirrors, *args, **kwargs):
return True
def use_mirrors(regions :dict, destination='/etc/pacman.d/mirrorlist'):
- log(f'Updating mirror list: {destination}')
+ log(f'A new package mirror-list has been created: {destination}')
for region, mirrors in regions.items():
with open(destination, 'w') as mirrorlist:
for mirror in mirrors:
diff --git a/examples/guided.py b/examples/guided.py
index 59260775..f8f3f831 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -1,6 +1,6 @@
import archinstall, getpass, time
-def perform_installation(device, boot_partition, language):
+def perform_installation(device, boot_partition, language, mirrors):
"""
Performs the installation steps on a block device.
Only requirement is that the block devices are
@@ -8,6 +8,7 @@ def perform_installation(device, boot_partition, language):
"""
with archinstall.Installer(device, boot_partition=boot_partition, hostname=hostname) as installation:
if installation.minimal_installation():
+ installation.set_mirrors(mirrors)
installation.set_keyboard_language(language)
installation.add_bootloader()