index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton.feeds@gmail.com> | 2021-06-10 13:39:50 +0200 |
---|---|---|
committer | Anton Hvornum <anton.feeds@gmail.com> | 2021-06-10 13:39:50 +0200 |
commit | e8d38ea1a75a33d820ac32c995a80c1bc833a44d (patch) | |
tree | 8666ba1fb2c24036edf0a1c93c2981bce6ab2885 | |
parent | 5701ef953919230f1478294cabcc66ccdbe95e34 (diff) |
-rw-r--r-- | archinstall/lib/disk.py | 9 | ||||
-rw-r--r-- | archinstall/lib/user_interaction.py | 16 | ||||
-rw-r--r-- | examples/guided.py | 5 |
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 0c46e779..efcf1844 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -572,7 +572,14 @@ class Filesystem: def load_layout(self, layout :dict): for partition in layout: - print(partition) + # We don't want to re-add an existing partition (those containing a UUID already) + if 'UUID' not in partition: + self.add_partition(partition.get('type', 'primary'), + start=partition.get('start', '1MiB'), # TODO: Revisit sane block starts (4MB for memorycards for instance) + end=partition.get('size', '100%'), + partition_format=partition.get('filesystem', {}).get('format', 'btrfs')) + + exit(0) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 0ce2cafd..50f3be9a 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -11,6 +11,7 @@ import termios import time import tty +from .disk import BlockDevice from .exceptions import * from .general import SysCommand from .hardware import AVAILABLE_GFX_DRIVERS, has_uefi @@ -19,7 +20,6 @@ from .networking import list_interfaces from .output import log from .profiles import Profile, list_profiles - # TODO: Some inconsistencies between the selection processes. # Some return the keys from the options, some the values? @@ -553,7 +553,7 @@ def generic_select(options, input_text="Select one of the above by index or abso def select_partition_layout(block_device): return { - "/dev/sda": { # Block Device level + BlockDevice("/dev/sda"): { # Block Device level "wipe": False, # Safety flags "partitions" : [ # Affected / New partitions { @@ -565,7 +565,7 @@ def select_partition_layout(block_device): } ] }, - "/dev/sdb" : { + BlockDevice("/dev/sdb") : { "wipe" : True, "partitions" : [ { @@ -653,7 +653,7 @@ def get_default_partition_layout(block_devices): } # TODO: Implement sane generic layout for 2+ drives -def wipe_and_create_partitions(block_device): +def wipe_and_create_partitions(block_device :BlockDevice) -> dict: if hasUEFI(): partition_type = 'gpt' else: @@ -747,7 +747,9 @@ def wipe_and_create_partitions(block_device): partitions_result = [*suggested_layout] elif task is None: - return partitions_result + return { + block_device : partitions_result + } else: for index, partition in enumerate(partitions_result): print(f"{index}: Start: {partition['start']}, End: {partition['size']} ({partition['filesystem']['format']}{', mounting at: '+partition['mountpoint'] if partition['mountpoint'] else ''})") @@ -777,7 +779,9 @@ def wipe_and_create_partitions(block_device): if (partition := generic_select(partitions_result, 'Select which partition to mark as bootable: ', options_output=False)): partitions_result[partitions_result.index(partition)]['boot'] = not partitions_result[partitions_result.index(partition)].get('boot', False) - return partitions_result + return { + block_device : partitions_result + } def select_individual_blockdevice_usage(block_devices :list): result = {} diff --git a/examples/guided.py b/examples/guided.py index b4c12fd6..57d4818b 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -73,7 +73,7 @@ def ask_user_questions(): # Ask which harddrives/block-devices we will install to # and convert them into archinstall.BlockDevice() objects. if archinstall.arguments.get('harddrives', None): - archinstall.arguments['harddrives'] = [archinstall.BlockDevice(BlockDev) for BlockDev in archinstall.arguments['harddrives']] + archinstall.arguments['harddrives'] = [archinstall.BlockDevice(BlockDev) for BlockDev in archinstall.arguments['harddrives'].split(',')] else: archinstall.arguments['harddrives'] = archinstall.generic_multi_select(archinstall.all_disks(), text="Select one or more harddrives to use and configure (leave blank to skip this step): ", @@ -82,7 +82,6 @@ def ask_user_questions(): if archinstall.arguments.get('harddrives', None): archinstall.storage['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives']) - # Get disk encryption password (or skip if blank) if archinstall.arguments['harddrives'] and archinstall.arguments.get('!encryption-password', None) is None: if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')): @@ -219,7 +218,7 @@ def perform_filesystem_operations(): for drive in archinstall.arguments['harddrives']: with archinstall.Filesystem(drive, mode) as fs: - fs.load_layout(archinstall.arguments['harddrives'][drive]) + fs.load_layout(archinstall.storage['disk_layouts'][drive]) perform_installation(archinstall.storage.get('MOUNT_POINT', '/mnt')) |