From 128d44372dff792809abbffb363199e29bd9efd3 Mon Sep 17 00:00:00 2001 From: sun_hai_10 Date: Tue, 29 Nov 2022 17:12:47 +0800 Subject: [PATCH] change product not with upper and add SM3 with tui (cherry picked from commit 8e7ef45255e56b71c16683beeb160adcc756338b) --- anaconda.spec | 11 +- bugfix-add-SM3-with-tui.patch | 173 ++++++++++++++++++ ...hange-product-name-do-not-with-upper.patch | 39 ++++ 3 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 bugfix-add-SM3-with-tui.patch create mode 100644 bugfix-change-product-name-do-not-with-upper.patch diff --git a/anaconda.spec b/anaconda.spec index 7469e5a..d1e4e05 100644 --- a/anaconda.spec +++ b/anaconda.spec @@ -1,7 +1,7 @@ %define _empty_manifest_terminate_build 0 Name: anaconda Version: 36.16.5 -Release: 6 +Release: 7 Summary: Graphical system installer License: GPLv2+ and MIT URL: http://fedoraproject.org/wiki/Anaconda @@ -30,6 +30,8 @@ Patch9013: support-use-sm3-crypt-user-password.patch Patch9014: bugfix-with-use-local-kickstart-version.patch Patch9015: bugfix-change-gnome-kiosk-to-use-metacity.patch Patch9016: bugfix-add-log-and-background.patch +Patch9017: bugfix-add-SM3-with-tui.patch +Patch9018: bugfix-change-product-name-do-not-with-upper.patch %define dasbusver 1.3 %define dbusver 1.2.3 @@ -268,6 +270,13 @@ update-desktop-database &> /dev/null || : %{_prefix}/libexec/anaconda/dd_* %changelog +* Tue Nov 29 2022 sunhai - 36.16.5-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:change product name not with upper + add SM3 with tui + * Thu Nov 24 2022 sunhai - 36.16.5-6 - Type:bugfix - ID:NA diff --git a/bugfix-add-SM3-with-tui.patch b/bugfix-add-SM3-with-tui.patch new file mode 100644 index 0000000..01d77d9 --- /dev/null +++ b/bugfix-add-SM3-with-tui.patch @@ -0,0 +1,173 @@ +From 1a11874c57156e576620dd396b4357ec9bab2cc4 Mon Sep 17 00:00:00 2001 +From: sun_hai_10 +Date: Tue, 29 Nov 2022 09:34:09 +0800 +Subject: [PATCH] add SM3 with tui + +--- + pyanaconda/ui/tui/spokes/root_password.py | 81 ++++++++++++++++++++--- + pyanaconda/ui/tui/tuiobject.py | 7 +- + 2 files changed, 77 insertions(+), 11 deletions(-) + +diff --git a/pyanaconda/ui/tui/spokes/root_password.py b/pyanaconda/ui/tui/spokes/root_password.py +index 3c5ba16..dfaca4e 100644 +--- a/pyanaconda/ui/tui/spokes/root_password.py ++++ b/pyanaconda/ui/tui/spokes/root_password.py +@@ -26,7 +26,11 @@ from pyanaconda.core.i18n import N_, _ + from pyanaconda.modules.common.constants.services import USERS + from pyanaconda.core.constants import PASSWORD_POLICY_ROOT + +-from simpleline.render.widgets import TextWidget ++from simpleline.render.containers import ListColumnContainer ++from simpleline.render.prompt import Prompt ++from simpleline.render.screen import InputState ++from simpleline.render.screen_handler import ScreenHandler ++from simpleline.render.widgets import TextWidget, CheckboxWidget + + + class PasswordSpoke(FirstbootSpokeMixIn, NormalTUISpoke): +@@ -50,20 +54,18 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalTUISpoke): + return FirstbootSpokeMixIn.should_run(environment, data) + + def __init__(self, data, storage, payload): +- NormalTUISpoke.__init__(self, data, storage, payload) +- self.initialize_start() ++ super().__init__(data, storage, payload) + self.title = N_("Root password") +- self.input_required = False +- +- self._password = None +- + self._users_module = USERS.get_proxy() +- self.initialize_done() ++ self._sm3_config = False ++ ++ def _set_sm3_config(self, args): ++ self._sm3_config = not self._sm3_config + + @property + def completed(self): + return self._users_module.IsRootPasswordSet +- ++ + @property + def showable(self): + return can_modify_root_configuration(self._users_module) +@@ -77,6 +79,59 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalTUISpoke): + def status(self): + return get_root_configuration_status(self._users_module) + ++ def initialize(self): ++ self.initialize_start() ++ NormalTUISpoke.initialize(self) ++ self.initialize_done() ++ ++ def refresh(self, args=None): ++ """ Refresh screen. """ ++ NormalTUISpoke.refresh(self, args) ++ ++ self._container = ListColumnContainer(1) ++ ++ msg = _("SM3 encrypt") ++ sm3_check = CheckboxWidget(title=msg, completed=self._sm3_config) ++ self._container.add(sm3_check, self._set_sm3_config) ++ ++ self.window.add_with_separator(self._container) ++ ++ def input(self, args, key): ++ """Handle the user input.""" ++ if self._container.process_user_input(key): ++ return InputState.PROCESSED_AND_REDRAW ++ ++ if key.lower() == Prompt.CONTINUE: ++ spoke = RootPasswordSpoke( ++ self.data, ++ self.storage, ++ self.payload, ++ self._sm3_config, ++ ) ++ ScreenHandler.push_screen_modal(spoke) ++ return InputState.PROCESSED_AND_CLOSE ++ ++ return super().input(args, key) ++ ++ ++class RootPasswordSpoke(NormalTUISpoke): ++ """ ++ .. inheritance-diagram:: PasswordSpoke ++ :parts: 3 ++ """ ++ ++ def __init__(self, data, storage, payload, sm3_config): ++ NormalTUISpoke.__init__(self, data, storage, payload) ++ self.initialize_start() ++ self.title = N_("Root password") ++ self.input_required = False ++ ++ self._password = None ++ self._sm3_config = sm3_config ++ ++ self._users_module = USERS.get_proxy() ++ self.initialize_done() ++ + def refresh(self, args=None): + NormalTUISpoke.refresh(self, args) + +@@ -85,10 +140,15 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalTUISpoke): + + def show_all(self): + super().show_all() ++ if self._sm3_config: ++ algo = "sm3" ++ else: ++ algo = None + + password_dialog = PasswordDialog( + title=_("Password"), +- policy_name=PASSWORD_POLICY_ROOT ++ policy_name=PASSWORD_POLICY_ROOT, ++ func_args=(algo,) + ) + password_dialog.no_separator = True + self._password = password_dialog.run() +@@ -101,6 +161,7 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalTUISpoke): + self.close() + + def apply(self): ++ + self._users_module.SetCryptedRootPassword(self._password) + if self._password: + self._users_module.SetRootAccountLocked(False) +diff --git a/pyanaconda/ui/tui/tuiobject.py b/pyanaconda/ui/tui/tuiobject.py +index 6cb439b..c642931 100644 +--- a/pyanaconda/ui/tui/tuiobject.py ++++ b/pyanaconda/ui/tui/tuiobject.py +@@ -209,12 +209,14 @@ class PasswordDialog(Dialog): + report_func=reporting_callback, + process_func=crypt_password, + secret_type=constants.SecretType.PASSWORD, ++ func_args=None, + message=None): + super().__init__(title, report_func=report_func) + self._no_separator = False + self._policy = input_checking.get_policy(policy_name) + self._secret_type = secret_type + self._process_password = process_func ++ self._func_args = func_args + self._dialog_message = message + + def run(self): +@@ -292,7 +294,10 @@ class PasswordDialog(Dialog): + if any(char not in constants.PW_ASCII_CHARS for char in password): + self._report(_(constants.SECRET_ASCII[self._secret_type])) + +- return self._process_password(password) ++ if self._func_args == None: ++ return self._process_password(password) ++ else: ++ return self._process_password(password, *self._func_args) + + def _report(self, message): + if self._report_func: +-- +2.28.0.windows.1 + diff --git a/bugfix-change-product-name-do-not-with-upper.patch b/bugfix-change-product-name-do-not-with-upper.patch new file mode 100644 index 0000000..617525b --- /dev/null +++ b/bugfix-change-product-name-do-not-with-upper.patch @@ -0,0 +1,39 @@ +From 613035ac2716f99ce2ec536c4769d3dc6e6f90e5 Mon Sep 17 00:00:00 2001 +From: sun_hai_10 +Date: Tue, 29 Nov 2022 15:44:45 +0800 +Subject: [PATCH] change product name do not with upper + +--- + pyanaconda/product.py | 4 ++-- + pyanaconda/ui/gui/spokes/welcome.py | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/pyanaconda/product.py b/pyanaconda/product.py +index b5e97d7..7fe28cb 100644 +--- a/pyanaconda/product.py ++++ b/pyanaconda/product.py +@@ -57,6 +57,6 @@ productVersion = trim_product_version_for_ui(productVersion) + + def distributionText(): + return _("%(productName)s %(productVersion)s INSTALLATION") % { +- "productName": productName.upper(), +- "productVersion": productVersion.upper() ++ "productName": productName, ++ "productVersion": productVersion + } +diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py +index 773d5a8..3fc5ebf 100644 +--- a/pyanaconda/ui/gui/spokes/welcome.py ++++ b/pyanaconda/ui/gui/spokes/welcome.py +@@ -271,7 +271,7 @@ class WelcomeLanguageSpoke(StandaloneSpoke, LangLocaleHandler): + welcomeLabel = self.builder.get_object("welcomeLabel") + + welcomeLabel.set_text(_("WELCOME TO %(name)s %(version)s.") % +- {"name" : productName.upper(), "version" : productVersion}) # pylint: disable=no-member ++ {"name" : productName, "version" : productVersion}) # pylint: disable=no-member + + # Retranslate the language (filtering) entry's placeholder text + languageEntry = self.builder.get_object("languageEntry") +-- +2.23.0 +