Moved the 'use /mnt' logic to during disk selection.

This commit is contained in:
Anton Hvornum 2021-04-09 17:33:44 +02:00
parent 0dafeacabd
commit bd134c5db0
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
2 changed files with 6 additions and 6 deletions

View File

@ -179,7 +179,6 @@ def ask_to_configure_network():
def ask_for_disk_layout():
options = {
'keep-existing' : 'Keep existing partition layout and select which ones to use where.',
'use-mnt' : 'Use whatever is mounted under /mnt and don\'t format anything',
'format-all' : 'Format entire drive and setup a basic partition scheme.',
'abort' : 'Abort the installation.'
}
@ -246,8 +245,10 @@ def select_disk(dict_o_disks):
if len(drives) >= 1:
for index, drive in enumerate(drives):
print(f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})")
drive = input('Select one of the above disks (by number or full path): ')
if drive.isdigit():
drive = input('Select one of the above disks (by number or full path) or write /mnt to skip partitioning: ')
if drive.strip() == '/mnt':
return None
elif drive.isdigit():
drive = int(drive)
if drive >= len(drives):
raise DiskError(f'Selected option "{drive}" is out of range')

View File

@ -30,6 +30,8 @@ def ask_user_questions():
archinstall.arguments['harddrive'] = archinstall.BlockDevice(archinstall.arguments['harddrive'])
else:
archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks())
if archinstall.arguments['harddrive'] is None:
archinstall.arguments['target-mount'] = '/mnt'
# Perform a quick sanity check on the selected harddrive.
# 1. Check if it has partitions
@ -53,9 +55,6 @@ def ask_user_questions():
if (option := archinstall.ask_for_disk_layout()) == 'abort':
archinstall.log(f"Safely aborting the installation. No changes to the disk or system has been made.")
exit(1)
elif option == 'use-mnt':
archinstall.arguments['harddrive'] = None
archinstall.arguments['target-mount'] = '/mnt'
elif option == 'keep-existing':
archinstall.arguments['harddrive'].keep_partitions = True