Fix up the bootloader auto-hide logic

Makes it actually show the bootloader as soon as possible when the system starts, and moves the automatic hiding into the bless service so it's hidden when the system is shut down and blessed.
This commit is contained in:
Thomas Duckworth
2025-12-06 18:53:20 +11:00
parent 6672599e32
commit e8e815e550
3 changed files with 13 additions and 9 deletions

View File

@@ -27,10 +27,10 @@ enable nvidia-suspend.service
enable nvidia-hibernate.service
enable nvidia-resume.service
enable kde-linux-bootloader-visibility.service
enable kde-linux-btrfs.service
enable kde-linux-live-setup.service
enable kde-linux-volatile-var-lib-flatpak.service
enable kde-linux-auto-hide-bootloader.service
enable plasma-setup-live-system.service
enable var-lib-snapd-snap.mount
# also one of ours but not prefixed with kde-linux- so others can use it too

View File

@@ -1,8 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org>
# SPDX-FileCopyrightText: 2025 Thomas Duckworth <tduck@filotimoproject.org>
[Unit]
Description=Mark the Current Boot Loader Entry as Good
Description=Mark the Current Boot Loader Entry as Good and Hide Bootloader
Conflicts=shutdown.target
Before=shutdown.target
@@ -10,3 +11,7 @@ Before=shutdown.target
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/systemd/systemd-bless-boot good
# If the boot was blessed, the user shuts the system down normally, and the uptime
# is greater than 5 minutes, the bootloader is hidden, because the current image should work.
# This is idempotent if more than one operating system is installed.
ExecStopPost=/usr/lib/auto-hide-bootloader hide

View File

@@ -2,20 +2,19 @@
# SPDX-FileCopyrightText: 2025 Thomas Duckworth <tduck@filotimoproject.org>
[Unit]
Description=Automatically hide the bootloader if the image is good
Description=Automatically Show Bootloader on Boot - Hidden on Blessed Boot
DefaultDependencies=no
After=local-fs.target
Before=kde-linux-bless-boot.service
Before=sysinit.target shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
# If the system either is not blessed or is forcibly shut down for some reason,
# the boot menu timeout is reset to default, and the menu is shown.
# This shows the bootloader on startup, for it to then be hidden once
# kde-linux-bless-boot.service blesses the system.
ExecStart=/usr/lib/auto-hide-bootloader show
# If the boot was blessed, the user shuts the system down normally, and the uptime
# is greater than 5 minutes, the bootloader is hidden, because the current image should work.
# This is idempotent if more than one operating system is installed.
ExecStop=/usr/lib/auto-hide-bootloader hide
[Install]
WantedBy=kde-linux-bless-boot.service
WantedBy=sysinit.target