Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/__init__.py3
-rw-r--r--archinstall/lib/services.py.py13
-rw-r--r--examples/guided.py7
3 files changed, 20 insertions, 3 deletions
diff --git a/archinstall/__init__.py b/archinstall/__init__.py
index b646c1f7..cd3d29a5 100644
--- a/archinstall/__init__.py
+++ b/archinstall/__init__.py
@@ -7,4 +7,5 @@ from .lib.profiles import *
from .lib.luks import *
from .lib.mirrors import *
from .lib.networking import *
-from .lib.locale_helpers import * \ No newline at end of file
+from .lib.locale_helpers import *
+from .lib.services import * \ No newline at end of file
diff --git a/archinstall/lib/services.py.py b/archinstall/lib/services.py.py
new file mode 100644
index 00000000..2a6dadb6
--- /dev/null
+++ b/archinstall/lib/services.py.py
@@ -0,0 +1,13 @@
+import os
+
+from .exceptions import *
+from .general import *
+
+def service_state(service_name :str):
+ if os.path.fileext(service_name)[1] != '.service':
+ service_name += '.service' # Just to be safe
+
+ state = b''.join(sys_command(f'systemctl show -p SubState --value {service_name}'))
+
+ return state.decode('UTF-8')
+ \ No newline at end of file
diff --git a/examples/guided.py b/examples/guided.py
index 33716221..f906df30 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -7,8 +7,12 @@ def perform_installation(device, boot_partition, language, mirrors):
formatted and setup prior to entering this function.
"""
with archinstall.Installer(device, boot_partition=boot_partition, hostname=hostname) as installation:
+ while archinstall.service_state('reflector') != 'dead':
+ time.sleep(0.25)
+
+ archinstall.use_mirrors(mirrors) # Set the mirrors for the live medium
if installation.minimal_installation():
- installation.set_mirrors(mirrors)
+ installation.set_mirrors(mirrors) # Set the mirrors in the installation medium
installation.set_keyboard_language(language)
installation.add_bootloader()
@@ -46,7 +50,6 @@ archinstall.set_keyboard_language(keyboard_language)
# Set which region to download packages from during the installation
mirror_regions = archinstall.select_mirror_regions(archinstall.list_mirrors())
-archinstall.use_mirrors(mirror_regions)
harddrive = archinstall.select_disk(archinstall.all_disks())
while (disk_password := getpass.getpass(prompt='Enter disk encryption password (leave blank for no encryption): ')):