summaryrefslogtreecommitdiffstats
path: root/ui
Commit message (Collapse)AuthorAgeFilesLines
* ui/ncurses: Add preboot check option in the config screenMaxiwell S. Garcia2020-01-252-2/+50
| | | | | | | | | | | | | | | | Petitboot might run some checks to validate the kernel images before call the kexec load. This patch adds both 'preboot check' option in the config UI screen and a NVRAM variable 'petitboot,preboot-check' to make the user choice persistent. The 'preboot check' is enabled by default. The 'petitboot,preboot-check' is created on NVRAM only when 'preboot check' is disabled by the user. NVRAM property changed to preboot-check, small label changes and help text added by Jeremy Kerr <jk@ozlabs.org>. Signed-off-by: Maxiwell S. Garcia <maxiwell@linux.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add secure & trusted boot statusJeremy Kerr2020-01-231-0/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Various fixups and checks to make scan-build happySamuel Mendoza-Jonas2019-05-301-1/+3
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Add prompt for LUKS device passwordSamuel Mendoza-Jonas2019-03-266-8/+219
| | | | | | | | | | | | | | | Implement device_add() in cui_client_ops and use this interface to recognise when the server notifies the client of an encrypted device. A "device header" will be created for this device and added to the menu with no associated boot options. The nc-auth prompt is extended to ask for a disk password when the device header for an encrypted device is selected. Assuming the password is correct pb-discover will remove the original device and notify the client about the newly opened device, which will be reflected in the menu. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* lib: Add AUTH_MSG_DECRYPTSamuel Mendoza-Jonas2019-03-061-0/+2
| | | | | | | | | Extend the auth_message struct to support the AUTH_MSG_DECRYPT operation, allowing the existing authentications methods to be used for passing a disk password from the UI to pb-discover. In addition add DEVICE_TYPE_LUKS to identify encrypted disk devices. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Add option to clear IPMI boot mailboxSamuel Mendoza-Jonas2018-12-131-1/+48
| | | | | | | | If there is an IPMI boot mailbox configuration present display a message in the System Configuration screen and provide the option to clear the mailbox. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Keep track of the default boot optionSamuel Mendoza-Jonas2018-12-031-2/+33
| | | | | | | | | Keep track of the default boot option, and prefix its display name with a '(*)' to point it out to the user. This avoids having to authenticate with pb-discover even if only booting the default option. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Add nc-auth and authenticate when required.Samuel Mendoza-Jonas2018-12-0313-105/+705
| | | | | | | | | | When the user tries to perform actions that require authentication a new subscreen 'nc-auth' is launched which accepts a password and will send an authentication request before performing the action. This also adds a button in nc-config which launches an nc-auth screen allowing the user to set or change the system password. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/common: Client authentication helpersSamuel Mendoza-Jonas2018-12-032-0/+93
| | | | | | | Track the client's authentication status and provide methods for the client to send authentication requests to the server. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Simplify starting shellSamuel Mendoza-Jonas2018-12-031-17/+1
| | | | | | | | | | Instead of calling sh twice to echo the 'exiting' message just call sh by itself and leave any welcome message to the shell's interactive config. Also drop the explicit nc_scr_unpost() in cui_run_cmd() since clear() will blank out the screen anyway. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Add a missing gettext call & update translationsSamuel Mendoza-Jonas2018-12-031-49/+49
| | | | | | | Fix up a spot where we forgot to translate the "Plugins" label on update and make the check for that label more resilient. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Reset console options on bootSamuel Mendoza-Jonas2018-11-162-8/+42
| | | | | | | | | | | | | | | The ncurses UI sets a few console options at startup that are needed for ncurses to work properly. These aren't reset however and can lead to quirks like the cursor being invisible after kexecing to the next kernel. The UI process doesn't have time to reset these when it is killed by kexec, so instead add a 'boot_active' field to status updates. This is set by boot.c's update handler so the UI can assume it is about to boot if it receives a status update with this field, and resets the console options. If the boot is cancelled for any reason the status update will reflect that and the console options are restored. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: in lockdown ensure system reboot in ncurses menu exitBrett Grandbois2018-08-282-1/+13
| | | | | | | | | | | | | | | | In a lockdown situation in the ncurses menu there is a switch to replace the 'Exit to shell' option with 'Reboot', so the intent seems to be to not allow the user the option to exit to shell in a lockdown situation. However the associated foreced reboot logic is in the process atexit so is only triggered when completely exiting the menu system. The default menu item logic to exit to shell is still in place though so the menu exit never occurs and shell access is still available. Add a switch to a different menu exit callback to force a menu abort using the same mechanism as a signal in lockdown situations so the shell can never be entered. This also affects the 'x' or esc shortcut keys. Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* configure: Rename ENABLE_PS3 to PLATFORM_PS3Geoff Levand2018-08-073-3/+3
| | | | | | | To prepare for other configure platform names. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* lib/log: Switch to pb_log_fnGeoff Levand2018-08-0713-67/+67
| | | | | | | | The only functional change should be an additional '/n' to a few log messagees that seemed to be missing it. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Allow IPv6 addresses in address fieldsSamuel Mendoza-Jonas2018-07-103-43/+84
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/sysinfo: Set IPv6 addressesSamuel Mendoza-Jonas2018-07-101-0/+3
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Implement F10-F12 for autoboot device controlJeremy Kerr2018-07-105-0/+87
| | | | | | | | | | | | | Add a few mappings to specify temporary autoboot settings: F10: Only autoboot from disk F11: Only autoboot from USB devices F12: Only autoboot from network These use the new code to prevent cancelling autoboot. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Implement non-boot-cancelling keysJeremy Kerr2018-07-101-1/+9
| | | | | | | | | Allow some keys to not cancel the default-boot process. For the moment, this is just the screen refresh (ctrl+L). Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* lib/security: hard_lockdown flag to stop runtime disable of signed bootBrett Grandbois2018-06-122-0/+6
| | | | | | | | | | | | | | | Currently if signed-boot is enabled in configure the presence of the LOCKDOWN_FILE is used as a runtime determination to perform the actual verification. In some environments this may be acceptable or even the intended operation but in other environments could be a security hole since the removal of the file will then cause boot task verification. Add a 'hard_lockdown' enable flag to generate a HARD_LOCKDOWN preprocessor definition to force the system to always do a signed boot verification for each boot task, which in the case of a missing file the boot will fail. Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Update LOCKDOWN_FILE check to reflect generic SIGNED_BOOTBrett Grandbois2018-05-301-1/+1
| | | | | Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/common/discover-client: explicit #include <string.h>Brett Grandbois2018-03-231-0/+1
| | | | | | | for musl libc Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ncurses: Fix bad strncmpJoel Stanley2018-03-071-2/+2
| | | | | | | | | | | | | | | | | | ui/ncurses/nc-cui.c:967:58: warning: size argument in 'strncmp' call is a comparison [-Wmemsize-comparison] if (strncmp(cod->opt->id, "dummy", strlen("dummy") == 0 && ~~~~~~~~~~~~~~~~~~~~~^~ ui/ncurses/nc-cui.c:967:6: note: did you mean to compare the result of 'strncmp' instead? if (strncmp(cod->opt->id, "dummy", strlen("dummy") == 0 && ^ There appears to be two bonus conditions inside the length field. I chose to drop the pointless strncmp(foo, bar, strlen(bar)), as this is equivalent to strcmp(foo, bar). Signed-off-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> [Fixed up commit message typo]
* ui/ncurses: Validate URL fieldv1.7.0Samuel Mendoza-Jonas2018-02-273-0/+18
| | | | | | | Make sure the URL field is a valid URL before allowing the user to proceed. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Fix boot editor segfault on updateSamuel Mendoza-Jonas2018-02-271-37/+71
| | | | | | | | | | | | | The boot option editor screen segfaults on a system info update since it loses track of which fields actually exist. The boot editor screen's setup and drawing logic is a bit different from other screens, so to fix this bug and preserve the maintainer's sanity, bring the screen setup and redraw into line with other screens. This includes a full teardown of the widgets on update, so save the content of any textboxes on update so the user's changes are not lost. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/device-handler: Treat empty boot order as 'boot any'Samuel Mendoza-Jonas2018-02-121-3/+3
| | | | | | | | It is possible to have autoboot enabled with an empty boot order. Currently this acts as if autoboot is disabled, but it likely makes more sense to the user for this to behave as "autoboot any device". Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Clear remaining space when drawing help lineSamuel Mendoza-Jonas2018-02-121-1/+5
| | | | | | | | When drawing the screen's help line clear each character after the new help line to avoid stale parts of the previous screen's help line remaining on the screen. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ncurses/nc-cui: fix unreferenced assertion variableBrett Grandbois2018-02-081-1/+2
| | | | | Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ncurses/nc-cui: musl libc fixesBrett Grandbois2018-02-081-1/+2
| | | | | | | | | | add missing #inlcude <locale.h> musl libc can segfault with a NULL format string so need to add a redundant "%s", "" to keep it happy Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Allow multiple hot key handlers per pmenuSamuel Mendoza-Jonas2018-01-104-17/+57
| | | | | | | | | | | | | | | | | | | | | The main menu and plugin menu are separate screens but they share the pmenu_process_key() handler. This means all the key shortcuts intended for the main menu can also be used in the plugin menu, which is particularly odd for "add new boot option" for example. To work around this extend the 'hot_key' functionality in pmenu to allow multiple handlers. This allows all pmenus to have the usual navigation and action keys, and then add extra handlers as needed. For example, ps3_mm_init() needs main menu shortcuts as well as some PS3-specific shortcuts, whereas plugin_menu_init() only needs the generic key handler. This changes the functionality of pmenu_process_key() such that if a hot_key_fn successfully handles a key, pmenu_process_key() returns instead of continuing to process the key. This does not affect the current usage. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Always cancel autoboot on exitSamuel Mendoza-Jonas2017-11-301-38/+41
| | | | | | | | | | | | | | If the ncurses UI exits before it has contacted the server it is meant to fork a process to wait until the connection is made and cancel autoboot. This prevents users dropping to the shell and then having the machine boot out from underneath them. In e1e2ca68 "Spawn shell in exit handler" the UI doesn't actually exit on "exit", but it isn't listening to server events either while the shell is active. In this case make sure we still fork to notify the server. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Handle arrow key variantsSamuel Mendoza-Jonas2017-11-211-0/+10
| | | | | | | | | | | In the vt100 'application' cursor mode arrow keys produce ^[Ox rather than the usual ^[[x. Add this pattern to our defined keys so we don't accidentally catch the escape key. For reference: http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-21.html Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Safely handle lost terminal control commandsv1.6.3Samuel Mendoza-Jonas2017-11-144-0/+228
| | | | | | | | | | | | | | | | | | Normally terminal control commands are caught and handled before ncurses or Petitboot could see them. However several combinations of broken terminal emulators or console connections can cause these command sequences to be seen by Petitboot, usually resulting in Petitboot exiting due to the ESC character and then the rest printed to the console. Aside from confusing the user this can also cancel autoboot, so it's important we don't let these sequences go unnoticed if possible. In ui/ncurses/console-codes we add a state machine that recognises the syntax of these control/escape sequences and handles the lost characters. We don't try to emulate the functionality of these commands, instead just logging them for reference. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Remove help shortcut from nc-subsetSamuel Mendoza-Jonas2017-10-121-1/+1
| | | | | | | Subset screens do not include a help screen, so remove the misleading "h=help" shortcut from the lower frame title. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Display multibyte strings correctly in textscreensSamuel Mendoza-Jonas2017-10-111-8/+13
| | | | | | | | | | | | | | In nc-textscreen each line of text is capped at a certain length to avoid running off the side of the viewable screen. However it appears the ncurses function mvwaddnstr() counts by byte instead of actual character, causing strings which contain multibyte characters to be cut short. To avoid this check the displayed length of each string against the screen width, and if under instruct mvwaddnstr() to print the whole string. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Spawn shell in exit handlerSamuel Mendoza-Jonas2017-10-041-1/+29
| | | | | | | | | In cui_on_exit()_ instead of exiting the program spawn a sh instance. This allows the user to drop to the shell and return without losing any custom boot options, for example. SIGINT still calls cui_abort() to properly exit Petitboot. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Fixup some missing gettext callsSamuel Mendoza-Jonas2017-09-152-3/+3
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Don't modify config when clearing IPMI overrideSamuel Mendoza-Jonas2017-08-241-9/+26
| | | | | | | | | | | | | | | | When safe mode is active the config displayed in nc-config is only a subset of the actual config since device init has not yet occurred. However when the "clear override" checkbox is ticked and the config saved, the form will set the config as it is displayed, resulting in device-specific config (eg. boot order and network settings) being cleared. If the user only ticked the "clear override" checkbox this most likely isn't what they intended. Instead change the checkbox to a button which when pressed clears the override and exits safe mode if active, without modifying the rest of the configuration. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Add plugin menu and nc-plugin screenSamuel Mendoza-Jonas2017-08-1512-46/+941
| | | | | | | | | | | | Add a second pmenu accessible via the main menu which displays uninstalled and installed pb-plugins. Uninstalled options can be selected to trigger pb-plugin to install them, after which they are updated and marked as installed in the menu. Installed plugins can be investigated by entering the new plugin screen, where plugin metadata and executables are displayed. Executables can be run from this screen via cui_run_cmd(). Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Update cui_run_cmd() to pass display to commandSamuel Mendoza-Jonas2017-08-152-5/+26
| | | | | | | | | Update cui_run_cmd() to setup a process that uses 'raw_stdout' so that output is displayed on the screen instead of being caught in the log. Also update cui_run_cmd() to take a more generic list of arguments, and add a cui_run_cmd_from_item() wrapper for the existing user. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Create pad for nc-add-url screenSamuel Mendoza-Jonas2017-08-101-2/+52
| | | | | | | | Bring setup for the add-url screen into line with other screens. This fixes an issue with a proper redraw not occurring on help screen init or screen exit, and facilitates other work on simplifying screen init. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Increase height of boot-editor padv1.5.1Samuel Mendoza-Jonas2017-07-261-1/+1
| | | | | | | | Similarly to nc-subset, extend the maximum height of the boot-editor pad to account for the fields of the device select potentially wrapping due to long device names. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Extend nc-subset pad heightSamuel Mendoza-Jonas2017-07-111-2/+5
| | | | | | | | The nc-subset screen can exceed its maximum height if some options are long enough to wrap around to two lines. Increaes the maximum size of the pad to account for every line potentially wrapping once. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Fix adding unnecessary leading slashes to pathsSamuel Mendoza-Jonas2017-03-151-1/+2
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Display IP address in nc-sysinfov1.4.0Samuel Mendoza-Jonas2016-12-201-2/+3
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Don't announce pb-discover connectionSamuel Mendoza-Jonas2016-12-201-2/+1
| | | | | | | | | The "Connected to pb-discover!" message is more useful for development than actual use; for users the more important messages are related to device and configuration parsing. Drop the message to slightly reduce the level of noise on start up. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Maintain a backlog of status updatesSamuel Mendoza-Jonas2016-12-202-6/+3
| | | | | | | | | Add status updates to a persistent list in the discover_server struct, and send each client the backlog on connect. This avoids clients missing useful messages from early init. Clients will only show this in the backlog screen to avoid flooding the client's status line. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses/text-screen: trim long linesJeremy Kerr2016-12-201-7/+10
| | | | | | | | | | | | | | | When a text_screen is given a long line, it'll wrap to the next, overstepping the left margin. We already have folded text for flowed text screens, so just trim long lines at the correct column. This exposes an off-by-one with the automatic wrapping in text_screen_set_text(), where we may overrun the last char, so fix that too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: remove "Info:" / "Error:" prefix from status areaJeremy Kerr2016-12-201-6/+1
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* ui/ncurses: Add status log UIJeremy Kerr2016-12-207-7/+193
| | | | | | | | | | | | | Currently, status messages from the server are displayed in a single line at the bottom of the main menu UI, and are lost once a new status is reported. This change adds a facility for the UI to collect and display the status messages from the server, in a dedicated UI screen. This allows a user to look back through the discovery & boot process. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
OpenPOWER on IntegriCloud