Fixed remaining installation steps and remove legacy references to archinstall.storage['_guided'] and archinstall.storage['_guided_hidden']. Which were great at the time, but they are not deprecated and moved into archinstall.arguments instead to support parameters on command-line. As well as being a bit more description, since they are arguments afterall to various setup instructions.

This commit is contained in:
Anton Hvornum 2021-03-09 16:10:57 +01:00
parent 1167cf589b
commit aafe3d19c6
1 changed files with 230 additions and 227 deletions

View File

@ -43,35 +43,34 @@ def perform_installation(device, boot_partition, language, mirrors):
# If user selected to copy the current ISO network configuration
# Perform a copy of the config
if archinstall.storage['_guided']['network'] == 'Copy ISO network configuration to installation':
if archinstall.arguments.get('nic', None) == 'Copy ISO network configuration to installation':
installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium.
# Otherwise, if a interface was selected, configure that interface
elif archinstall.storage['_guided']['network']:
installation.configure_nic(**archinstall.storage['_guided']['network'])
elif archinstall.arguments.get('nic', None):
installation.configure_nic(**archinstall.arguments.get('nic', {}))
installation.enable_service('systemd-networkd')
installation.enable_service('systemd-resolved')
if archinstall.storage['_guided']['packages'] and archinstall.storage['_guided']['packages'][0] != '':
installation.add_additional_packages(archinstall.storage['_guided']['packages'])
if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '':
installation.add_additional_packages(archinstall.arguments.get('packages', None))
if 'profile' in archinstall.storage['_guided'] and len(profile := archinstall.storage['_guided']['profile']['path'].strip()):
if archinstall.arguments.get('profile', None) and len(profile := archinstall.arguments.get('profile').strip()):
installation.install_profile(profile)
if archinstall.storage['_guided']['users']:
for user in archinstall.storage['_guided']['users']:
password = users[user]
if archinstall.arguments.get('users', None):
for user, password in archinstall.arguments.get('users').items():
installation.user_create(user, password, sudo=False)
sudo = False
if 'root_pw' not in archinstall.storage['_guided_hidden'] or len(archinstall.storage['_guided_hidden']['root_pw'].strip()) == 0:
sudo = True
if archinstall.arguments.get('superusers', None):
for user, password in archinstall.arguments.get('superusers').items():
installation.user_create(user, password, sudo=True)
installation.user_create(user, password, sudo=sudo)
if 'root_pw' in archinstall.storage['_guided_hidden'] and archinstall.storage['_guided_hidden']['root_pw']:
installation.user_set_pw('root', archinstall.storage['_guided_hidden']['root_pw'])
if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
installation.user_set_pw('root', root_pw)
def ask_user_questions():
"""
First, we'll ask the user for a bunch of user input.
Not until we're satisfied with what we want to install
@ -240,6 +239,7 @@ except archinstall.RequirementError as e:
if not archinstall.arguments.get('nic', None):
archinstall.arguments['nic'] = archinstall.ask_to_configure_network()
def perform_installation_steps():
print()
print('This is your chosen configuration:')
archinstall.log("-- Guided template chosen (with below config) --", level=archinstall.LOG_LEVELS.Debug)
@ -320,3 +320,6 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT)
boot_partition=fs.find_partition('/boot'),
language=archinstall.arguments['keyboard-language'],
mirrors=archinstall.arguments['mirror-region'])
ask_user_questions()
perform_pre_installation_steps()