loader: add hidden boot menu option and fix verbose/mute interaction#385
Merged
Conversation
Add loader_menu_hidden="YES" support to hide the boot menu during the autoboot countdown. Instead of drawing the full menu immediately, a minimal "Press any key for boot menu..." prompt is shown. Pressing any key reveals the menu; otherwise the system boots when the countdown expires. The countdown duration is controlled by autoboot_delay. Also force boot_mute=NO when verbose boot is enabled from the menu, so that verbose output is not silenced by the default boot_mute="YES". Disabling verbose leaves boot_mute untouched per loader.conf.
Reviewer's GuideImplements a hidden boot menu countdown controlled by loader_menu_hidden and autoboot_delay, adds a minimal “Press any key for boot menu…” prompt with its own autoboot handler, updates loader.conf defaults and man page, and ensures enabling verbose boot also un-mutes boot output by forcing boot_mute=NO. Sequence diagram for hidden boot menu autoboot flowsequenceDiagram
actor User
participant Loader
participant Menu
participant Screen
participant IO
Loader->>Menu: menu.run()
Menu->>Loader: loader.getenv(loader_menu_hidden)
alt loader_menu_hidden == YES
Menu->>Loader: loader.getenv(autoboot_delay)
opt delay set
Menu->>Menu: menu.autoboothidden(delay)
loop countdown until timeout or keypress
Menu->>Loader: loader.time()
Menu->>Screen: setcursor(1,1) + printc("Press any key for boot menu... time ")
Screen->>Screen: defcursor()
Menu->>IO: io.ischar()
alt key pressed
IO-->>Menu: getchar()
Menu->>Screen: clear prompt line
Screen->>Screen: defcursor()
alt ch == KEY_ENTER
Menu-->>Menu: return ch (Enter)
else other key
Menu-->>Menu: return ch
end
else no key yet
Menu->>Loader: loader.delay(50000)
end
end
alt key was pressed
Menu-->>Loader: autoboot_key != nil
Menu->>Menu: menu.draw(menu.default)
Note over User,Menu: User now interacts with full boot menu (unchanged flow)
else timeout
Menu->>Loader: cli_execute_unparsed(menu_timeout_command or boot)
Menu-->>Loader: return nil
end
end
else loader_menu_hidden not YES
Menu->>Menu: menu.draw(menu.default)
Menu->>Loader: loader.getenv(autoboot_delay)
opt delay set
Menu->>Menu: menu.autoboot(delay)
alt timeout
Menu->>Loader: cli_execute_unparsed(menu_timeout_command or boot)
Menu-->>Loader: return nil
else key pressed
Menu-->>Loader: autoboot_key != nil
Note over User,Menu: User interacts with already visible boot menu (existing behavior)
end
end
end
Class diagram for updated menu and core modulesclassDiagram
class menu {
+run() nil
+autoboot(delay) nil
+autoboothidden(delay) nil
}
class core {
+setVerbose(verbose) nil
}
class loader {
+getenv(name) string
+setenv(name, value) nil
+unsetenv(name) nil
+time() number
+delay(microseconds) nil
}
class screen {
+setcursor(col, row) nil
+defcursor() nil
}
class io {
+ischar() boolean
+getchar() number
}
class cli {
+cli_execute_unparsed(command) nil
}
class core_keys {
<<enumeration>>
KEY_ENTER
}
menu --> loader : uses
menu --> screen : uses
menu --> io : uses
menu --> cli : uses
menu --> core_keys : compares
core --> loader : sets env vars
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The new loader_menu_hidden handling duplicates the autoboot flow; consider factoring shared logic between menu.autoboot and menu.autoboothidden so future behavior changes don’t need to be updated in two places.
- autoboothidden() hardcodes a width of 79 characters when clearing the prompt; if the loader can run in different terminal sizes, it may be safer to derive the width from the screen API or a shared constant.
- loader_menu_hidden only treats the string "YES" (case-insensitive) as enabled; if other truthy values (e.g., "true", "1") are used elsewhere in loader.conf, you may want to align this check with existing config parsing conventions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new loader_menu_hidden handling duplicates the autoboot flow; consider factoring shared logic between menu.autoboot and menu.autoboothidden so future behavior changes don’t need to be updated in two places.
- autoboothidden() hardcodes a width of 79 characters when clearing the prompt; if the loader can run in different terminal sizes, it may be safer to derive the width from the screen API or a shared constant.
- loader_menu_hidden only treats the string "YES" (case-insensitive) as enabled; if other truthy values (e.g., "true", "1") are used elsewhere in loader.conf, you may want to align this check with existing config parsing conventions.
## Individual Comments
### Comment 1
<location path="stand/lua/menu.lua" line_range="595-604" />
<code_context>
return nil
end
+function menu.autoboothidden(delay)
+ local endtime = loader.time() + delay
+ local time
+ local last
+ repeat
+ time = endtime - loader.time()
+ if last == nil or last ~= time then
+ last = time
+ screen.setcursor(1, 1)
+ printc("Press any key for boot menu... " .. time .. " ")
+ screen.defcursor()
+ end
+ if io.ischar() then
+ local ch = io.getchar()
+ screen.setcursor(1, 1)
</code_context>
<issue_to_address>
**issue (bug_risk):** Handling of ENTER vs other keys in `autoboothidden` contradicts the prompt and documented "any key" behavior.
Currently ENTER bypasses the menu and immediately runs the timeout command, while any other key shows the menu. This contradicts the "Press any key for boot menu..." text and manpage. Either handle ENTER like any other key (so it shows the menu), or adjust the prompt/docs to clarify that ENTER will boot immediately instead of revealing the menu.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
LIBKRB5PROFILE referenced the undefined variable LIBPROFILEDIR instead of LIBKRB5PROFILEDIR (defined on the preceding line), causing the linker to fail to find libkrb5profile.a when building libkrb5.so. This left all profile_* symbols missing from the version script, producing a cascade of "version script assignment of 'krb5_3_MIT' to symbol ... failed: symbol not defined" errors during buildworld
FreeBSD 15.0 requires UCL metadata files for custom packages in release/packages/ucl/. Add ghostbsd-cert-all.ucl to enable package creation for the GhostBSD repository certificate. Fixes package creation failure in pkgbase build.
Without ssl in SUBDIR, the ghostbsd-cert package has no files to install. This was fixed on releng/15.0 but not carried over.
The gfx-glogo.lua file was outdated I did bring up to date.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add loader_menu_hidden="YES" support to hide the boot menu during the autoboot countdown. Instead of drawing the full menu immediately, a minimal "Press any key for boot menu..." prompt is shown. Pressing any key reveals the menu; otherwise the system boots when the countdown expires. The countdown duration is controlled by autoboot_delay.
Also force boot_mute=NO when verbose boot is enabled from the menu, so that verbose output is not silenced by the default boot_mute="YES". Disabling verbose leaves boot_mute untouched per loader.conf.
Summary by Sourcery
Add support for hiding the boot menu during autoboot and ensure verbose boot output is not muted when enabled from the menu.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Chores: