diff --git a/usr/lib/linuxmint/mintdrivers/mintdrivers.py b/usr/lib/linuxmint/mintdrivers/mintdrivers.py index 3d256e0..9d818e7 100755 --- a/usr/lib/linuxmint/mintdrivers/mintdrivers.py +++ b/usr/lib/linuxmint/mintdrivers/mintdrivers.py @@ -62,6 +62,9 @@ def __init__(self): else: print("can not get name for object '%s'" % o) + if self.is_secure_boot_enabled(): + self.show_secure_boot_warning() + self.window_main.show() self.window_main.set_title(_("Driver Manager")) @@ -117,6 +120,29 @@ def show_page(self, page): self.builder.get_object("spinner").stop() self.builder.get_object("stack").set_visible_child_name(page) + def show_secure_boot_warning(self): + dialog = Gtk.MessageDialog( + title=_("Secure Boot Warning"), + flags=Gtk.DialogFlags.MODAL, + type=Gtk.MessageType.WARNING, + buttons=Gtk.ButtonsType.OK, + message_format=_("Warning: Secure Boot is enabled on your computer.\n\n" + "Some drivers or kernel modules that require self-signing may not load while Secure Boot is enabled. " + "This can prevent drivers you install from working until Secure Boot is disabled or the modules are properly signed.\n\n" + "Please refer to your computer's documentation for instructions on disabling Secure Boot or on enrolling module signing keys."), + ) + dialog.run() + dialog.destroy() + + def is_secure_boot_enabled(self): + try: + result = subprocess.run(['mokutil', '--sb-state'], capture_output=True, text=True) + output = result.stdout.lower() + return 'secureboot enabled' in output + except Exception as e: + print(f"Error checking Secure Boot status: {e}") + return False + def on_error_button(self, button): self.show_page("drivers_page")