Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/user_guides.py
diff options
context:
space:
mode:
authorDaniel <blackrabbit256@gmail.com>2022-02-03 00:26:09 +1100
committerGitHub <noreply@github.com>2022-02-02 14:26:09 +0100
commit37d6da7e4eb8897dfb80797f28db85ccdd09d376 (patch)
treee905face839487c47a246b521bf905e47d2fb8cb /archinstall/lib/disk/user_guides.py
parentd3cf8a3655fe258a6291c05f94c7e3cff2a91a62 (diff)
Migrate old input to new menu (#874)
* Migrate old input to new menu * Fix imports * Remove imports * Update * Fixed import by changing 'import archinstall', to 'from ..menu import Menu' and use Menu() directly * Converted archinstall.<thing> to from ..where import <thing>. This enables us to use archinstall as a module, a git repository in testing and other things without having to install archinstall as an actual module. Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com> Co-authored-by: Anton Hvornum <anton@hvornum.se>
Diffstat (limited to 'archinstall/lib/disk/user_guides.py')
-rw-r--r--archinstall/lib/disk/user_guides.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/archinstall/lib/disk/user_guides.py b/archinstall/lib/disk/user_guides.py
index 25db14ea..8acb8cd2 100644
--- a/archinstall/lib/disk/user_guides.py
+++ b/archinstall/lib/disk/user_guides.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import logging
from typing import Optional, Dict, Any, List, TYPE_CHECKING
+
# https://stackoverflow.com/a/39757388/929999
if TYPE_CHECKING:
from .blockdevice import BlockDevice
@@ -8,6 +9,7 @@ if TYPE_CHECKING:
from .helpers import sort_block_devices_based_on_performance, select_largest_device, select_disk_larger_than_or_close_to
from ..hardware import has_uefi
from ..output import log
+from ..menu import Menu
def suggest_single_disk_layout(block_device :BlockDevice,
default_filesystem :Optional[str] = None,
@@ -22,7 +24,9 @@ def suggest_single_disk_layout(block_device :BlockDevice,
using_home_partition = False
if default_filesystem == 'btrfs':
- using_subvolumes = input('Would you like to use BTRFS subvolumes with a default structure? (Y/n): ').strip().lower() in ('', 'y', 'yes')
+ prompt = 'Would you like to use BTRFS subvolumes with a default structure?'
+ choice = Menu(prompt, ['yes', 'no'], skip=False, default_option='yes').run()
+ using_subvolumes = choice == 'yes'
layout = {
block_device.path : {
@@ -76,7 +80,9 @@ def suggest_single_disk_layout(block_device :BlockDevice,
layout[block_device.path]['partitions'][-1]['start'] = '513MiB'
if not using_subvolumes and block_device.size >= MIN_SIZE_TO_ALLOW_HOME_PART:
- using_home_partition = input('Would you like to create a separate partition for /home? (Y/n): ').strip().lower() in ('', 'y', 'yes')
+ prompt = 'Would you like to create a separate partition for /home?'
+ choice = Menu(prompt, ['yes', 'no'], skip=False, default_option='yes').run()
+ using_home_partition = choice == 'yes'
# Set a size for / (/root)
if using_subvolumes or block_device.size < MIN_SIZE_TO_ALLOW_HOME_PART or not using_home_partition: