index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | examples/only_hd.py | 71 |
diff --git a/examples/only_hd.py b/examples/only_hd.py index 835c4292..cc60a3b9 100644 --- a/examples/only_hd.py +++ b/examples/only_hd.py @@ -4,41 +4,41 @@ import pathlib import archinstall -def ask_harddrives(): - # Ask which harddrives/block-devices we will install to - # and convert them into archinstall.BlockDevice() objects. - 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 not archinstall.arguments['harddrives']: - archinstall.log("You decided to skip harddrive selection",fg="red",level=logging.INFO) - archinstall.log(f"and will use whatever drive-setup is mounted at {archinstall.storage['MOUNT_POINT']} (experimental)",fg="red",level=logging.INFO) - archinstall.log("WARNING: Archinstall won't check the suitability of this setup",fg="red",level=logging.INFO) - if input("Do you wish to continue ? [Y/n]").strip().lower() == 'n': - exit(1) - else: - if archinstall.arguments.get('disk_layouts', None) is None: - archinstall.arguments['disk_layouts'] = archinstall.select_disk_layout(archinstall.arguments['harddrives'], archinstall.arguments.get('advanced', False)) - +class OnlyHDMenu(archinstall.GlobalMenu): + def _setup_selection_menu_options(self): + super()._setup_selection_menu_options() + options_list = [] + mandatory_list = [] + options_list = ['harddrives', 'disk_layouts', '!encryption-password','swap'] + mandatory_list = ['harddrives'] + options_list.extend(['install','abort']) + + for entry in self._menu_options: + if entry in options_list: + # for not lineal executions, only self.option(entry).set_enabled and set_mandatory are necessary + if entry in mandatory_list: + self.enable(entry,mandatory=True) + else: + self.enable(entry) + else: + self.option(entry).set_enabled(False) + self._update_install() + + def _missing_configs(self): + """ overloaded method """ + def check(s): + return self.option(s).has_selection() + # Get disk encryption password (or skip if blank) if archinstall.arguments.get('!encryption-password', None) is None: if passwd := archinstall.get_password(prompt=str(_('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.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): - archinstall.arguments["bootloader"] = archinstall.ask_for_bootloader(archinstall.arguments.get('advanced', False)) - - if not archinstall.arguments.get('swap', None): - archinstall.arguments['swap'] = archinstall.ask_for_swap() + _, missing = self.mandatory_overview() + if check('harddrives'): + if not self.option('harddrives').is_empty() and not check('disk_layouts'): + missing += 1 + return missing def ask_user_questions(): """ @@ -46,7 +46,11 @@ def ask_user_questions(): Not until we're satisfied with what we want to install will we continue with the actual installation steps. """ - ask_harddrives() + with OnlyHDMenu(data_store=archinstall.arguments) as menu: + # We select the execution language separated + menu.exec_option('archinstall-language') + menu.option('archinstall-language').set_enabled(False) + menu.run() def perform_disk_operations(): """ @@ -56,7 +60,6 @@ def perform_disk_operations(): if archinstall.arguments.get('harddrives', None): print(f" ! Formatting {archinstall.arguments['harddrives']} in ", end='') archinstall.do_countdown() - """ Setup the blockdevice, filesystem (and optionally encryption). Once that's done, we'll hand over to perform_installation() @@ -66,9 +69,9 @@ def perform_disk_operations(): mode = archinstall.MBR for drive in archinstall.arguments.get('harddrives', []): - if dl_disk := archinstall.arguments.get('disk_layouts', {}).get(drive.path): + if archinstall.arguments.get('disk_layouts', {}).get(drive.path): with archinstall.Filesystem(drive, mode) as fs: - fs.load_layout(dl_disk) + fs.load_layout(archinstall.arguments['disk_layouts'][drive.path]) def perform_installation(mountpoint): """ |