From 00b28377f6ae330ff05d9e72d8a9badffa2a3357 Mon Sep 17 00:00:00 2001 From: le Date: Thu, 30 Mar 2023 21:39:26 +0800 Subject: [PATCH] additional package install --- archinstall/lib/menu/global_menu.py | 26 +- .../lib/user_interaction/general_conf.py | 530 +++++++++--------- examples/guided.py | 39 +- 3 files changed, 327 insertions(+), 268 deletions(-) diff --git a/archinstall/lib/menu/global_menu.py b/archinstall/lib/menu/global_menu.py index 7c7d2df..14917a8 100644 --- a/archinstall/lib/menu/global_menu.py +++ b/archinstall/lib/menu/global_menu.py @@ -188,12 +188,27 @@ class GlobalMenu(GeneralMenu): _('Base Image'), func=lambda preset: select_base_image(preset), default='runtime') + # self._menu_options['base_image'] = \ + # Selector( + # _('Base Image'), + # func=lambda preset: select_base_image(preset), + # default='runtime') + # self._menu_options['harddrives'] = \ + # Selector( + # _('Drive(s)'), + # lambda preset: self._select_harddrives(preset), + # display_func=lambda x: f'{len(x)} ' + str(_('Drive(s)')) if x is not None and len(x) > 0 else '', + # preview_func=self._prev_harddrives, + # ) self._menu_options['packages'] = \ Selector( _('Additional packages'), # lambda x: ask_additional_packages_to_install(storage['arguments'].get('packages', None)), - ask_additional_packages_to_install, - default=[]) + lambda preset: self._select_additional_packages(preset), + display_func=lambda x: f'{len(x)} ' + str(_('package(s)')) if x is not None and len(x) > 0 else '', + default=[], + dependencies=['base_image_develop']) + self._menu_options['additional-repositories'] = \ Selector( _('Optional repositories'), @@ -382,6 +397,9 @@ class GlobalMenu(GeneralMenu): if not self._menu_options['harddrives'].is_empty() and not check('disk_layouts'): missing += [str(_('Disk layout'))] + if storage['arguments'].get('used_lvm_partition',False): + if not check('lvmdrives'): + missing += [str(_('LVM(s)'))] return missing def _set_root_password(self) -> Optional[str]: @@ -515,3 +533,7 @@ class GlobalMenu(GeneralMenu): def _create_user_account(self, defined_users: List[User]) -> List[User]: users = ask_for_additional_users(defined_users=defined_users) return users + + def _select_additional_packages(self, old_packages: List[str] = []) -> List: + select_packages = ask_additional_packages_to_install(old_packages) + return select_packages \ No newline at end of file diff --git a/archinstall/lib/user_interaction/general_conf.py b/archinstall/lib/user_interaction/general_conf.py index f0cedbe..9f6aa59 100644 --- a/archinstall/lib/user_interaction/general_conf.py +++ b/archinstall/lib/user_interaction/general_conf.py @@ -20,334 +20,338 @@ from ..translationhandler import Language, TranslationHandler from ..packages.packages import validate_package_list from ..storage import storage +import time if TYPE_CHECKING: - _: Any + _: Any def ask_ntp(preset: bool = True) -> bool: - prompt = str(_('Would you like to use automatic time synchronization (NTP) with the default time servers?\n')) - prompt += str(_('Hardware time and other post-configuration steps might be required in order for NTP to work.\nFor more information, please check the Arch wiki')) - if preset: - preset_val = Menu.yes() - else: - preset_val = Menu.no() - choice = Menu(prompt, Menu.yes_no(), skip=False, preset_values=preset_val, default_option=Menu.yes()).run() + prompt = str(_('Would you like to use automatic time synchronization (NTP) with the default time servers?\n')) + prompt += str(_('Hardware time and other post-configuration steps might be required in order for NTP to work.\nFor more information, please check the Arch wiki')) + if preset: + preset_val = Menu.yes() + else: + preset_val = Menu.no() + choice = Menu(prompt, Menu.yes_no(), skip=False, preset_values=preset_val, default_option=Menu.yes()).run() - return False if choice.value == Menu.no() else True + return False if choice.value == Menu.no() else True def ask_hostname(preset: str = None) -> str: - hostname = TextInput(_('Desired hostname for the installation: '), preset).run().strip(' ') - return hostname + hostname = TextInput(_('Desired hostname for the installation: '), preset).run().strip(' ') + return hostname def ask_for_a_timezone(preset: str = None) -> str: - timezones = list_timezones() - default = 'UTC' + timezones = list_timezones() + default = 'UTC' - choice = Menu( - _('Select a timezone'), - list(timezones), - preset_values=preset, - default_option=default - ).run() + choice = Menu( + _('Select a timezone'), + list(timezones), + preset_values=preset, + default_option=default + ).run() - if choice.type_ == MenuSelectionType.Esc: - return preset - elif choice.type_ == MenuSelectionType.Selection: - return choice.value + if choice.type_ == MenuSelectionType.Esc: + return preset + elif choice.type_ == MenuSelectionType.Selection: + return choice.value def ask_for_audio_selection(desktop: bool = True, preset: str = None) -> str: - no_audio = str(_('No audio server')) - choices = ['pipewire', 'pulseaudio'] if desktop else ['pipewire', 'pulseaudio', no_audio] - default = 'pipewire' if desktop else no_audio + no_audio = str(_('No audio server')) + choices = ['pipewire', 'pulseaudio'] if desktop else ['pipewire', 'pulseaudio', no_audio] + default = 'pipewire' if desktop else no_audio - choice = Menu(_('Choose an audio server'), choices, preset_values=preset, default_option=default).run() + choice = Menu(_('Choose an audio server'), choices, preset_values=preset, default_option=default).run() - if choice.type_ == MenuSelectionType.Esc: - return preset - elif choice.type_ == MenuSelectionType.Selection: - return choice.value + if choice.type_ == MenuSelectionType.Esc: + return preset + elif choice.type_ == MenuSelectionType.Selection: + return choice.value def select_language(preset_value: str = None) -> str: - """ - Asks the user to select a language - Usually this is combined with :ref:`archinstall.list_keyboard_languages`. + """ + Asks the user to select a language + Usually this is combined with :ref:`archinstall.list_keyboard_languages`. - :return: The language/dictionary key of the selected language - :rtype: str - """ - kb_lang = list_keyboard_languages() - # sort alphabetically and then by length - sorted_kb_lang = sorted(sorted(list(kb_lang)), key=len) + :return: The language/dictionary key of the selected language + :rtype: str + """ + kb_lang = list_keyboard_languages() + # sort alphabetically and then by length + sorted_kb_lang = sorted(sorted(list(kb_lang)), key=len) - selected_lang = Menu( - _('Select keyboard layout'), - sorted_kb_lang, - preset_values=preset_value, - sort=False - ).run() + selected_lang = Menu( + _('Select keyboard layout'), + sorted_kb_lang, + preset_values=preset_value, + sort=False + ).run() - if selected_lang.value is None: - return preset_value + if selected_lang.value is None: + return preset_value - return selected_lang.value + return selected_lang.value def select_mirror_regions(preset_values: Dict[str, Any] = {}) -> Dict[str, Any]: - """ - Asks the user to select a mirror or region - Usually this is combined with :ref:`archinstall.list_mirrors`. + """ + Asks the user to select a mirror or region + Usually this is combined with :ref:`archinstall.list_mirrors`. - :return: The dictionary information about a mirror/region. - :rtype: dict - """ - if preset_values is None: - preselected = None - else: - preselected = list(preset_values.keys()) - mirrors = list_mirrors() - selected_mirror = Menu( - _('Select one of the regions to download packages from'), - list(mirrors.keys()), - preset_values=preselected, - multi=True, - raise_error_on_interrupt=True - ).run() + :return: The dictionary information about a mirror/region. + :rtype: dict + """ + if preset_values is None: + preselected = None + else: + preselected = list(preset_values.keys()) + mirrors = list_mirrors() + selected_mirror = Menu( + _('Select one of the regions to download packages from'), + list(mirrors.keys()), + preset_values=preselected, + multi=True, + raise_error_on_interrupt=True + ).run() - # match selected_mirror.type_: - # case MenuSelectionType.Ctrl_c: return {} - # case MenuSelectionType.Esc: return preset_values - # case _: return {selected: mirrors[selected] for selected in selected_mirror.value} - if selected_mirror.type_ == MenuSelectionType.Esc: - return preset_values - elif selected_mirror.type_ == MenuSelectionType.Ctrl_c: - return {} - else: - return {selected: mirrors[selected] for selected in selected_mirror.value} + # match selected_mirror.type_: + # case MenuSelectionType.Ctrl_c: return {} + # case MenuSelectionType.Esc: return preset_values + # case _: return {selected: mirrors[selected] for selected in selected_mirror.value} + if selected_mirror.type_ == MenuSelectionType.Esc: + return preset_values + elif selected_mirror.type_ == MenuSelectionType.Ctrl_c: + return {} + else: + return {selected: mirrors[selected] for selected in selected_mirror.value} def select_archinstall_language(languages: List[Language], preset_value: Language) -> Language: - # these are the displayed language names which can either be - # the english name of a language or, if present, the - # name of the language in its own language - options = {lang.display_name: lang for lang in languages} + # these are the displayed language names which can either be + # the english name of a language or, if present, the + # name of the language in its own language + options = {lang.display_name: lang for lang in languages} - def dependency_preview(current_selection: str) -> Optional[str]: - current_lang = options[current_selection] + def dependency_preview(current_selection: str) -> Optional[str]: + current_lang = options[current_selection] - if current_lang.external_dep and not TranslationHandler.is_custom_font_enabled(): - font_file = TranslationHandler.custom_font_path() - text = str(_('To be able to use this translation, please install a font manually that supports the language.')) + '\n' - text += str(_('The font should be stored as {}')).format(font_file) - return text - return None + if current_lang.external_dep and not TranslationHandler.is_custom_font_enabled(): + font_file = TranslationHandler.custom_font_path() + text = str(_('To be able to use this translation, please install a font manually that supports the language.')) + '\n' + text += str(_('The font should be stored as {}')).format(font_file) + return text + return None - choice = Menu( - _('Archinstall language'), - list(options.keys()), - default_option=preset_value.display_name, - preview_command=lambda x: dependency_preview(x), - preview_size=0.5 - ).run() + choice = Menu( + _('Archinstall language'), + list(options.keys()), + default_option=preset_value.display_name, + preview_command=lambda x: dependency_preview(x), + preview_size=0.5 + ).run() - # match choice.type_: - # case MenuSelectionType.Esc: - # return preset_value - # case MenuSelectionType.Selection: - # language: Language = options[choice.value] - # # we have to make sure that the proper AUR dependency is - # # present to be able to use this language - # if not language.external_dep or TranslationHandler.is_custom_font_enabled(): - # return language - # return select_archinstall_language(languages, preset_value) - if choice.type_ == MenuSelectionType.Esc: - return preset_value - elif choice.type_ == MenuSelectionType.Selection: - language: Language = options[choice.value] - # we have to make sure that the proper AUR dependency is - # present to be able to use this language - if not language.external_dep or TranslationHandler.is_custom_font_enabled(): - return language - return select_archinstall_language(languages, preset_value) + # match choice.type_: + # case MenuSelectionType.Esc: + # return preset_value + # case MenuSelectionType.Selection: + # language: Language = options[choice.value] + # # we have to make sure that the proper AUR dependency is + # # present to be able to use this language + # if not language.external_dep or TranslationHandler.is_custom_font_enabled(): + # return language + # return select_archinstall_language(languages, preset_value) + if choice.type_ == MenuSelectionType.Esc: + return preset_value + elif choice.type_ == MenuSelectionType.Selection: + language: Language = options[choice.value] + # we have to make sure that the proper AUR dependency is + # present to be able to use this language + if not language.external_dep or TranslationHandler.is_custom_font_enabled(): + return language + return select_archinstall_language(languages, preset_value) def select_profile(preset) -> Optional[Profile]: - """ - # Asks the user to select a profile from the available profiles. - # - # :return: The name/dictionary key of the selected profile - # :rtype: str - # """ - top_level_profiles = sorted(list(list_profiles(filter_top_level_profiles=True))) - options = {} + """ + # Asks the user to select a profile from the available profiles. + # + # :return: The name/dictionary key of the selected profile + # :rtype: str + # """ + top_level_profiles = sorted(list(list_profiles(filter_top_level_profiles=True))) + options = {} - for profile in top_level_profiles: - profile = Profile(None, profile) - description = profile.get_profile_description() + for profile in top_level_profiles: + profile = Profile(None, profile) + description = profile.get_profile_description() - option = f'{profile.profile}: {description}' - options[option] = profile + option = f'{profile.profile}: {description}' + options[option] = profile - title = _('This is a list of pre-programmed profiles, they might make it easier to install things like desktop environments') - warning = str(_('Are you sure you want to reset this setting?')) + title = _('This is a list of pre-programmed profiles, they might make it easier to install things like desktop environments') + warning = str(_('Are you sure you want to reset this setting?')) - selection = Menu( - title=title, - p_options=list(options.keys()), - raise_error_on_interrupt=True, - raise_error_warning_msg=warning - ).run() + selection = Menu( + title=title, + p_options=list(options.keys()), + raise_error_on_interrupt=True, + raise_error_warning_msg=warning + ).run() - # match selection.type_: - # case MenuSelectionType.Selection: - # return options[selection.value] if selection.value is not None else None - # case MenuSelectionType.Ctrl_c: - # storage['profile_minimal'] = False - # storage['_selected_servers'] = [] - # storage['_desktop_profile'] = None - # storage['arguments']['desktop-environment'] = None - # storage['arguments']['gfx_driver_packages'] = None - # return None - # case MenuSelectionType.Esc: - # return None - if selection.type_ == MenuSelectionType.Esc: - return None - elif selection.type_ == MenuSelectionType.Selection: - return options[selection.value] if selection.value is not None else None - elif selection.type_ == MenuSelectionType.Ctrl_c: - storage['profile_minimal'] = False - storage['_selected_servers'] = [] - storage['_desktop_profile'] = None - storage['arguments']['desktop-environment'] = None - storage['arguments']['gfx_driver_packages'] = None - return None + # match selection.type_: + # case MenuSelectionType.Selection: + # return options[selection.value] if selection.value is not None else None + # case MenuSelectionType.Ctrl_c: + # storage['profile_minimal'] = False + # storage['_selected_servers'] = [] + # storage['_desktop_profile'] = None + # storage['arguments']['desktop-environment'] = None + # storage['arguments']['gfx_driver_packages'] = None + # return None + # case MenuSelectionType.Esc: + # return None + if selection.type_ == MenuSelectionType.Esc: + return None + elif selection.type_ == MenuSelectionType.Selection: + return options[selection.value] if selection.value is not None else None + elif selection.type_ == MenuSelectionType.Ctrl_c: + storage['profile_minimal'] = False + storage['_selected_servers'] = [] + storage['_desktop_profile'] = None + storage['arguments']['desktop-environment'] = None + storage['arguments']['gfx_driver_packages'] = None + return None def select_base_image(preset: str) -> str: - """ - Asks the user to select a image for system. + """ + Asks the user to select a image for system. - :return: The string as a selected image - :rtype: string - """ - allnames = ["runtime", "develop"] + :return: The string as a selected image + :rtype: string + """ + allnames = ["runtime", "develop"] - default_val = "runtime" + default_val = "runtime" - warning = str(_('Are you sure you want to reset this setting?')) + warning = str(_('Are you sure you want to reset this setting?')) - choice = Menu( - _('Choose which base image to use or leave blank for default "{}"').format(default_val), - allnames, - sort=False, - multi=False, - preset_values=preset, - raise_error_on_interrupt=True, - raise_error_warning_msg=warning - ).run() - - # match choice.type_: - # case MenuSelectionType.Esc: return preset - # case MenuSelectionType.Ctrl_c: return [] - # case MenuSelectionType.Selection: return choice.value - if choice.type_ == MenuSelectionType.Esc: - return preset - elif choice.type_ == MenuSelectionType.Ctrl_c: - return [] - elif choice.type_ == MenuSelectionType.Selection: - return choice.value + choice = Menu( + _('Choose which base image to use or leave blank for default "{}"').format(default_val), + allnames, + sort=False, + multi=False, + preset_values=preset, + raise_error_on_interrupt=True, + raise_error_warning_msg=warning + ).run() + + # match choice.type_: + # case MenuSelectionType.Esc: return preset + # case MenuSelectionType.Ctrl_c: return [] + # case MenuSelectionType.Selection: return choice.value + storage['arguments']['base_image_develop'] = False + if choice.type_ == MenuSelectionType.Esc: + if preset == 'develop': + storage['arguments']['base_image_develop'] = True + return preset + elif choice.type_ == MenuSelectionType.Ctrl_c: + return [] + elif choice.type_ == MenuSelectionType.Selection: + if choice.value == 'develop': + storage['arguments']['base_image_develop'] = True + return choice.value def ask_additional_packages_to_install(pre_set_packages: List[str] = []) -> List[str]: - # Additional packages (with some light weight error handling for invalid package names) - print(_('Only packages such as base, base-devel, linux, linux-firmware, efibootmgr and optional profile packages are installed.')) - print(_('If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.')) + title = str(_('Select one or more packages to use and install\n')) + warning = str(_('If you reset the packages selection, Are you sure?')) + options = {"kde-plasma": "kde-plasma"} + options_keys = options.keys() + # print(pre_set_packages) + # time.sleep(1.5) + selected_harddrive = Menu( + title, + options_keys, + preset_values=pre_set_packages, + multi=True, + raise_error_on_interrupt=True, + raise_error_warning_msg=warning + ).run() - def read_packages(already_defined: list = []) -> list: - display = ' '.join(already_defined) - input_packages = TextInput(_('Write additional packages to install (space separated, leave blank to skip): '), display).run().strip() - return input_packages.split() if input_packages else [] - - pre_set_packages = pre_set_packages if pre_set_packages else [] - packages = read_packages(pre_set_packages) - - if not storage['arguments']['offline'] and not storage['arguments']['no_pkg_lookups']: - while True: - if len(packages): - # Verify packages that were given - print(_("Verifying that additional packages exist (this might take a few seconds)")) - valid, invalid = validate_package_list(packages) - - if invalid: - log(f"Some packages could not be found in the repository: {invalid}", level=logging.WARNING, fg='red') - packages = read_packages(valid) - continue - break - - return packages + select_packages = [] + if selected_harddrive.type_ == MenuSelectionType.Esc: + select_packages = pre_set_packages + elif selected_harddrive.type_ == MenuSelectionType.Ctrl_c: + select_packages = [] + elif selected_harddrive.type_ == MenuSelectionType.Selection: + select_packages = [options[i] for i in selected_harddrive.value] + storage['arguments']['packages'] = select_packages + return select_packages def add_number_of_parrallel_downloads(input_number :Optional[int] = None) -> Optional[int]: - max_downloads = 5 - print(_(f"This option enables the number of parallel downloads that can occur during installation")) - print(_(f"Enter the number of parallel downloads to be enabled.\n (Enter a value between 1 to {max_downloads})\nNote:")) - print(_(f" - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )")) - print(_(f" - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )")) - print(_(f" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )")) + max_downloads = 5 + print(_(f"This option enables the number of parallel downloads that can occur during installation")) + print(_(f"Enter the number of parallel downloads to be enabled.\n (Enter a value between 1 to {max_downloads})\nNote:")) + print(_(f" - Maximum value : {max_downloads} ( Allows {max_downloads} parallel downloads, allows {max_downloads+1} downloads at a time )")) + print(_(f" - Minimum value : 1 ( Allows 1 parallel download, allows 2 downloads at a time )")) + print(_(f" - Disable/Default : 0 ( Disables parallel downloading, allows only 1 download at a time )")) - while True: - try: - input_number = int(TextInput(_("[Default value: 0] > ")).run().strip() or 0) - if input_number <= 0: - input_number = 0 - elif input_number > max_downloads: - input_number = max_downloads - break - except: - print(_(f"Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]")) + while True: + try: + input_number = int(TextInput(_("[Default value: 0] > ")).run().strip() or 0) + if input_number <= 0: + input_number = 0 + elif input_number > max_downloads: + input_number = max_downloads + break + except: + print(_(f"Invalid input! Try again with a valid input [1 to {max_downloads}, or 0 to disable]")) - pacman_conf_path = pathlib.Path("/etc/pacman.conf") - with pacman_conf_path.open() as f: - pacman_conf = f.read().split("\n") + pacman_conf_path = pathlib.Path("/etc/pacman.conf") + with pacman_conf_path.open() as f: + pacman_conf = f.read().split("\n") - with pacman_conf_path.open("w") as fwrite: - for line in pacman_conf: - if "ParallelDownloads" in line: - fwrite.write(f"ParallelDownloads = {input_number+1}\n") if not input_number == 0 else fwrite.write("#ParallelDownloads = 0\n") - else: - fwrite.write(f"{line}\n") + with pacman_conf_path.open("w") as fwrite: + for line in pacman_conf: + if "ParallelDownloads" in line: + fwrite.write(f"ParallelDownloads = {input_number+1}\n") if not input_number == 0 else fwrite.write("#ParallelDownloads = 0\n") + else: + fwrite.write(f"{line}\n") - return input_number + return input_number def select_additional_repositories(preset: List[str]) -> List[str]: - """ - Allows the user to select additional repositories (multilib, and testing) if desired. + """ + Allows the user to select additional repositories (multilib, and testing) if desired. - :return: The string as a selected repository - :rtype: string - """ + :return: The string as a selected repository + :rtype: string + """ - repositories = ["multilib", "testing"] + repositories = ["multilib", "testing"] - choice = Menu( - _('Choose which optional additional repositories to enable'), - repositories, - sort=False, - multi=True, - preset_values=preset, - raise_error_on_interrupt=True - ).run() + choice = Menu( + _('Choose which optional additional repositories to enable'), + repositories, + sort=False, + multi=True, + preset_values=preset, + raise_error_on_interrupt=True + ).run() - # match choice.type_: - # case MenuSelectionType.Esc: return preset - # case MenuSelectionType.Ctrl_c: return [] - # case MenuSelectionType.Selection: return choice.value - - if choice.type_ == MenuSelectionType.Esc: - return preset - elif choice.type_ == MenuSelectionType.Ctrl_c: - return [] - elif choice.type_ == MenuSelectionType.Selection: - return choice.value + # match choice.type_: + # case MenuSelectionType.Esc: return preset + # case MenuSelectionType.Ctrl_c: return [] + # case MenuSelectionType.Selection: return choice.value + + if choice.type_ == MenuSelectionType.Esc: + return preset + elif choice.type_ == MenuSelectionType.Ctrl_c: + return [] + elif choice.type_ == MenuSelectionType.Selection: + return choice.value diff --git a/examples/guided.py b/examples/guided.py index 725ed03..384cf40 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -93,7 +93,7 @@ def ask_user_questions(): will we continue with the actual installation steps. """ - archinstall.SysCommand('local-install lvm aio') + archinstall.SysCommand('local-install lvm2 aio') partprobe() time.sleep(0.5) # ref: https://github.com/archlinux/archinstall/pull/831 @@ -152,7 +152,6 @@ def ask_user_questions(): # Ask for preferred kernel: # global_menu.enable('kernels') - # global_menu.enable('packages') # if archinstall.arguments.get('advanced', False): # # Enable parallel downloads @@ -165,6 +164,8 @@ def ask_user_questions(): global_menu.enable("base_image") + global_menu.enable('packages') + # global_menu.enable('ntp') # global_menu.enable('additional-repositories') @@ -230,7 +231,7 @@ def install_grub(installation : archinstall.Installer, boot_dev_path: str): # if archinstall.has_uefi(): # installation.log("Installing finish", level=logging.INFO) - installation.log("Installing finish", level=logging.INFO) + installation.log("Installing grub finish", level=logging.INFO) def extract_rootfs(installation): target = installation.target @@ -327,6 +328,32 @@ deb-src http://mirrors.huaweicloud.com/debian/ bullseye main except SysCallError as error: installation.log(f"clear tmp failed: {error!r}", level=logging.WARN, fg="yellow") +def install_packages(installation,additional_packages): + target = installation.target + if len(additional_packages) == 0: + return + try: + # install additional_packages package + installation.log("Installing additional_packages package, {}".format("..."), level=logging.INFO) + for key_name in additional_packages: + installation.log("Installing {} package...".format(key_name), level=logging.INFO) + if key_name == 'kde-plasma': + archinstall.SysCommand('chroot {} bash -c "dpkg -i /media/pool/other/plugins/{}/*.deb"'.format(target,'psmisc')) + time.sleep(0.1) + archinstall.SysCommand('chroot {} bash -c "dpkg -i /media/pool/other/plugins/{}/*.deb"'.format(target,key_name)) + # change default dm + time.sleep(0.1) + archinstall.SysCommand('chroot {} bash -c "rm -rf /etc/systemd/system/display-manager.service"'.format(target)) + archinstall.SysCommand('chroot {} bash -c "ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service"'.format(target)) + archinstall.SysCommand('chroot {} bash -c "mv /usr/share/xsessions/lightdm-xsession.desktop /usr/share/xsessions/qlightdm-xsession.desktop"'.format(target)) + except SysCallError as error: + installation.log(f"additional_packages error: {error!r}", level=logging.ERROR, fg="red") + raise error + + installation.log("Installing additional_packages finish.", level=logging.INFO) + installation.log("And The default startup session may not be KDE-Plasma DM, and you can modify it on the login page.", level=logging.INFO) + + def perform_installation2(mountpoint): with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', ['linux'])) as installation: disk_layouts = None @@ -381,6 +408,10 @@ def perform_installation2(mountpoint): # 6 do config do_config(installation) + # 7 install adational packages + if archinstall.arguments.get('base_image_develop',False): + addition_packages = archinstall.arguments.get('packages',[]) + install_packages(installation,addition_packages) input(str(_('Install finished, user:[acosail] password is [ ].\nPress Enter to reboot.'))) reboot() @@ -656,6 +687,8 @@ if not archinstall.arguments.get('silent'): ask_user_questions() config_output = ConfigurationOutput(archinstall.arguments) +# print("config_output===========>>>",archinstall.arguments) +# time.sleep(15) if not archinstall.arguments.get('silent'): config_output.show() config_output.save()