Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions usr/lib/linuxmint/mintsysadm/mintsysadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
_ = xapp.util.l10n("mintsysadm")

GRUB_FILE = "/etc/default/grub.d/98_mintsysadm.cfg"
DEFAULT_GRUB_FILE = "/etc/default/grub"

class MyApplication(Gtk.Application):
# Main initialization routine
Expand Down Expand Up @@ -143,8 +144,17 @@ def grub_switch_toggled(self, switch, gparam):
self.builder.get_object("grub_timeout_spinner").get_adjustment().set_lower(0.0)
self.builder.get_object("grub_timeout_spinner").update()

def get_existing_grub_path(self):
# Return the Mint-relevant GRUB file to use.
# Checks mintsysadm first, then falls back to default grub.
for path in [GRUB_FILE, DEFAULT_GRUB_FILE]:
if os.path.exists(path):
return path
return None

def get_boot_config(self):
if not os.path.exists(GRUB_FILE):
file_to_read = self.get_existing_grub_path()
if not file_to_read:
return
menu_visible = False
menu_timeout = 0
Expand All @@ -153,7 +163,7 @@ def get_boot_config(self):
# but since we're making this file we can assume if one is here the other is.
savedefault_present = False
boot_args = []
with open(GRUB_FILE, "r") as grub_file:
with open(file_to_read, "r") as grub_file:
for line in grub_file:
line = line.strip()
if "GRUB_TIMEOUT=" in line:
Expand Down