In an upcoming change, we'll populate $prefix (which is used to locate
the environment file) based on the location of the config file, so these
paths will need to be consistent.
Jeremy Kerr [Fri, 22 Nov 2013 06:12:59 +0000 (14:12 +0800)]
ui/ncurses/nc-widgets: Unify select key
We have a few instances where we check for a 'select' action (enter or
space key event), and some are inconsistent. Unify these with a
key_is_select() function.
Jeremy Kerr [Tue, 19 Nov 2013 06:39:41 +0000 (17:39 +1100)]
ui/ncurses: Fix use-after-free when exiting boot option editor
After we've called on_exit, we can no longer use the boot editor. This
change moves individual button callbacks into process_key, which returns
to the main loop.
Jeremy Kerr [Tue, 19 Nov 2013 00:52:49 +0000 (11:52 +1100)]
ui/ncurses: Draw boot editor into a scrollable pad
Like the config editor, draw the boot editor into a pad instead of
directly into the sub window. This means that long device lists will be
handled correctly.
Jeremy Kerr [Sun, 17 Nov 2013 08:36:55 +0000 (19:36 +1100)]
ui/ncurses: Add device selector to boot editor
Rather than expecting users to enter full (prefixed) mount paths, add a
select widget to pick a device, and we automatically add the prefix when
the form is submitted.
Jeremy Kerr [Sun, 17 Nov 2013 03:04:08 +0000 (14:04 +1100)]
ui/ncurses: Make boot editor API consistent with config & sysinfo screens
The boot-editor API is a little more exposed than it needs to be: the
boot_editor struct does not need to be available to other files, and the
init function and on_exit functions differ from those provided for the
config and sysinfo screens.
This change unifies the boot_editor API with those for the other
screens.
Jeremy Kerr [Tue, 19 Nov 2013 04:25:43 +0000 (15:25 +1100)]
discover: Use pxeconffile for udhcpc option name
The patch that went upstream for udhcpc's option 209 handling uses the
option name 'pxeconffile' rather than 'conffile', and it was added as a
non-default option:
Jeremy Kerr [Fri, 25 Oct 2013 01:19:35 +0000 (09:19 +0800)]
nui/ncurses: Allow config screen updates
We may receive configuration (or sysinfo) data after the configuration
screen has been displayed. Implement config_screen_update and redraw the
widgetset when new config data arrives.
Jeremy Kerr [Thu, 17 Oct 2013 05:52:42 +0000 (13:52 +0800)]
ui/ncurses: Add sysinfo screen
Add a simple screen for displaying the struct system_info. We add this
to the main menu as a selectable option, and separate it from the boot
option list with an unselectable blank entry.
Jeremy Kerr [Thu, 17 Oct 2013 04:03:51 +0000 (12:03 +0800)]
ui/common: Don't talloc_free sysinfo and status explicitly
Currently, we talloc_free() the sysinfo and status messages in the
discover client, right after performing the ui's callback.
However, the client may wish to keep a reference to this information
beyond the callback invocation. This change introduces a per-message
talloc context, which these structures are allocated under. This allows
the callbacks to talloc_steal() anything they wish to keep a reference
to.
Neelesh Gupta [Mon, 28 Oct 2013 07:16:12 +0000 (12:46 +0530)]
test/parser: Add new test cases to pxe parser
Adding new cases to the pxe parser code of having conffile file without
complete URL and determining conffile names using mac and ip addresses
passed from the udhcpc.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Neelesh Gupta [Mon, 28 Oct 2013 07:15:59 +0000 (12:45 +0530)]
test/parser: Update test cases as per new parser requesting conf files
Update the parser test code/cases as per new prototyping of parse()
function which doesn't require buf and len to be passed from the caller,
instead reading the configuration data either embedded or from file to
a parser's known conffile.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Neelesh Gupta [Mon, 28 Oct 2013 07:15:21 +0000 (12:45 +0530)]
discover: Change parsers to explicitly request configuration files
Add a new function parser_request_url() to read the data from
configuration files present remotely. We deprecate
iterate_parser_files() and download_config() functions along with the
'filenames' and 'method' members of the 'parser' structure so that
individual parsers would now require to request the configuration files
data from the parser code and doesn't necessarily export the list of
configuration files.
Add the support to handle incoming DHCP event, done by passing all the
relevant environment variables of the udhcpc to the discover code.
Also, update the pxe parser code to populate the list of configuration
file names as per PXELINUX convention of fallback names using mac and ip
addresses of the booting machine.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Fri, 1 Nov 2013 02:33:02 +0000 (10:33 +0800)]
lib/log: Always flush after writing logs
We're currently seeing empty log files from the discover server. Rather
than only flishing if the server was compiled with debugging enabled,
always perform the fflush.
Jeremy Kerr [Fri, 25 Oct 2013 06:34:30 +0000 (14:34 +0800)]
discover/network: Allow for arbitrary-sized netlink messages
Currently, we drop any netlink data beyond our 4096-byte buffer. This
means that we can only parse a limited number of network interfaces.
This change uses recvmsg with MSG_PEEK to determine the size of an
incoming netlink message before doing the actual recvmsg. This way, we
can realloc our buffer to suit.
Jeremy Kerr [Tue, 15 Oct 2013 02:25:23 +0000 (10:25 +0800)]
discover: Don't free clients on write failure
Currently, if we see an error when writing to a client, we free the
client immediately. This means that any pending reads will be discarded.
Additionally, if a client disconnects before we have finished the writes in
discover_server_process_connection, we won't register the waiter to read
from the socket.
Instead of freeing the client on write failure, this change sets a flag
(se we don't continue to write), and we rely on the read EOF to free the
client. This means we don't drop incoming messages.
Jeremy Kerr [Fri, 11 Oct 2013 07:16:39 +0000 (15:16 +0800)]
ui/ncurses: Use 'x' as exit key
Because terminals will send escape-sequences starting with escape,
ncurses will pause after receiving a signle escape, to detect
these sequences. This introduces a 1-second delay when exiting the
petitboot UI.
Jeremy Kerr [Thu, 10 Oct 2013 07:35:35 +0000 (15:35 +0800)]
ui/ncurses: Defer item creation until boot editor is done
Currently, when creating new menu entries, we create an empty item, add
it to the menu, then run the boot editor. This means that cancelling the
edit will leave an empty item in the menu.
This change defers the creation until the boot editor is done. To do
this, we modify the on_open callback to take a menu rather than an item,
and pass NULL boot data to the editor.
Jeremy Kerr [Wed, 9 Oct 2013 04:02:08 +0000 (12:02 +0800)]
Add system info messages
Add a little infrastructure for communicating information about the
system to the petitboot UIs. We just send some identifying info (type
and identifier), as well as the interfaces.
Jeremy Kerr [Wed, 9 Oct 2013 05:19:58 +0000 (13:19 +0800)]
discover: Don't call config_set_autoboot before config_init
Change f611bde3 shifted the config_init until after process_init, as we
need to run processes during config init. We also needed to move the
config_set_autoboot invocation too.