Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Llácer <wllacer@gmail.com>2022-01-02 12:01:19 +0100
committerGitHub <noreply@github.com>2022-01-02 12:01:19 +0100
commite388537bc36534fe782e1e68a70ddcdb2e13e99a (patch)
tree785d100a25e89819764daf792e84f0f8a92975b7
parentb7cb77caf9675029fad03ff1f34c42ca7a89b7f1 (diff)
better handling the skip partitioning option. (#778)
* better handling the skip partitioning option. plus sending some warnings to the user * device configuration options taken out from ask_user_questions. Forced by flake8 * Revert "device configuration options taken out from ask_user_questions." This reverts commit 1b3cffb3dfb165433bcf839151f1a719300fd891. * Adapted to new selection ui * Cleanup of obsolete code * Changed colour of skip messages from red to yellow * Flake8 comments
-rw-r--r--examples/guided.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/examples/guided.py b/examples/guided.py
index e8efb6cb..c394e596 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -96,20 +96,27 @@ def ask_user_questions():
# and convert them into archinstall.BlockDevice() objects.
if archinstall.arguments.get('harddrives', None) is None:
archinstall.arguments['harddrives'] = archinstall.select_harddrives()
-
- if archinstall.arguments.get('harddrives', None) and archinstall.storage.get('disk_layouts', None) is None:
- archinstall.storage['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives'], archinstall.arguments.get('advanced', False))
-
- # 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): '):
- archinstall.arguments['!encryption-password'] = passwd
-
- 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'])
+ # we skip the customary .get('harddrives',None) 'cause we are pretty certain that at this point it contains at least none (behaviour has changed from previous version, where it had an empty list. Shouls be compatible with my code
+ if not archinstall.arguments['harddrives']:
+ archinstall.log("You decided to skip harddrive selection",fg="yellow",level=logging.INFO)
+ archinstall.log(f"and will use whatever drive-setup is mounted at {archinstall.storage['MOUNT_POINT']} (experimental)",fg="yellow",level=logging.INFO)
+ archinstall.log("WARNING: Archinstall won't check the suitability of this setup",fg="yellow",level=logging.INFO)
+ if input("Do you wish to continue ? [Y/n]").strip().lower() == 'n':
+ exit(1)
+ else:
+ if archinstall.storage.get('disk_layouts', None) is None:
+ archinstall.storage['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives'], archinstall.arguments.get('advanced', False))
+
+ # Get disk encryption password (or skip if blank)
+ if archinstall.arguments.get('!encryption-password', None) is None:
+ if passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): '):
+ archinstall.arguments['!encryption-password'] = passwd
+
+ if 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'])
# Ask which boot-loader to use (will only ask if we're in BIOS (non-efi) mode)
if not archinstall.arguments.get("bootloader", None):