| #
66964bbc
|
| 22-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Attend to some 80-col issues, pointed out by luacheck
Graphics have a tendency to cause 80-col issues, so make an exception to our standard indentation guidelines for these graphics. This
lualoader: Attend to some 80-col issues, pointed out by luacheck
Graphics have a tendency to cause 80-col issues, so make an exception to our standard indentation guidelines for these graphics. This does not hamper readability too badly.
Two 40-column strings of spaces is trivially replaced with string.rep(" ", 80)
show more ...
|
| #
3c6b387a
|
| 22-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Clear up an empty conditional branch
We will likely uncomment this whole monster in the near future.
|
| #
e2df27e3
|
| 22-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Address some 'luacheck' concerns
luacheck pointed out an assortment of issues, ranging from non-standard globals being created as well as unused parameters, variables, and redundant assig
lualoader: Address some 'luacheck' concerns
luacheck pointed out an assortment of issues, ranging from non-standard globals being created as well as unused parameters, variables, and redundant assignments.
Using '_' as a placeholder for values unused (whether it be parameters unused or return values unused, assuming multiple return values) feels clean and gets the point across, so I've adopted it. It also helps flag candidates for cleanup later in some of the lambdas I've created, giving me an easy way to re-evaluate later if we're still not using some of these features.
show more ...
|
| #
d66c7413
|
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Output "Failed to parse" messages
I can't find any good reason these aren't enabled, so enable them.
The silent runs will only return false on actual parse errors, so it's ok to be loud
lualoader: Output "Failed to parse" messages
I can't find any good reason these aren't enabled, so enable them.
The silent runs will only return false on actual parse errors, so it's ok to be loud about those failures.
show more ...
|
| #
062d62c9
|
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Don't return false for failure to open config on silent parse
|
| #
49550489
|
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Drop explicit boolean tests; b or not b
|
| #
9f71d421
|
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Drop excessive parenthesizing
This was also a convenience convention (for me) that is not very lua-tic. Drop it.
I've maintained some parentheses where I'd prefer them, for example, 'if
lualoader: Drop excessive parenthesizing
This was also a convenience convention (for me) that is not very lua-tic. Drop it.
I've maintained some parentheses where I'd prefer them, for example, 'if x or y or (z and w) then', but these situations are far and few between.
show more ...
|
| #
aedd6be5
|
| 21-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Drop terminating semicolons
This was previously chosen out of convenience, as we had a mixed style and needed to be consistent. I started learning Lua on Friday, so I switched everything
lualoader: Drop terminating semicolons
This was previously chosen out of convenience, as we had a mixed style and needed to be consistent. I started learning Lua on Friday, so I switched everything over. It is not a very lua-nic convention, though, so drop it.
Excessive parenthesizing around conditionals is next on the chopping block.
show more ...
|
| #
e73c944f
|
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: When restoring environment, only restore unchanged vars
Track the latest value we've set an environment variable to, and only restore those that are unchanged from that.
This gives us so
lualoader: When restoring environment, only restore unchanged vars
Track the latest value we've set an environment variable to, and only restore those that are unchanged from that.
This gives us some leeway to make sure we're not clobbering variables overwritten by menu changes.
show more ...
|
| #
df9e50a9
|
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Don't try so hard to load a kernel
If the user's selected a kernel, we really should be trying to load that one instead of falling back to some default kernel.
This should generally be a
lualoader: Don't try so hard to load a kernel
If the user's selected a kernel, we really should be trying to load that one instead of falling back to some default kernel.
This should generally be a no-op and most desirable, unless you really enjoyed surprises.
show more ...
|
| #
ebddeb04
|
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Prefer selected kernel to currently loaded
|
| #
25c4c7a5
|
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
lualoader: Move carousel storage out into config
Carousel storage doesn't need to happen in the menu module, and indeed storing it there introduces a circular reference between drawer and menu that
lualoader: Move carousel storage out into config
Carousel storage doesn't need to happen in the menu module, and indeed storing it there introduces a circular reference between drawer and menu that only works because of global pollution in loader.lua.
Carousel choices generally map to config entries anyways, making it as good of place as any to store these. Move {get,set}CarouselIndex functionality out into config so that drawer and menu may both use it. If we had more carousel functionality, it might make sense to create a carousel module, but this is not the case.
show more ...
|
| #
b5746545
|
| 20-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Consistently organize modules
We follow pretty closely the following structure of a module:
1. Copyright notice 2. Module requires 3. Module local declarations 4. Module local definition
stand/lua: Consistently organize modules
We follow pretty closely the following structure of a module:
1. Copyright notice 2. Module requires 3. Module local declarations 4. Module local definitions 5. Module exports 6. return
Re-organize the one-offs (config/drawer) and denote the start of module exports with a comment.
show more ...
|
| #
21d5bcbe
|
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Add copyright notice in places
I've made some not-insignificant changes to config, menu, and password bits of our lua scripts. Add a copyright notice to them to reflect.
|
| #
1f5696c7
|
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Round up some more style.lua(9) concerns
|
| #
e6db469b
|
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Remove inaccurate comment after r329590
lualoader does a pretty good job of reverting any environment changes now. It will even wipe out boot_verbose if it's set explicitly in loader.conf
stand/lua: Remove inaccurate comment after r329590
lualoader does a pretty good job of reverting any environment changes now. It will even wipe out boot_verbose if it's set explicitly in loader.conf(5) and overwritten in the boot options menu.
Future work will likely change this, as explicit choices made in the menu should probably override the new loader.conf(5). I don't suspect this will cause much grief, though, so it is not a high priority until boot environment support actually lands.
show more ...
|
| #
ce4a5da5
|
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Restore environment upon config reload
This restores environment to whatever defaults we had coming into lualoader.
|
| #
df8a9d46
|
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Track env changes that come in via loader.conf(5)
This will be used when boot environment support lands to make a good-faith effort to apply any new loader.conf(5) environment settings at
stand/lua: Track env changes that come in via loader.conf(5)
This will be used when boot environment support lands to make a good-faith effort to apply any new loader.conf(5) environment settings atop the default configuration that we started with.
show more ...
|
| #
fa4a2394
|
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Defer kernel/module loading until boot or menu escape
Loading the kernel and modules can be really slow. Loading before the menu draws and every time one changes kernel/boot environment i
stand/lua: Defer kernel/module loading until boot or menu escape
Loading the kernel and modules can be really slow. Loading before the menu draws and every time one changes kernel/boot environment is even more painful.
Defer loading until we either boot, auto-boot, or escape to loader prompt. We still need to deal with configuration changes as the boot environment changes, but this is generally much quicker.
This commit strips all ELF loading out of config.load/config.reload so that these are purely for configuration. config.loadelf has been created to deal with kernel/module loads. Unloading logic has been ripped out, as we won't need to deal with it in the menu anymore.
Discussed in part with: allanjude
show more ...
|
| #
27dd7ddf
|
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: reload previously loaded kernel at config-load/reload
r329550 introduced config.kernel_loaded. config.load() doesn't provide a means of overriding the kernel to load, but that likely isn'
stand/lua: reload previously loaded kernel at config-load/reload
r329550 introduced config.kernel_loaded. config.load() doesn't provide a means of overriding the kernel to load, but that likely isn't necessary as it will not be a common case. When loading the kernel, just attempt to load the kernel previously loaded and specified in config.kernel_loaded.
If we haven't loaded a kernel yet, config.kernel_loaded will be unset/nil and the "default"/first kernel found will be loaded. If we've loaded a kernel, we'll try to load that same kernel again and fallback to the default kernel if we need to.
This in also in support of upcoming boot environment support.
show more ...
|
| #
d4591301
|
| 19-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Store the loaded kernel as config.kernel_loaded
'nil' means the 'first kernel found in module_path', which is the same interpretation as passing 'nil' to loadkernel.
Otherwise, it denote
stand/lua: Store the loaded kernel as config.kernel_loaded
'nil' means the 'first kernel found in module_path', which is the same interpretation as passing 'nil' to loadkernel.
Otherwise, it denotes the name of a kernel that we've successfully loaded. When reloaded later, we will still need to do the full search again to locate the actual kernel in case things have changed, so just the name is good enough.
This is in support of upcoming boot environment support. vfs.root.mountfrom and currdev will be changed, then we will reload configuration and attempt to reload the currently chosen kernel unless we shouldn't.
show more ...
|
| #
e402cd13
|
| 18-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: More style nits, config.lua
Some other points I think we need to be consistent on: - Spacing around string concatenation (always) - Test against 'nil' explicitly rather than relying on 'n
stand/lua: More style nits, config.lua
Some other points I think we need to be consistent on: - Spacing around string concatenation (always) - Test against 'nil' explicitly rather than relying on 'not' for things that reasonably won't be returning a boolean. e.g. loader.getenv
Eventually this will all get formalized somewhere.
show more ...
|
| #
faf2ee29
|
| 18-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Remove some debugging bits that snuck in... gr...
|
| #
15d8e03c
|
| 18-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Fix module_path handling with multiple kernels
Once we've successfully loaded a kernel, we add its directory to module_path. If we switch kernels with the kernel selector, we again prepen
stand/lua: Fix module_path handling with multiple kernels
Once we've successfully loaded a kernel, we add its directory to module_path. If we switch kernels with the kernel selector, we again prepend the kernel directory to the current module_path and end up with multiple kernel paths, potentially with mismatched kernel/modules, added to module_path.
Fix it by caching module_path at load() time and using the cached version whenever we load a new kernel.
show more ...
|
| #
7fc96e38
|
| 18-Feb-2018 |
Kyle Evans <kevans@FreeBSD.org> |
stand/lua: Fix verbiage and some typos
"other_kernel" is decidedly not spelled "other_kern"
|