From 995edaf316ab42cec5adbc50b32c133ae2ec77b6 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 12 Sep 2021 15:42:13 +0200 Subject: Removed legacy need to add_bootloader `add_bootloader` no longer needs to have a harddrive given as a argument. It will (and should) auto-detect what's mounted in the `self.target` (aka mountpoint) of the installation. --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index 4e6d1bc5..3dd30875 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -269,7 +269,7 @@ def perform_installation(mountpoint): installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium if archinstall.arguments["bootloader"] == "grub-install" and has_uefi(): installation.add_additional_packages("grub") - installation.add_bootloader(archinstall.arguments["harddrive"], archinstall.arguments["bootloader"]) + installation.add_bootloader(archinstall.arguments["bootloader"]) # If user selected to copy the current ISO network configuration # Perform a copy of the config -- cgit v1.2.3-70-g09d2 From c09a36b7b166cc5cf74e5c25e8c9b200f4f2088a Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 15 Sep 2021 13:33:34 +0000 Subject: Changed from internal storage to parameter-friendly arguments for disk_layouts, so we can support JSON for disk layouts on the new logic. --- examples/guided.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index 3dd30875..7574f39f 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -102,7 +102,7 @@ def ask_user_questions(): allow_empty=True) if archinstall.arguments.get('harddrives', None): - archinstall.storage['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives']) + archinstall.arguments['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: @@ -112,8 +112,8 @@ def ask_user_questions(): if archinstall.arguments['harddrives'] and archinstall.arguments.get('!encryption-password', None): # If no partitions was marked as encrypted, but a password was supplied and we have some disks to format.. # Then we need to identify which partitions to encrypt. This will default to / (root). - if len(list(archinstall.encrypted_partitions(archinstall.storage['disk_layouts']))) == 0: - archinstall.storage['disk_layouts'] = archinstall.select_encrypted_partitions(archinstall.storage['disk_layouts'], archinstall.arguments['!encryption-password']) + if len(list(archinstall.encrypted_partitions(archinstall.arguments['disk_layouts']))) == 0: + archinstall.arguments['disk_layouts'] = archinstall.select_encrypted_partitions(archinstall.arguments['disk_layouts'], archinstall.arguments['!encryption-password']) # Ask which boot-loader to use (will only ask if we're in BIOS (non-efi) mode) if not archinstall.arguments.get("bootloader", None): @@ -207,7 +207,7 @@ def perform_filesystem_operations(): archinstall.log(user_configuration, level=logging.INFO) with open("/var/log/archinstall/user_configuration.json", "w") as config_file: config_file.write(user_configuration) - user_disk_layout = json.dumps(archinstall.storage['disk_layouts'], indent=4, sort_keys=True, cls=archinstall.JSON) + user_disk_layout = json.dumps(archinstall.arguments['disk_layouts'], indent=4, sort_keys=True, cls=archinstall.JSON) archinstall.log(user_disk_layout, level=logging.INFO) with open("/var/log/archinstall/user_disk_layout.json", "w") as disk_layout_file: disk_layout_file.write(user_disk_layout) @@ -238,7 +238,7 @@ def perform_filesystem_operations(): for drive in archinstall.arguments['harddrives']: with archinstall.Filesystem(drive, mode) as fs: - fs.load_layout(archinstall.storage['disk_layouts'][drive]) + fs.load_layout(archinstall.arguments['disk_layouts'][drive]) def perform_installation(mountpoint): @@ -250,7 +250,7 @@ def perform_installation(mountpoint): with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', 'linux')) as installation: # Mount all the drives to the desired mountpoint # This *can* be done outside of the installation, but the installer can deal with it. - installation.mount_ordered_layout(archinstall.storage['disk_layouts']) + installation.mount_ordered_layout(archinstall.arguments['disk_layouts']) # if len(mirrors): # Certain services might be running that affects the system during installation. -- cgit v1.2.3-70-g09d2 From 8dd097da0524d8a3e2d784ab7821a08e051b82cf Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 15 Sep 2021 17:36:54 +0200 Subject: Reverted last change, and improved it. By passing it through load_config and tweaking the read structure a bit, it worked out better if the accessed values are in archinstall.storage instead. --- examples/guided.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index 7574f39f..0813e2ef 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -51,6 +51,9 @@ def load_config(): archinstall.storage['gfx_driver_packages'] = AVAILABLE_GFX_DRIVERS.get(archinstall.arguments.get('gfx_driver', None), None) if archinstall.arguments.get('servers', None) is not None: archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None) + if archinstall.arguments.get('disk_layouts', None) is not None: + archinstall.storage['disk_layouts'] = {archinstall.BlockDevice(disk) : struct for disk, struct in archinstall.arguments['disk_layouts']} + def ask_user_questions(): """ @@ -102,7 +105,7 @@ def ask_user_questions(): allow_empty=True) if archinstall.arguments.get('harddrives', None): - archinstall.arguments['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives']) + 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: @@ -112,8 +115,8 @@ def ask_user_questions(): if archinstall.arguments['harddrives'] and archinstall.arguments.get('!encryption-password', None): # If no partitions was marked as encrypted, but a password was supplied and we have some disks to format.. # Then we need to identify which partitions to encrypt. This will default to / (root). - if len(list(archinstall.encrypted_partitions(archinstall.arguments['disk_layouts']))) == 0: - archinstall.arguments['disk_layouts'] = archinstall.select_encrypted_partitions(archinstall.arguments['disk_layouts'], archinstall.arguments['!encryption-password']) + if len(list(archinstall.encrypted_partitions(archinstall.storage['disk_layouts']))) == 0: + archinstall.storage['disk_layouts'] = archinstall.select_encrypted_partitions(archinstall.storage['disk_layouts'], archinstall.arguments['!encryption-password']) # Ask which boot-loader to use (will only ask if we're in BIOS (non-efi) mode) if not archinstall.arguments.get("bootloader", None): @@ -207,7 +210,7 @@ def perform_filesystem_operations(): archinstall.log(user_configuration, level=logging.INFO) with open("/var/log/archinstall/user_configuration.json", "w") as config_file: config_file.write(user_configuration) - user_disk_layout = json.dumps(archinstall.arguments['disk_layouts'], indent=4, sort_keys=True, cls=archinstall.JSON) + user_disk_layout = json.dumps(archinstall.storage['disk_layouts'], indent=4, sort_keys=True, cls=archinstall.JSON) archinstall.log(user_disk_layout, level=logging.INFO) with open("/var/log/archinstall/user_disk_layout.json", "w") as disk_layout_file: disk_layout_file.write(user_disk_layout) @@ -238,7 +241,7 @@ def perform_filesystem_operations(): for drive in archinstall.arguments['harddrives']: with archinstall.Filesystem(drive, mode) as fs: - fs.load_layout(archinstall.arguments['disk_layouts'][drive]) + fs.load_layout(archinstall.storage['disk_layouts'][drive]) def perform_installation(mountpoint): @@ -250,7 +253,7 @@ def perform_installation(mountpoint): with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', 'linux')) as installation: # Mount all the drives to the desired mountpoint # This *can* be done outside of the installation, but the installer can deal with it. - installation.mount_ordered_layout(archinstall.arguments['disk_layouts']) + installation.mount_ordered_layout(archinstall.storage['disk_layouts']) # if len(mirrors): # Certain services might be running that affects the system during installation. -- cgit v1.2.3-70-g09d2 From d6acfec799280b764bf50e1623fb4608cc9a7742 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 15 Sep 2021 19:01:14 +0200 Subject: Updating support for --disk_layouts. It now supports file paths as well as JSON in string format via --disk_layouts= --- examples/guided.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index 0813e2ef..a3c0db2d 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,6 +1,7 @@ import json import logging import os +import pathlib import time import archinstall @@ -52,6 +53,14 @@ def load_config(): if archinstall.arguments.get('servers', None) is not None: archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None) if archinstall.arguments.get('disk_layouts', None) is not None: + if (dl_path := pathlib.Path(archinstall.arguments['disk_layouts'])).exists() and str(dl_path).endswith('.json'): + with open(dl_path) as fh: + archinstall.arguments['disk_layouts'] = json.load(fh) + else: + try: + archinstall.arguments['disk_layouts'] = json.loads(archinstall.arguments['disk_layouts']) + except: + raise ValueError("--disk_layouts= needs either a JSON file or a JSON string given with a valid disk layout.") archinstall.storage['disk_layouts'] = {archinstall.BlockDevice(disk) : struct for disk, struct in archinstall.arguments['disk_layouts']} -- cgit v1.2.3-70-g09d2 From 1a7056efc40a336a855be353f549af0eb7e0fca9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 15 Sep 2021 19:09:57 +0200 Subject: Might be redundant, but if the JSON file given to --config contains a list it will break the .split(), but if --harddrives is given as an argument, then we need to split. So adding a type-check --- examples/guided.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index a3c0db2d..e5cf2d38 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -29,7 +29,9 @@ archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", def load_config(): if archinstall.arguments.get('harddrives', None) is not None: - archinstall.arguments['harddrives'] = [archinstall.BlockDevice(BlockDev) for BlockDev in archinstall.arguments['harddrives'].split(',')] + if type(archinstall.arguments['harddrives']) is str: + archinstall.arguments['harddrives'] = archinstall.arguments['harddrives'].split(',') + archinstall.arguments['harddrives'] = [archinstall.BlockDevice(BlockDev) for BlockDev in archinstall.arguments['harddrives']] # Temporarily disabling keep_partitions if config file is loaded # Temporary workaround to make Desktop Environments work if archinstall.arguments.get('profile', None) is not None: -- cgit v1.2.3-70-g09d2 From 2cfbafc6534ebcca7e8d52be263aed4d54c04914 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 15 Sep 2021 19:16:30 +0200 Subject: More error handling and fixed a spelling error. --- examples/guided.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index e5cf2d38..10f4c9eb 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -56,14 +56,17 @@ def load_config(): archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None) if archinstall.arguments.get('disk_layouts', None) is not None: if (dl_path := pathlib.Path(archinstall.arguments['disk_layouts'])).exists() and str(dl_path).endswith('.json'): - with open(dl_path) as fh: - archinstall.arguments['disk_layouts'] = json.load(fh) + try: + with open(dl_path) as fh: + archinstall.arguments['disk_layouts'] = json.load(fh) + except Exception as e: + raise ValueError(f"--disk_layouts does not contain a valid JSON format: {e}") else: try: archinstall.arguments['disk_layouts'] = json.loads(archinstall.arguments['disk_layouts']) except: raise ValueError("--disk_layouts= needs either a JSON file or a JSON string given with a valid disk layout.") - archinstall.storage['disk_layouts'] = {archinstall.BlockDevice(disk) : struct for disk, struct in archinstall.arguments['disk_layouts']} + archinstall.storage['disk_layouts'] = {archinstall.BlockDevice(disk) : struct for disk, struct in archinstall.arguments['disk_layouts'].items()} def ask_user_questions(): -- cgit v1.2.3-70-g09d2 From e6549c1edbb63e255a8a6d971953bbbe1ab2d3c5 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 15 Sep 2021 19:17:32 +0200 Subject: Fixing type issue with conversion to multiple disk logic. --- examples/guided.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index 10f4c9eb..b3f1b14b 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -112,7 +112,9 @@ 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'].split(',')] + if type(archinstall.arguments['harddrives']) is str: + archinstall.arguments['harddrives'] = archinstall.arguments['harddrives'].split(',') + archinstall.arguments['harddrives'] = [archinstall.BlockDevice(BlockDev) for BlockDev in archinstall.arguments['harddrives']] 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): ", -- cgit v1.2.3-70-g09d2 From 70af00f33dd903e1bc70a996854861038a2d919c Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 15 Sep 2021 19:23:35 +0200 Subject: Tweaked the logic for parsing the --harddrives parameter. --- examples/guided.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index b3f1b14b..b0f6f699 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -113,8 +113,7 @@ def ask_user_questions(): # and convert them into archinstall.BlockDevice() objects. if archinstall.arguments.get('harddrives', None): if type(archinstall.arguments['harddrives']) is str: - archinstall.arguments['harddrives'] = archinstall.arguments['harddrives'].split(',') - 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): ", -- cgit v1.2.3-70-g09d2 From 9e67ce3f05bb813c997c3c2bc874c4d6ed83c5d6 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 15 Sep 2021 20:11:40 +0200 Subject: Making sure the drive paths are in the JSON structure, and not the class object, as it won't work seamlessly to access for instance storage['disk_layouts'][ClassInstance()] if it's not the identical mem copy of the object we're accessing, so strings are better for storage/comparisons. --- archinstall/lib/disk.py | 18 +++++++++--------- archinstall/lib/user_interaction.py | 2 +- examples/guided.py | 16 +++++----------- 3 files changed, 15 insertions(+), 21 deletions(-) (limited to 'examples') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index a700c2a0..3628a4b0 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -114,13 +114,13 @@ def suggest_single_disk_layout(block_device): MIN_SIZE_TO_ALLOW_HOME_PART = 40 # Gb layout = { - block_device : { + block_device.path : { "wipe" : True, "partitions" : [] } } - layout[block_device]['partitions'].append({ + layout[block_device.path]['partitions'].append({ # Boot "type" : "primary", "start" : "1MiB", @@ -133,7 +133,7 @@ def suggest_single_disk_layout(block_device): "format" : "fat32" } }) - layout[block_device]['partitions'].append({ + layout[block_device.path]['partitions'].append({ # Root "type" : "primary", "start" : "513MiB", @@ -147,7 +147,7 @@ def suggest_single_disk_layout(block_device): }) if block_device.size >= MIN_SIZE_TO_ALLOW_HOME_PART: - layout[block_device]['partitions'].append({ + layout[block_device.path]['partitions'].append({ # Home "type" : "primary", "encrypted" : False, @@ -175,17 +175,17 @@ def suggest_multi_disk_layout(block_devices): log(f"Suggesting multi-disk-layout using {len(block_devices)} disks, where {root_device} will be /root and {home_device} will be /home", level=logging.DEBUG) layout = { - root_device : { + root_device.path : { "wipe" : True, "partitions" : [] }, - home_device : { + home_device.path : { "wipe" : True, "partitions" : [] }, } - layout[root_device]['partitions'].append({ + layout[root_device.path]['partitions'].append({ # Boot "type" : "primary", "start" : "1MiB", @@ -198,7 +198,7 @@ def suggest_multi_disk_layout(block_devices): "format" : "fat32" } }) - layout[root_device]['partitions'].append({ + layout[root_device.path]['partitions'].append({ # Root "type" : "primary", "start" : "513MiB", @@ -211,7 +211,7 @@ def suggest_multi_disk_layout(block_devices): } }) - layout[home_device]['partitions'].append({ + layout[home_device.path]['partitions'].append({ # Home "type" : "primary", "encrypted" : False, diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b017e41a..6854ccfd 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -751,7 +751,7 @@ def select_individual_blockdevice_usage(block_devices :list): for device in block_devices: layout = manage_new_and_existing_partitions(device) - result[device] = layout + result[device.path] = layout return result diff --git a/examples/guided.py b/examples/guided.py index b0f6f699..b7c75b30 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -58,16 +58,14 @@ def load_config(): if (dl_path := pathlib.Path(archinstall.arguments['disk_layouts'])).exists() and str(dl_path).endswith('.json'): try: with open(dl_path) as fh: - archinstall.arguments['disk_layouts'] = json.load(fh) + archinstall.storage['disk_layouts'] = json.load(fh) except Exception as e: raise ValueError(f"--disk_layouts does not contain a valid JSON format: {e}") else: try: - archinstall.arguments['disk_layouts'] = json.loads(archinstall.arguments['disk_layouts']) + archinstall.storage['disk_layouts'] = json.loads(archinstall.arguments['disk_layouts']) except: raise ValueError("--disk_layouts= needs either a JSON file or a JSON string given with a valid disk layout.") - archinstall.storage['disk_layouts'] = {archinstall.BlockDevice(disk) : struct for disk, struct in archinstall.arguments['disk_layouts'].items()} - def ask_user_questions(): """ @@ -111,15 +109,12 @@ 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): - if type(archinstall.arguments['harddrives']) is str: - archinstall.arguments['harddrives'] = [archinstall.BlockDevice(BlockDev) for BlockDev in archinstall.arguments['harddrives'].split(',')] - else: + if archinstall.arguments.get('harddrives', None) is None: 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): ", allow_empty=True) - if archinstall.arguments.get('harddrives', None): + if archinstall.arguments.get('harddrives', None) is not None and archinstall.storage.get('disk_layouts', None) is None: archinstall.storage['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives']) # Get disk encryption password (or skip if blank) @@ -256,8 +251,7 @@ def perform_filesystem_operations(): for drive in archinstall.arguments['harddrives']: with archinstall.Filesystem(drive, mode) as fs: - fs.load_layout(archinstall.storage['disk_layouts'][drive]) - + fs.load_layout(archinstall.storage['disk_layouts'][drive.path]) def perform_installation(mountpoint): """ -- cgit v1.2.3-70-g09d2 From ffe38c879acf59da3f9d25ba866608ff6d6db64d Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Sun, 19 Sep 2021 15:49:44 +0300 Subject: general: remove all found white-spaces Also this change adds new line at the end for some scripts --- CONTRIBUTING.md | 3 +-- README.md | 1 - archinstall/lib/disk.py | 2 +- archinstall/lib/plugins.py | 2 +- archinstall/lib/user_interaction.py | 14 +++++++------- examples/guided.py | 4 ++-- setup.cfg | 2 +- 7 files changed, 13 insertions(+), 15 deletions(-) (limited to 'examples') diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a92cff91..ca4aa9e3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,7 @@ # Contributing to archinstall Any contributions through pull requests are welcome as this project aims to be a community based project to ease some Arch Linux installation steps. -Bear in mind that in the future this repo might be transferred to the official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/) - *(if GitLab becomes open to the general public)*. +Bear in mind that in the future this repo might be transferred to the official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/) *(if GitLab becomes open to the general public)*. Therefore, guidelines and style changes to the code might come into effect as well as guidelines surrounding bug reporting and discussions. diff --git a/README.md b/README.md index 5c6c9157..c8a23f5a 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,6 @@ with archinstall.Installer('/mnt') as installation: installation.user_create('devel', 'devel') installation.user_set_pw('root', 'airoot') - ``` This installer will perform the following: diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 872d9bfc..5b92e1e1 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -1069,4 +1069,4 @@ def find_partition_by_mountpoint(block_devices, relative_mountpoint :str): for device in block_devices: for partition in block_devices[device]['partitions']: if partition.get('mountpoint', None) == relative_mountpoint: - return partition \ No newline at end of file + return partition diff --git a/archinstall/lib/plugins.py b/archinstall/lib/plugins.py index 24fbd8ee..dab5d2b0 100644 --- a/archinstall/lib/plugins.py +++ b/archinstall/lib/plugins.py @@ -98,4 +98,4 @@ def load_plugin(path :str): # -> module (not sure how to write that in type defi log(err, level=logging.ERROR) log(f"The above error was detected when initiating the plugin: {path}", fg="red", level=logging.ERROR) else: - log(f"Plugin '{path}' is missing a valid entry-point or is corrupt.", fg="yellow", level=logging.WARNING) \ No newline at end of file + log(f"Plugin '{path}' is missing a valid entry-point or is corrupt.", fg="yellow", level=logging.WARNING) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 6854ccfd..4ec265d4 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -575,14 +575,14 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict: # log(f"Selecting which partitions to re-use on {block_device}...", fg="yellow", level=logging.INFO) # partitions = generic_multi_select(block_device.partitions.values(), "Select which partitions to re-use (the rest will be left alone): ", sort=True) # partitions_to_wipe = generic_multi_select(partitions, "Which partitions do you wish to wipe (multiple can be selected): ", sort=True) - + # mountpoints = {} # struct = { # "partitions" : [] # } # for partition in partitions: # mountpoint = input(f"Select a mountpoint (or skip) for {partition}: ").strip() - + # part_struct = {} # if mountpoint: # part_struct['mountpoint'] = mountpoint @@ -590,7 +590,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict: # part_struct['boot'] = True # if has_uefi(): # part_struct['ESP'] = True - # elif mountpoint == '/' and + # elif mountpoint == '/' and # if partition.uuid: # part_struct['PARTUUID'] = partition.uuid # if partition in partitions_to_wipe: @@ -632,15 +632,15 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict: if not task: break - + if task == 'Create a new partition': if partition_type == 'gpt': # https://www.gnu.org/software/parted/manual/html_node/mkpart.html # https://www.gnu.org/software/parted/manual/html_node/mklabel.html name = input("Enter a desired name for the partition: ").strip() - + fstype = input("Enter a desired filesystem type for the partition: ").strip() - + start = input(f"Enter the start sector (percentage or block number, default: {block_device.largest_free_space[0]}): ").strip() if not start.strip(): start = block_device.largest_free_space[0] @@ -750,7 +750,7 @@ def select_individual_blockdevice_usage(block_devices :list): for device in block_devices: layout = manage_new_and_existing_partitions(device) - + result[device.path] = layout return result diff --git a/examples/guided.py b/examples/guided.py index b7c75b30..8353b76b 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -66,7 +66,7 @@ def load_config(): archinstall.storage['disk_layouts'] = json.loads(archinstall.arguments['disk_layouts']) except: raise ValueError("--disk_layouts= needs either a JSON file or a JSON string given with a valid disk layout.") - + def ask_user_questions(): """ First, we'll ask the user for a bunch of user input. @@ -371,4 +371,4 @@ if not archinstall.arguments.get('silent'): ask_user_questions() perform_filesystem_operations() -perform_installation(archinstall.storage.get('MOUNT_POINT', '/mnt')) \ No newline at end of file +perform_installation(archinstall.storage.get('MOUNT_POINT', '/mnt')) diff --git a/setup.cfg b/setup.cfg index e5d79ef3..661c2cf6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,7 +29,7 @@ include = archinstall.* [options.package_data] -archinstall = +archinstall = examples/*.py profiles/*.py profiles/applications/*.py -- cgit v1.2.3-70-g09d2