index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton.feeds+github@gmail.com> | 2020-07-06 18:44:42 +0200 |
---|---|---|
committer | Anton Hvornum <anton.feeds+github@gmail.com> | 2020-07-06 18:44:42 +0200 |
commit | b4a6f03b962d9309a1a18bd6de6a50a0146252a1 (patch) | |
tree | bcdc2041ab9fe8733760fbe5d1d9f344923ceb0a /archinstall/lib/user_interaction.py | |
parent | ff9475ffe49d4ff8bca2b7fc1b6f8105e5277745 (diff) |
-rw-r--r-- | archinstall/lib/user_interaction.py | 17 |
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py new file mode 100644 index 00000000..bd6d117c --- /dev/null +++ b/archinstall/lib/user_interaction.py @@ -0,0 +1,17 @@ +from .exceptions import * + +def select_disk(dict_o_disks): + drives = sorted(list(dict_o_disks.keys())) + 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 = dict_o_disks[drives[int(drive)]] + elif drive in dict_o_disks: + drive = dict_o_disks[drive] + else: + raise DiskError(f'Selected drive does not exist: "{drive}"') + return drive + + raise DiskError('select_disk() requires a non-empty dictionary of disks to select from.')
\ No newline at end of file |