Updated for class method

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-10-18 19:48:55 +03:00
parent 7e3cbc36a1
commit d4a5b72814

View file

@ -456,7 +456,7 @@ class Menu(Configs): # pylint: disable=[R0902]
removed: list = []
added: list = []
ordered: bool = True
kernel_generic_current: str = self.utils.is_package_installed('kernel-generic')
kernel_generic_current_package: str = self.utils.is_package_installed('kernel-generic')
if len(self.args) == 1:
@ -506,14 +506,24 @@ class Menu(Configs): # pylint: disable=[R0902]
else:
self.usage.help_minimal(f"{self.prog_name}: invalid repository '{self.repository}'")
kernel_generic_new: str = self.utils.is_package_installed('kernel-generic')
if kernel_generic_current != kernel_generic_new:
self._kernel_image_message()
self._is_kernel_upgrade(kernel_generic_current_package)
raise SystemExit(0)
self.usage.help_short(1)
def _is_kernel_upgrade(self, kernel_generic_current_package: str) -> None:
"""Compare current and installed kernel package.
Args:
kernel_generic_current_package (str): Kernel-generic package
"""
kernel_generic_new_package: str = self.utils.is_package_installed('kernel-generic')
if kernel_generic_current_package != kernel_generic_new_package:
self._kernel_image_message()
def _kernel_image_message(self) -> None:
"""Print a warning kernel upgrade message.
"""
print(f"\n{self.bred}Warning!{self.endc} Your kernel image looks like to have been upgraded!\n"
"Please update the bootloader with the new parameters of the upgraded kernel.\n"
"See: lilo, eliloconfig or grub-mkconfig -o /boot/grub/grub.cfg,\n"
@ -567,7 +577,7 @@ class Menu(Configs): # pylint: disable=[R0902]
SystemExit: Exit code 0.
"""
command: str = Menu.install.__name__
kernel_generic_current: str = self.utils.is_package_installed('kernel-generic')
kernel_generic_current_package: str = self.utils.is_package_installed('kernel-generic')
if len(self.args) >= 2:
self.data: dict = self.load_data.load(self.repository)
@ -586,9 +596,7 @@ class Menu(Configs): # pylint: disable=[R0902]
install_sbo = Slackbuilds(self.repository, self.data, packages, self.flags, mode=command)
install_sbo.execute()
kernel_generic_new: str = self.utils.is_package_installed('kernel-generic')
if kernel_generic_current != kernel_generic_new:
self._kernel_image_message()
self._is_kernel_upgrade(kernel_generic_current_package)
raise SystemExit(0)
self.usage.help_short(1)