Commit message (Collapse)AuthorAgeFilesLines
* grub2/grub2-parser: accept no whitespace in grub menuentryBrett Grandbois2018-02-081-1/+1
| | | | | | | | | | The Yocto wic grub support will generate a grub.cfg with no whitespace between the ending quote of the menuentry label and the opening bracket. There doesn't seem to be anything in the specification that this is illegal so accept it here. Signed-off-by: Brett Grandbois <> Signed-off-by: Samuel Mendoza-Jonas <>
* ncurses/nc-cui: fix unreferenced assertion variableBrett Grandbois2018-02-081-1/+2
| | | | | Signed-off-by: Brett Grandbois <> Signed-off-by: Samuel Mendoza-Jonas <>
* 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 <> Signed-off-by: Samuel Mendoza-Jonas <>
* discover/pb-discover: #include <locale.h> for musl libcBrett Grandbois2018-02-081-0/+1
| | | | | Signed-off-by: Brett Grandbois <> Signed-off-by: Samuel Mendoza-Jonas <>
* printf: Fix format type warningsGeoff Levand2018-01-103-5/+7
| | | | | | | | | Fixes build warnings like these when building 32 bit programs: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument has type ‘uint64_t’ Signed-off-by: Geoff Levand <> Signed-off-by: Samuel Mendoza-Jonas <>
* configure: Update AC_PACKAGE_BUGREPORTGeoff Levand2018-01-101-1/+1
| | | | | Signed-off-by: Geoff Levand <> Signed-off-by: Samuel Mendoza-Jonas <>
* configure: Add check for lex, yaccGeoff Levand2018-01-101-0/+6
| | | | | Signed-off-by: Geoff Levand <> Signed-off-by: Samuel Mendoza-Jonas <>
* bootstrap: Add dependency checksGeoff Levand2018-01-101-0/+11
| | | | | Signed-off-by: Geoff Levand <> Signed-off-by: Samuel Mendoza-Jonas <>
* 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 <>
* discover/pxe-parser: Fix relative parsing for manual config filesSamuel Mendoza-Jonas2017-12-124-3/+58
| | | | | | | | | | | | Manually specified config files are asynchronously downloaded by device_handler_process_url() before being parsed. This overwrites the 'pxeconffile' parameter, causing the parser to create relative paths relative to the downloaded file's path, not the original remote path. Work around this by setting 'pxeconffile-local' instead to differentiate between the original config file's location and the local copy. Signed-off-by: Samuel Mendoza-Jonas <>
* Test with .travis.ymlDaniel Axtens2017-11-301-0/+16
| | | | | Signed-off-by: Daniel Axtens <> Signed-off-by: Samuel Mendoza-Jonas <>
* Use --no-location instead of --add-location=neverDaniel Axtens2017-11-301-1/+1
| | | | | | | | This fixes things for old versions of msgmerge such as the one used on Travis CI (Ubuntu 14.04) Signed-off-by: Daniel Axtens <> Signed-off-by: Samuel Mendoza-Jonas <>
* 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 <>
* 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: Signed-off-by: Samuel Mendoza-Jonas <>
* discover/pxe-parser: Fine grained proxy controlCyril Bur2017-11-213-1/+19
| | | | | | | | | | | | | | | | | | | | Petitboot provides a method for a user to manually specify a configuration file that should be retrieved. Petitboot also has a global proxy configuration. This patch aims to marry the two so that a custom configuration file can specify that a specific proxy should be used to access one (or all) of the options within it. This makes custom configuration files more powerful as they can point to files behind proxies without the user needing to also specify the global proxy for that specific custom configuration file to work. This adds parsing for a `proxy` option which will apply to all boot items found after. Signed-off-by: Cyril Bur <> Signed-off-by: Samuel Mendoza-Jonas <>
* Better recognition of ncurses header filesCyril Bur2017-11-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch was lifted directly from: The commit message reads: If ax_with_ncurses finds a ncursesw instance the former code checks only for <ncursesw/panelh>. If not there the search fails. That let to problems at least in Arch Linux which has only <panel.h> installed. The patched version here checks first for <ncursesw/panel.h> and if not found also for <panel.h>. Tested for the following distributions: Gentoo, Debian 7..9, Linux Mint 17 and 18.1, Arch Linux, Ubuntu ARCH Linux builds ncurses with wide character support but does not add any ncurses specific headers. nurses its self (by default) adds almost no ncurses specific headers. No {prefix}/include/ncurses directory. In fact the only ncurses specific file is the ncurses.h symlink to curses.h, other than that there are no ncurses headers. The ax_with_curses.m4 script detects if the installed ncurses has wide character support. It checks using code snippets against all possible ncurses header files. If the ax_with_curses.m4 script detects wide character support the ax_with_curses_extra.m4 will only look for extra curses features (in the case of petitboot, form.h and menu.h) inside the {prefix}/include/ncurses directory, when they could simply be in {prefix}/include. Signed-off-by: Cyril Bur <> Signed-off-by: Samuel Mendoza-Jonas <>
* Fix bootstrap warning: noinst_PROGRAMS was already definedCyril Bur2017-11-201-1/+1
| | | | | | | | | | | utils/ warning: noinst_PROGRAMS was already defined in condition TRUE, which includes condition HAVE_LIBFDT ... utils/ should probably be adding to noinst_PROGRAMS rather than reclaring it. Signed-off-by: Cyril Bur <> Signed-off-by: Samuel Mendoza-Jonas <>
* Fix unmatched bracketsCyril Bur2017-11-201-1/+1
| | | | | Signed-off-by: Cyril Bur <> Signed-off-by: Samuel Mendoza-Jonas <>
* ui/ncurses: Safely handle lost terminal control commandsv1.6.3Samuel Mendoza-Jonas2017-11-147-0/+376
| | | | | | | | | | | | | | | | | | 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 <>
* Add root .gitignoreCyril Bur2017-11-031-0/+20
| | | | | | | | | | This project uses autotools which generates many files not kept in git. This commit adds files generated by: ./bootstrap ./configure Signed-off-by: Cyril Bur <> Signed-off-by: Samuel Mendoza-Jonas <>
* discover/platform-powerpc: Increase IPMI timeoutv1.6.2Samuel Mendoza-Jonas2017-10-261-1/+1
| | | | | | | | | | | | | | | On OpenBMC platforms IPMI requests can take over five seconds to complete. OpenBMC does inform OPAL in BT init that it may take up to ten seconds to respond to any requests, so update our timeout value to accommodate this extra delay. On other platforms this will won't change anything (AMI- and SMC- based BMCs for example respond in under a second), but on OpenBMC platforms such as Witherspoon this will delay Petitboot significantly while we wait for the response. This is not ideal but we need to wait in order to receive important information such as a safe mode request. Signed-off-by: Samuel Mendoza-Jonas <>
* 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 <>
* discover/device-handler: Fallback to device if snapshot fails to mountv1.6.1Samuel Mendoza-Jonas2017-10-121-3/+14
| | | | | | | | | In the event that a snapshot fails to mount, destroy it and fall back to the actual source device. While this loses the protection afforded by a snapshot it avoids users being greeted with an empty boot menu and unable to continue booting. Signed-off-by: Samuel Mendoza-Jonas <>
* 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 <>
* ui/ncurses: Spawn shell in exit handlerSamuel Mendoza-Jonas2017-10-044-1/+32
| | | | | | | | | 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 <>
* ui/ncurses: Fixup some missing gettext callsSamuel Mendoza-Jonas2017-09-1513-14/+157
| | | | Signed-off-by: Samuel Mendoza-Jonas <>
* po: Translation UpdatesSamuel Mendoza-Jonas2017-09-1311-310/+395
| | | | Signed-off-by: Samuel Mendoza-Jonas <>
* po: Update translationsv1.6.0Samuel Mendoza-Jonas2017-08-2912-914/+3128
| | | | | | | General translation update, adds several new translation source files including parsers and the plugin and statuslog screens. Signed-off-by: Samuel Mendoza-Jonas <>
* 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 <>
* discover/device-handler: Disable safe mode warning on reinitSamuel Mendoza-Jonas2017-08-231-0/+10
| | | | | | | | | | | If a user pressed "Rescan Devices" in safe mode the reinit would complete successfully, but the big warning that safe mode is active would remain. On reinit clear the safe_mode flag properly. This has no functional change aside from clearing the UI warning - the IPMI override remains active until cleared or a successful boot occurs. Signed-off-by: Samuel Mendoza-Jonas <>
* lib/flash: Update type of size fieldSamuel Mendoza-Jonas2017-08-231-2/+2
| | | | | | | | Skiboot commit c043065 "flash: Make size 64 bit safe" updated the prototype of blocklevel_get_info() to use a uint64_t for the size parameter. Update our usage to reflect this. Signed-off-by: Samuel Mendoza-Jonas <>
* discover: Update env vars at init and suppress LVM warningsSamuel Mendoza-Jonas2017-08-222-15/+20
| | | | | | | | | | | Environment variables are not platform-specific so move set_proxy_variables to device-handler and call it at handler init. At the same time set LVM_SUPPRESS_FD_WARNINGS to ignore the "file descriptor leaked" warnings when calling LVM-utilities, since we must keep some file descriptors open in lib/process. Signed-off-by: Samuel Mendoza-Jonas <>
* discover/ipmi: Open devnode with O_CLOEXECSamuel Mendoza-Jonas2017-08-221-1/+1
| | | | | | | The IPMI device node is kept open for the life of the platform - include the O_CLOEXEC flag so it is not kept open for child processes. Signed-off-by: Samuel Mendoza-Jonas <>
* discover/device-handler: Be ready for user events earlierSamuel Mendoza-Jonas2017-08-151-4/+4
| | | | | | | | Actions performed in network and udev init may result in pb-event callbacks (such as from udhcpc or pb-plugin), so make sure the user event interface is set up beforehand. Signed-off-by: Samuel Mendoza-Jonas <>
* 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 <>
* 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 <>
* discover: Handle plugin install requestSamuel Mendoza-Jonas2017-08-154-0/+65
| | | | | | | | | Handle "_PLUGIN_INSTALL" requests from clients. Calling the pb-plugin script from pb-discover ensures different clients don't trip over each other. Successfully installed plugins are automatically communicated back to clients once pb-plugin sends a 'plugin' user event. Signed-off-by: Samuel Mendoza-Jonas <>
* discover/device-handler: Scan devices for pluginsSamuel Mendoza-Jonas2017-08-151-0/+18
| | | | Signed-off-by: Samuel Mendoza-Jonas <>
* Add pb-plugin and pb-exec to pb_system_appsSamuel Mendoza-Jonas2017-08-154-1/+7
| | | | Signed-off-by: Samuel Mendoza-Jonas <>
* utils/pb-plugin: Advertise pb-plugins to discover serverSamuel Mendoza-Jonas2017-08-151-14/+40
| | | | | | | | | | | | Update the pb-plugin utility to create a 'plugin' pb-event when it successfully scans or installs a pb-plugin. To aid invoking pb-plugin from pb-discover there following two commands are updated: - `pb-plugin scan` can now be called for a single directory. - `pb-plugin install` now has an optional "auto" argument that will skip asking for confirmation before installation. Signed-off-by: Samuel Mendoza-Jonas <>
* utils: Add pb-exec wrapperSamuel Mendoza-Jonas2017-08-151-0/+16
| | | | | | | | Add a small wrapper script for the Petitboot UI to call interactable programs with. The wrapper calls the program and waits for user input before returning to the Petitboot UI. Signed-off-by: Samuel Mendoza-Jonas <>
* lib/process: Add raw stdout modeSamuel Mendoza-Jonas2017-08-152-2/+6
| | | | | | | Allow process users to set 'raw_stdout', which if set skips redirecting and saving output from processes. Signed-off-by: Samuel Mendoza-Jonas <>
* discover: Add 'plugin' user-eventSamuel Mendoza-Jonas2017-08-153-0/+113
| | | | | | | | | | | Add a new user event to advertise pb-plugins and add them to the device_handler. Plugins described by this event can either be uninstalled pb-plugin files or successfully installed pb-plugins depending on the associated parameters. The is primarily intended for use by the pb-plugin utility itself to notify Petitboot as it operates on pb-plugin files. Signed-off-by: Samuel Mendoza-Jonas <>
* discover: Handle and track plugin_optionsSamuel Mendoza-Jonas2017-08-157-1/+154
| | | | | | | | | | Track plugin_options in the device_handler. Plugins can be added with device_handler_add_plugin_option() and accessed via device_handler_get_plugin(). Extend discover_server to support the new 'add' and 'remove' pb-protocol actions and advertise new plugins to connecting clients. Signed-off-by: Samuel Mendoza-Jonas <>
* discover/pxe-parser: Recognise plugin sourcesSamuel Mendoza-Jonas2017-08-153-5/+32
| | | | | | | | | | | | | Extend the pxe-parser to recognise 'PLUGIN' as well as the usual 'LABEL' when parsing a config file. 'PLUGIN' will be used to specify an option that provides the location of an installable pb-plugin file, named by the 'TARBALL' label. Since plugin options are discovered via the same mechanism as boot options treat them the same as boot options and at the 'type' field to the boot_option struct to differentiate between them. Signed-off-by: Samuel Mendoza-Jonas <>
* lib: Add plugin_option type and protocolSamuel Mendoza-Jonas2017-08-153-0/+127
| | | | | | | | | | Add a new struct 'plugin_option' to represent pb-plugins that are installed on the system. This consists of plugin metadata and an array of installed executables. This also adds two new pb-protocol actions to advertise the addition of a new plugin_option, and to remove known plugin_options. Signed-off-by: Samuel Mendoza-Jonas <>
* 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 <>
* 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 <>
* discover/device-handler: Mention booting device in timeout statusSamuel Mendoza-Jonas2017-07-131-1/+2
| | | | Signed-off-by: Samuel Mendoza-Jonas <>
* pb-sos: effectively compress the pb-sos file with gzipv1.5.0Guilherme G. Piccoli2017-07-121-3/+7
| | | | | | | | | | | | | | Currently the pb-sos tool creates a TAR file with logs, but without compressing it using gzip, for example. Even the output of command says "Compressing...", but in fact no compression is done. This patch uses gzip to effectively compress the logs. It achieves 83% of compression, observed after a simple experiment. Also, makes use of $tarflags variable instead of pass the flags directly in the command call. Signed-off-by: Guilherme G. Piccoli <> Signed-off-by: Samuel Mendoza-Jonas <>
OpenPOWER on IntegriCloud