Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction.py
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/user_interaction.py')
-rw-r--r--archinstall/lib/user_interaction.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index ba6259b1..e62d8c6c 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -10,14 +10,13 @@ import sys
import time
from .disk import BlockDevice, valid_fs_type, find_partition_by_mountpoint, suggest_single_disk_layout, suggest_multi_disk_layout, valid_parted_position
-from .exceptions import *
-from .general import SysCommand
+from .exceptions import RequirementError, UserError, DiskError
from .hardware import AVAILABLE_GFX_DRIVERS, has_uefi, has_amd_graphics, has_intel_graphics, has_nvidia_graphics
from .locale_helpers import list_keyboard_languages, verify_keyboard_layout, search_keyboard_layout
from .networking import list_interfaces
from .output import log
from .profiles import Profile, list_profiles
-from .storage import *
+from .storage import storage
# TODO: Some inconsistencies between the selection processes.
# Some return the keys from the options, some the values?
@@ -201,11 +200,11 @@ def select_encrypted_partitions(block_devices :dict, password :str) -> dict:
return block_devices
# TODO: Next version perhaps we can support multiple encrypted partitions
- #options = []
- #for partition in block_devices.values():
- # options.append({key: val for key, val in partition.items() if val})
+ # options = []
+ # for partition in block_devices.values():
+ # options.append({key: val for key, val in partition.items() if val})
- #print(generic_multi_select(options, f"Choose which partitions to encrypt (leave blank when done): "))
+ # print(generic_multi_select(options, f"Choose which partitions to encrypt (leave blank when done): "))
class MiniCurses:
def __init__(self, width, height):
@@ -326,6 +325,10 @@ class MiniCurses:
return response
+def ask_for_swap(prompt='Would you like to use swap on zram? (Y/n): ', forced=False):
+ return True if input(prompt).strip(' ').lower() not in ('n', 'no') else False
+
+
def ask_for_superuser_account(prompt='Username for required superuser with sudo privileges: ', forced=False):
while 1:
new_user = input(prompt).strip(' ')
@@ -567,10 +570,10 @@ def get_default_partition_layout(block_devices):
# TODO: Implement sane generic layout for 2+ drives
def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
- if has_uefi():
- partition_type = 'gpt'
- else:
- partition_type = 'msdos'
+ # if has_uefi():
+ # partition_type = 'gpt'
+ # else:
+ # partition_type = 'msdos'
# 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)
@@ -600,7 +603,6 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
# return struct
- mountpoints = {}
block_device_struct = {
"partitions" : [partition.__dump__() for partition in block_device.partitions.values()]
}
@@ -634,10 +636,10 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
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()
+ # 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()
@@ -674,7 +676,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict:
if input(f"{block_device} contains queued partitions, this will remove those, are you sure? y/N: ").strip().lower() in ('', 'n'):
continue
- block_device_struct.update( suggest_single_disk_layout(block_device)[block_device.path] )
+ block_device_struct.update(suggest_single_disk_layout(block_device)[block_device.path])
elif task is None:
return block_device_struct
else: