diff options
author | Richard Hughes <richard@hughsie.com> | 2019-03-25 09:39:24 +0000 |
---|---|---|
committer | Ray Strode <halfline@gmail.com> | 2019-05-29 17:52:40 +0000 |
commit | cd4a6010942c6765f5659a2eb88686121db4ccd8 (patch) | |
tree | e0472b045e4506bfa3b99d3f6834ff44b1f4040e | |
parent | f7142e72f3df6c0c2c2c4ca86ee090e36697dcb2 (diff) |
Add a new firmware-upgrade mode for use by fwupd
This allows us to have accurate localised text, and also to use the vendor BIOS
logo when applying firmware updates.
-rw-r--r-- | src/client/plymouth.c | 6 | ||||
-rw-r--r-- | src/libply-splash-core/ply-boot-splash-plugin.h | 3 | ||||
-rw-r--r-- | src/main.c | 7 | ||||
-rw-r--r-- | src/plugins/splash/script/script-lib-plymouth.c | 3 | ||||
-rw-r--r-- | src/plugins/splash/throbgress/plugin.c | 6 | ||||
-rw-r--r-- | src/plugins/splash/two-step/plugin.c | 8 | ||||
-rw-r--r-- | themes/bgrt/bgrt.plymouth.in | 8 | ||||
-rw-r--r-- | themes/spinner/spinner.plymouth.in | 8 |
8 files changed, 44 insertions, 5 deletions
diff --git a/src/client/plymouth.c b/src/client/plymouth.c index a11753af..be74ae7b 100644 --- a/src/client/plymouth.c +++ b/src/client/plymouth.c @@ -787,6 +787,7 @@ on_change_mode_request (state_t *state, bool reboot = false; bool updates = false; bool system_upgrade = false; + bool firmware_upgrade = false; const char *mode = NULL; ply_command_parser_get_command_options (state->command_parser, @@ -796,6 +797,7 @@ on_change_mode_request (state_t *state, "reboot", &reboot, "updates", &updates, "system-upgrade", &system_upgrade, + "firmware-upgrade", &firmware_upgrade, NULL); if (boot_up) @@ -808,6 +810,8 @@ on_change_mode_request (state_t *state, mode = "updates"; else if (system_upgrade) mode = "system-upgrade"; + else if (firmware_upgrade) + mode = "firmware-upgrade"; if (mode) { ply_boot_client_change_mode (state->client, mode, @@ -901,6 +905,8 @@ main (int argc, PLY_COMMAND_OPTION_TYPE_FLAG, "system-upgrade", "Upgrading the OS to a new version", PLY_COMMAND_OPTION_TYPE_FLAG, + "firmware-upgrade", "Upgrading firmware to a new version", + PLY_COMMAND_OPTION_TYPE_FLAG, NULL); ply_command_parser_add_command (state.command_parser, diff --git a/src/libply-splash-core/ply-boot-splash-plugin.h b/src/libply-splash-core/ply-boot-splash-plugin.h index 3fa56cea..227147fa 100644 --- a/src/libply-splash-core/ply-boot-splash-plugin.h +++ b/src/libply-splash-core/ply-boot-splash-plugin.h @@ -41,8 +41,9 @@ typedef enum PLY_BOOT_SPLASH_MODE_REBOOT, PLY_BOOT_SPLASH_MODE_UPDATES, PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE, + PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE, PLY_BOOT_SPLASH_MODE_INVALID, - PLY_BOOT_SPLASH_MODE_COUNT = PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE + 1, + PLY_BOOT_SPLASH_MODE_COUNT = PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE + 1, } ply_boot_splash_mode_t; typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t; @@ -206,6 +206,8 @@ on_change_mode (state_t *state, state->mode = PLY_BOOT_SPLASH_MODE_UPDATES; else if (strcmp (mode, "system-upgrade") == 0) state->mode = PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE; + else if (strcmp (mode, "firmware-upgrade") == 0) + state->mode = PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE; else return; @@ -675,6 +677,7 @@ get_cache_file_for_mode (ply_boot_splash_mode_t mode) break; case PLY_BOOT_SPLASH_MODE_UPDATES: case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: filename = NULL; break; case PLY_BOOT_SPLASH_MODE_INVALID: @@ -704,6 +707,7 @@ get_log_file_for_state (state_t *state) case PLY_BOOT_SPLASH_MODE_REBOOT: case PLY_BOOT_SPLASH_MODE_UPDATES: case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: filename = _PATH_DEVNULL; break; case PLY_BOOT_SPLASH_MODE_INVALID: @@ -730,6 +734,7 @@ get_log_spool_file_for_mode (ply_boot_splash_mode_t mode) case PLY_BOOT_SPLASH_MODE_REBOOT: case PLY_BOOT_SPLASH_MODE_UPDATES: case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: filename = NULL; break; case PLY_BOOT_SPLASH_MODE_INVALID: @@ -2149,6 +2154,8 @@ main (int argc, state.mode = PLY_BOOT_SPLASH_MODE_UPDATES; else if (strcmp (mode_string, "system-upgrade") == 0) state.mode = PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE; + else if (strcmp (mode_string, "firmware-upgrade") == 0) + state.mode = PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE; else state.mode = PLY_BOOT_SPLASH_MODE_BOOT_UP; diff --git a/src/plugins/splash/script/script-lib-plymouth.c b/src/plugins/splash/script/script-lib-plymouth.c index ca7ad778..d578223e 100644 --- a/src/plugins/splash/script/script-lib-plymouth.c +++ b/src/plugins/splash/script/script-lib-plymouth.c @@ -79,6 +79,9 @@ static script_return_t plymouth_get_mode (script_state_t *state, case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: obj = script_obj_new_string ("system-upgrade"); break; + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: + obj = script_obj_new_string ("firmware-upgrade"); + break; case PLY_BOOT_SPLASH_MODE_INVALID: default: obj = script_obj_new_string ("unknown"); diff --git a/src/plugins/splash/throbgress/plugin.c b/src/plugins/splash/throbgress/plugin.c index 3982821b..86be064f 100644 --- a/src/plugins/splash/throbgress/plugin.c +++ b/src/plugins/splash/throbgress/plugin.c @@ -723,7 +723,8 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin, double total_duration; if (plugin->mode == PLY_BOOT_SPLASH_MODE_UPDATES || - plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE) + plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE || + plugin->mode == PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE) return; total_duration = duration / percent_done; @@ -935,7 +936,8 @@ system_update (ply_boot_splash_plugin_t *plugin, ply_list_node_t *node; if (plugin->mode != PLY_BOOT_SPLASH_MODE_UPDATES && - plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE) + plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE && + plugin->mode != PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE) return; node = ply_list_get_first_node (plugin->views); diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index e8b91ec9..caf03fcc 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -253,6 +253,7 @@ view_load_end_animation (view_t *view) case PLY_BOOT_SPLASH_MODE_BOOT_UP: case PLY_BOOT_SPLASH_MODE_UPDATES: case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: + case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: animation_prefix = "startup-animation-"; break; case PLY_BOOT_SPLASH_MODE_SHUTDOWN: @@ -1006,6 +1007,7 @@ create_plugin (ply_key_file_t *key_file) load_mode_settings (plugin, key_file, "reboot", PLY_BOOT_SPLASH_MODE_REBOOT); load_mode_settings (plugin, key_file, "updates", PLY_BOOT_SPLASH_MODE_UPDATES); load_mode_settings (plugin, key_file, "system-upgrade", PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE); + load_mode_settings (plugin, key_file, "firmware-upgrade", PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE); if (plugin->use_firmware_background) plugin->background_bgrt_image = ply_image_new ("/sys/firmware/acpi/bgrt/image"); @@ -1583,7 +1585,8 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin, double percent_done) { if (plugin->mode == PLY_BOOT_SPLASH_MODE_UPDATES || - plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE) + plugin->mode == PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE || + plugin->mode == PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE) return; if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL) @@ -1791,7 +1794,8 @@ system_update (ply_boot_splash_plugin_t *plugin, char buf[64]; if (plugin->mode != PLY_BOOT_SPLASH_MODE_UPDATES && - plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE) + plugin->mode != PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE && + plugin->mode != PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE) return; node = ply_list_get_first_node (plugin->views); diff --git a/themes/bgrt/bgrt.plymouth.in b/themes/bgrt/bgrt.plymouth.in index 39bfdc53..ac07bc9f 100644 --- a/themes/bgrt/bgrt.plymouth.in +++ b/themes/bgrt/bgrt.plymouth.in @@ -46,3 +46,11 @@ ProgressBarShowPercentComplete=true UseProgressBar=true _Title=Upgrading System... _SubTitle=Do not turn off your computer + +[firmware-upgrade] +SuppressMessages=true +ProgressBarShowPercentComplete=true +UseProgressBar=true +UseFirmwareBackground=true +_Title=Upgrading Firmware... +_SubTitle=Do not turn off your computer diff --git a/themes/spinner/spinner.plymouth.in b/themes/spinner/spinner.plymouth.in index 5c0b297c..5e5078e8 100644 --- a/themes/spinner/spinner.plymouth.in +++ b/themes/spinner/spinner.plymouth.in @@ -36,3 +36,11 @@ ProgressBarShowPercentComplete=true UseProgressBar=true _Title=Upgrading System... _SubTitle=Do not turn off your computer + +[firmware-upgrade] +SuppressMessages=true +ProgressBarShowPercentComplete=true +UseProgressBar=true +UseFirmwareBackground=true +_Title=Upgrading Firmware... +_SubTitle=Do not turn off your computer |