Adding service logic. Checking if reflector has finished before we select custom mirrors (if any)

This commit is contained in:
Anton Hvornum 2020-09-01 14:33:55 +02:00
parent e6293b7d44
commit 8daae75a78
3 changed files with 20 additions and 3 deletions

View File

@ -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 *
from .lib.locale_helpers import *
from .lib.services import *

View File

@ -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')

View File

@ -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): ')):