From aad0c7c3f34ca0b85e12f47b86ae759fbe73dad0 Mon Sep 17 00:00:00 2001 From: luoyaoming Date: Wed, 31 Aug 2022 13:59:44 +0800 Subject: [PATCH] Sync kylin-desktop --- debian/patches/0005-cmdline.patch | 88 -- debian/patches/details-remove-separator.patch | 21 - debian/patches/details-update-status.patch | 36 - .../drop-systemd-vconsole-setup-service.patch | 21 - debian/patches/git-drm-improve.patch | 242 ---- debian/patches/gitlab-center-messages.patch | 28 - debian/patches/initramfsless-boot.patch | 49 - debian/patches/misc-changes.patch | 366 ----- debian/patches/resolve_no_splash.patch | 22 - debian/patches/series | 21 - debian/patches/timeout-for-ping.patch | 38 - debian/patches/ubuntu-add-splash-option.patch | 102 -- .../ubuntu-default-devicetimeout.patch | 28 - debian/patches/ubuntu-logo.patch | 1258 ----------------- debian/patches/ubuntu-spinner-fsck.patch | 289 ---- debian/patches/ubuntu-spinner-style.patch | 31 - debian/patches/ubuntu-text.patch | 904 ------------ debian/source/format | 2 +- 18 files changed, 1 insertion(+), 3545 deletions(-) delete mode 100644 debian/patches/0005-cmdline.patch delete mode 100644 debian/patches/details-remove-separator.patch delete mode 100644 debian/patches/details-update-status.patch delete mode 100644 debian/patches/drop-systemd-vconsole-setup-service.patch delete mode 100644 debian/patches/git-drm-improve.patch delete mode 100644 debian/patches/gitlab-center-messages.patch delete mode 100644 debian/patches/initramfsless-boot.patch delete mode 100644 debian/patches/misc-changes.patch delete mode 100644 debian/patches/resolve_no_splash.patch delete mode 100644 debian/patches/series delete mode 100644 debian/patches/timeout-for-ping.patch delete mode 100644 debian/patches/ubuntu-add-splash-option.patch delete mode 100644 debian/patches/ubuntu-default-devicetimeout.patch delete mode 100644 debian/patches/ubuntu-logo.patch delete mode 100644 debian/patches/ubuntu-spinner-fsck.patch delete mode 100644 debian/patches/ubuntu-spinner-style.patch delete mode 100644 debian/patches/ubuntu-text.patch diff --git a/debian/patches/0005-cmdline.patch b/debian/patches/0005-cmdline.patch deleted file mode 100644 index daa7e1d..0000000 --- a/debian/patches/0005-cmdline.patch +++ /dev/null @@ -1,88 +0,0 @@ -Author: Laurent Bigonville - -Index: plymouth-0.9.4/src/plugins/splash/details/plugin.c -=================================================================== ---- plymouth-0.9.4.orig/src/plugins/splash/details/plugin.c -+++ plymouth-0.9.4/src/plugins/splash/details/plugin.c -@@ -383,10 +383,8 @@ display_password (ply_boot_splash_plugin - strlen (prompt)); - else - write_on_views (plugin, -- "Password", -- strlen ("Password")); -- -- write_on_views (plugin, ":", strlen (":")); -+ "Password:", -+ strlen ("Password:")); - - for (i = 0; i < bullets; i++) { - write_on_views (plugin, "*", strlen ("*")); diff --git a/debian/patches/details-update-status.patch b/debian/patches/details-update-status.patch deleted file mode 100644 index 77d9891..0000000 --- a/debian/patches/details-update-status.patch +++ /dev/null @@ -1,36 +0,0 @@ -Description: Implement update status (U) splash plugin function for details plugins -Author: Dmitrijs Ledkovs -Bug-Ubuntu: https://bugs.launchpad.net/bugs/540645 - ---- a/src/plugins/splash/details/plugin.c -+++ b/src/plugins/splash/details/plugin.c -@@ -81,6 +81,9 @@ - ply_buffer_t *boot_buffer; - }; - -+static void display_message (ply_boot_splash_plugin_t *plugin, -+ const char *message); -+ - static view_t * - view_new (ply_boot_splash_plugin_t *plugin, - ply_text_display_t *display) -@@ -309,6 +312,19 @@ - assert (plugin != NULL); - - ply_trace ("status update"); -+ -+ int progress = 0; -+ -+ if (! strncmp("fsck:", status, 5)) { -+ /* Chop localised formatted string */ -+ /* fsck:sda1:50:Checking disk %1$d of %2$d (%3$d%% complete) */ -+ sscanf(status, "fsck:.*:%d:.*", &progress); -+ char *end = strrchr(status, ':'); -+ strncpy (end, "%\0", 2); -+ } -+ -+ if (progress < 100) -+ display_message (plugin, status); - } - - static void diff --git a/debian/patches/drop-systemd-vconsole-setup-service.patch b/debian/patches/drop-systemd-vconsole-setup-service.patch deleted file mode 100644 index a4cdfd9..0000000 --- a/debian/patches/drop-systemd-vconsole-setup-service.patch +++ /dev/null @@ -1,21 +0,0 @@ -Description: Remove systemd-vconsole-setup.service as it's not shipped in Debian - Remove systemd-vconsole-setup.service as it's not shipped in Debian and add - After=keyboard-setup.service -Author: Laurent Bigonville -Forwarded: not-needed - -Index: plymouth-0.9.4git20190712/systemd-units/plymouth-start.service.in -=================================================================== ---- plymouth-0.9.4git20190712.orig/systemd-units/plymouth-start.service.in -+++ plymouth-0.9.4git20190712/systemd-units/plymouth-start.service.in -@@ -1,8 +1,8 @@ - [Unit] - Description=Show Plymouth Boot Screen - DefaultDependencies=no --Wants=systemd-ask-password-plymouth.path systemd-vconsole-setup.service --After=systemd-vconsole-setup.service systemd-udev-trigger.service systemd-udevd.service -+Wants=systemd-ask-password-plymouth.path -+After=systemd-udev-trigger.service systemd-udevd.service keyboard-setup.service - Before=systemd-ask-password-plymouth.service - ConditionKernelCommandLine=!plymouth.enable=0 - ConditionKernelCommandLine=!nosplash diff --git a/debian/patches/git-drm-improve.patch b/debian/patches/git-drm-improve.patch deleted file mode 100644 index 1bf949e..0000000 --- a/debian/patches/git-drm-improve.patch +++ /dev/null @@ -1,242 +0,0 @@ -From b1273639823f4010d88557ab716c41aa200c5d76 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Mon, 23 Mar 2020 17:38:18 +0100 -Subject: [PATCH 1/2] ply-device-manager: Only consume one udev event at a time - -Commit f9e376797a91 ("ply-device-manager: Consume all events in one go") -changed ply-device-manager to consume all pending udev events in one go -instead of consuming only 1 and then returning back to the mainloop. - -The idea here was to avoid the overhead of returning back to the mainloop, -doing the poll again, seeing more events were pending and then re-enter -ply-device-manager. - -In retrospect this is not a good idea. Systemd waits for oneshot units -like plymouth-switch-root.service to finish and this can block the boot. -Specifically plymouth-switch-root.service must complete before systemd in -the initrd will exec the systemd from the real rootfs. This means that -systemd inside the initrd waits for the: - -ExecStart=-/usr/bin/plymouth update-root-fs --new-root-dir=/sysroot - -Command to complete, if this command runs while we are consuming udev -events from the graphics card (which sends a change event per probed -connector during the initial probe), then plymouth will not send the ack -to the plymouth boot-client (completing the ExecStart) until all udev -events are consumed. - -On my main workstation with i915 graphics and 2 HDMI connected FHD monitors, -this delays the actual switching of the root by 1.9 - 2.1 seconds, -because the re-enumaration of the connectors in the drm plugin takes -about 0.4 seconds per run. - -Other upcoming changes will greatly reduce that 0.4 seconds, but still -returning to the main-loop after a single udev event so that we can -answer any waiting boot-clients ASAP is a good idea. - -This reverts commit f9e376797a91ad5fbc1f8e8e4aea778f4f22397c. - -Signed-off-by: Hans de Goede ---- - src/libply-splash-core/ply-device-manager.c | 16 ++++------------ - 1 file changed, 4 insertions(+), 12 deletions(-) - -diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c -index 160b8cb..f65d731 100644 ---- a/src/libply-splash-core/ply-device-manager.c -+++ b/src/libply-splash-core/ply-device-manager.c -@@ -415,7 +415,7 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager, - } - } - --static bool -+static void - on_udev_event (ply_device_manager_t *manager) - { - struct udev_device *device; -@@ -423,14 +423,14 @@ on_udev_event (ply_device_manager_t *manager) - - device = udev_monitor_receive_device (manager->udev_monitor); - if (device == NULL) -- return false; -+ return; - - action = udev_device_get_action (device); - - ply_trace ("got %s event for device %s", action, udev_device_get_sysname (device)); - - if (action == NULL) -- return false; -+ return; - - if (strcmp (action, "add") == 0 || strcmp (action, "change") == 0) { - const char *subsystem; -@@ -450,14 +450,6 @@ on_udev_event (ply_device_manager_t *manager) - } - - udev_device_unref (device); -- return true; --} -- --static void --on_udev_event_loop (ply_device_manager_t *manager) --{ -- /* Call on_udev_event until all events are consumed */ -- while (on_udev_event (manager)) {} - } - - static void -@@ -487,7 +479,7 @@ watch_for_udev_events (ply_device_manager_t *manager) - fd, - PLY_EVENT_LOOP_FD_STATUS_HAS_DATA, - (ply_event_handler_t) -- on_udev_event_loop, -+ on_udev_event, - NULL, - manager); - } --- -2.24.1 - - -From 3aa76fcd872b5a528bf99a740cbdb2b443434ac0 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Tue, 24 Mar 2020 23:17:42 +0100 -Subject: [PATCH 2/2] drm: Do not unnecessarily get output info twice - -When a kernel-mode-setting driver loads it will trigger an add udev event -for /dev/dri/card0, followed by one udev change event per connector on the -card. This means that after our initial probe of the card, -create_heads_for_active_connectors is called a number of times for all the -udev change events. - -After the initial enum our outputs array will contain active entries for -all connected displays. Meaning that the first loop in -create_heads_for_active_connectors would call get_output_info for -these outputs. Under the hood this does a number of ioctls and especially -the drmModeGetConnector call can be quite expensive. - -Then in the second loop create_heads_for_active_connectors would call -get_output_info for all connectors, including for the once which were -checked in the first loop. - -There is no reason why we cannot check if active connectors in the -old outputs array have changed when we are calling get_output_info for -all connectors to build the new array. This avoids unnecessarily making -the expensive get_output_info call twice for active connectors in the -old outputs array. - -Signed-off-by: Hans de Goede ---- - src/plugins/renderers/drm/plugin.c | 72 +++++++++++++++++++----------- - 1 file changed, 46 insertions(+), 26 deletions(-) - -diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c -index 1ef2802..4dbf8da 100644 ---- a/src/plugins/renderers/drm/plugin.c -+++ b/src/plugins/renderers/drm/plugin.c -@@ -1333,6 +1333,34 @@ remove_output (ply_renderer_backend_t *backend, ply_output_t *output) - ply_renderer_head_remove_connector (backend, head, output->connector_id); - } - -+/* Check if an output has changed since we last enumerated it; and if -+ * it has changed remove it from the head it is part of. -+ */ -+static bool -+check_if_output_has_changed (ply_renderer_backend_t *backend, -+ ply_output_t *new_output) -+{ -+ ply_output_t *old_output = NULL; -+ int i; -+ -+ for (i = 0; i < backend->outputs_len; i++) { -+ if (backend->outputs[i].connector_id == new_output->connector_id) { -+ old_output = &backend->outputs[i]; -+ break; -+ } -+ } -+ -+ if (!old_output || !old_output->controller_id) -+ return false; -+ -+ if (memcmp(old_output, new_output, sizeof(ply_output_t)) == 0) -+ return false; -+ -+ ply_trace ("Output for connector %u changed, removing", old_output->connector_id); -+ remove_output (backend, old_output); -+ return true; -+} -+ - /* Update our outputs array to match the hardware state and - * create and/or remove heads as necessary. - * Returns true if any heads were modified. -@@ -1341,37 +1369,18 @@ static bool - create_heads_for_active_connectors (ply_renderer_backend_t *backend, bool change) - { - int i, j, number_of_setup_outputs, outputs_len; -- ply_output_t output, *outputs; -+ ply_output_t *outputs; - bool changed = false; - - /* Step 1: -- * Remove existing outputs from heads if they have changed. -- */ -- ply_trace ("Checking currently connected outputs for changes"); -- for (i = 0; i < backend->outputs_len; i++) { -- if (!backend->outputs[i].controller_id) -- continue; -- -- get_output_info (backend, backend->outputs[i].connector_id, &output); -- -- if (memcmp(&backend->outputs[i], &output, sizeof(ply_output_t))) { -- ply_trace ("Output for connector %u changed, removing", -- backend->outputs[i].connector_id); -- remove_output (backend, &backend->outputs[i]); -- changed = true; -- } -- } -- -- /* Step 2: -- * Now that we've removed changed connectors from the heads, we can -- * simply rebuild the outputs array from scratch. For any unchanged -- * outputs for which we already have a head, we will end up in -- * ply_renderer_head_add_connector which will ignore the already -- * added connector. -+ * Query all outputs and: -+ * 1.1 Remove currently connected outputs from their heads if changed. -+ * 1.2 Build a new outputs array from scratch. For any unchanged -+ * outputs for which we already have a head, we will end up in -+ * ply_renderer_head_add_connector which will ignore the already -+ * added connector. - */ - ply_trace ("(Re)enumerating all outputs"); -- free (backend->outputs); -- backend->outputs = NULL; - - outputs = calloc (backend->resources->count_connectors, sizeof(*outputs)); - outputs_len = backend->resources->count_connectors; -@@ -1379,10 +1388,21 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend, bool change - backend->connected_count = 0; - for (i = 0; i < outputs_len; i++) { - get_output_info (backend, backend->resources->connectors[i], &outputs[i]); -+ -+ if (check_if_output_has_changed (backend, &outputs[i])) -+ changed = true; -+ - if (outputs[i].connected) - backend->connected_count++; - } - -+ /* Step 2: -+ * Free the old outputs array, now that we have checked for changes -+ * we no longer need it. -+ */ -+ free (backend->outputs); -+ backend->outputs = NULL; -+ - /* Step 3: - * Drop controllers for clones for which we've picked different modes. - */ --- -2.24.1 - diff --git a/debian/patches/gitlab-center-messages.patch b/debian/patches/gitlab-center-messages.patch deleted file mode 100644 index 7dc1e25..0000000 --- a/debian/patches/gitlab-center-messages.patch +++ /dev/null @@ -1,28 +0,0 @@ -From d42ed5e4efdfee8cbd291101c5f269d3108f5b27 Mon Sep 17 00:00:00 2001 -From: Daniel van Vugt -Date: Mon, 30 Mar 2020 18:52:39 +0800 -Subject: [PATCH] two-step: Center message text within labels if labels are - centered - -This makes a difference when you start rendering multiple lines in -a single label. For a single line label you won't see any difference. - -Upstream: https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/103 ---- - src/plugins/splash/two-step/plugin.c | 3 +++ - 1 file changed, 3 insertions(+) - -Index: plymouth-0.9.4git20200323/src/plugins/splash/two-step/plugin.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/plugins/splash/two-step/plugin.c -+++ plymouth-0.9.4git20200323/src/plugins/splash/two-step/plugin.c -@@ -1876,6 +1876,9 @@ view_show_message (view_t *view, - ply_boot_splash_plugin_t *plugin = view->plugin; - int x, y, width, height; - -+ if (plugin->message_below_animation) -+ ply_label_set_alignment (view->message_label, PLY_LABEL_ALIGN_CENTER); -+ - ply_label_set_text (view->message_label, message); - width = ply_label_get_width (view->message_label); - height = ply_label_get_height (view->message_label); diff --git a/debian/patches/initramfsless-boot.patch b/debian/patches/initramfsless-boot.patch deleted file mode 100644 index 2cb3906..0000000 --- a/debian/patches/initramfsless-boot.patch +++ /dev/null @@ -1,49 +0,0 @@ -Author: Steve Langasek -Description: support initramfsless boot - Don't fail if --attach-to-session is passed and /dev/pts isn't mounted - yet, as this breaks booting without an initramfs. -Bug-Ubuntu: https://bugs.launchpad.net/bugs/981314 - -Index: plymouth-0.9.4git20200323/src/main.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/main.c -+++ plymouth-0.9.4git20200323/src/main.c -@@ -1780,6 +1780,7 @@ attach_to_running_session (state_t *stat - session = ply_terminal_session_new (NULL); - - ply_terminal_session_attach_to_event_loop (session, state->loop); -+ state->session = session; - } else { - session = state->session; - ply_trace ("session already created"); -@@ -1791,12 +1792,6 @@ attach_to_running_session (state_t *stat - (ply_terminal_session_hangup_handler_t) - (should_be_redirected ? on_session_hangup : NULL), - -1, state)) { -- ply_save_errno (); -- ply_terminal_session_free (session); -- ply_buffer_free (state->boot_buffer); -- state->boot_buffer = NULL; -- ply_restore_errno (); -- - state->is_redirected = false; - state->is_attached = false; - return false; -@@ -1808,7 +1803,6 @@ attach_to_running_session (state_t *stat - - state->is_redirected = should_be_redirected; - state->is_attached = true; -- state->session = session; - - return true; - } -@@ -2248,9 +2242,6 @@ main (int argc, - state.should_be_attached = attach_to_session; - if (!attach_to_running_session (&state)) { - ply_trace ("could not redirect console session: %m"); -- if (!no_daemon) -- ply_detach_daemon (daemon_handle, EX_UNAVAILABLE); -- return EX_UNAVAILABLE; - } - } - diff --git a/debian/patches/misc-changes.patch b/debian/patches/misc-changes.patch deleted file mode 100644 index 43c7e15..0000000 --- a/debian/patches/misc-changes.patch +++ /dev/null @@ -1,366 +0,0 @@ -Description: Undocumented changes - This patch contains undocumented changes accumulated during previous - versions of the Ubuntu plymouth package, that have not yet been split up - into individually-documented patches. Please try not to add further things - to this patch. Using quilt for new changes is recommended, but if you - don't, they'll end up in a separate debian-changes patch at the end of the - patch series. -Last-Update: 2011-01-21 - -Index: plymouth-0.9.4git20200323/src/main.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/main.c -+++ plymouth-0.9.4git20200323/src/main.c -@@ -116,6 +116,7 @@ typedef struct - const char *default_tty; - - int number_of_errors; -+ ply_list_t *pending_messages; - } state_t; - - static void show_splash (state_t *state); -@@ -180,8 +181,9 @@ on_update (state_t *state, - const char *status) - { - ply_trace ("updating status to '%s'", status); -- ply_progress_status_update (state->progress, -- status); -+ if (strncmp (status, "fsck:", 5)) -+ ply_progress_status_update (state->progress, -+ status); - if (state->boot_splash != NULL) - ply_boot_splash_update_status (state->boot_splash, - status); -@@ -235,6 +237,25 @@ on_system_update (state_t *state, - } - - static void -+flush_pending_messages (state_t *state) -+{ -+ ply_list_node_t *node = ply_list_get_first_node (state->pending_messages); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ char *message = ply_list_node_get_data (node); -+ -+ ply_trace ("displaying queued message"); -+ -+ ply_boot_splash_display_message (state->boot_splash, message); -+ next_node = ply_list_get_next_node (state->pending_messages, node); -+ ply_list_remove_node (state->pending_messages, node); -+ free(message); -+ node = next_node; -+ } -+} -+ -+static void - show_messages (state_t *state) - { - if (state->boot_splash == NULL) { -@@ -464,7 +485,7 @@ show_default_splash (state_t *state) - if (state->boot_splash == NULL) { - ply_trace ("Could not start default splash screen," - "showing text splash screen"); -- state->boot_splash = show_theme (state, PLYMOUTH_THEME_PATH "text/text.plymouth"); -+ state->boot_splash = show_theme (state, PLYMOUTH_THEME_PATH "text.plymouth"); - } - - if (state->boot_splash == NULL) { -@@ -474,7 +495,8 @@ show_default_splash (state_t *state) - } - - if (state->boot_splash == NULL) { -- ply_error ("plymouthd: could not start boot splash: %m"); -+ if (errno != ENOENT) -+ ply_error ("plymouthd: could not start boot splash: %m"); - return; - } - -@@ -561,8 +583,8 @@ on_display_message (state_t *state, - ply_boot_splash_display_message (state->boot_splash, message); - } else { - ply_trace ("not displaying message %s as no splash", message); -+ ply_list_append_data (state->messages, strdup (message)); - } -- ply_list_append_data (state->messages, strdup (message)); - } - - static void -@@ -791,6 +813,7 @@ prepare_logging (state_t *state) - if (state->number_of_errors > 0) - spool_error (state); - } -+ flush_pending_messages (state); - } - - static void -@@ -1966,6 +1989,7 @@ initialize_environment (state_t *state) - state->keystroke_triggers = ply_list_new (); - state->entry_triggers = ply_list_new (); - state->entry_buffer = ply_buffer_new (); -+ state->pending_messages = ply_list_new (); - state->messages = ply_list_new (); - - if (!ply_is_tracing ()) -Index: plymouth-0.9.4git20200323/src/plugins/splash/script/script-lib-image.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/plugins/splash/script/script-lib-image.c -+++ plymouth-0.9.4git20200323/src/plugins/splash/script/script-lib-image.c -@@ -200,7 +200,7 @@ static script_return_t image_text (scrip - - alpha_obj = script_obj_hash_peek_element (state->local, "alpha"); - -- if (script_obj_is_number (alpha_obj)) -+ if (alpha_obj && script_obj_is_number (alpha_obj)) - alpha = CLAMP (script_obj_as_number (alpha_obj), 0, 1); - else - alpha = 1; -Index: plymouth-0.9.4git20200323/src/plugins/splash/script/script-lib-sprite.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/plugins/splash/script/script-lib-sprite.c -+++ plymouth-0.9.4git20200323/src/plugins/splash/script/script-lib-sprite.c -@@ -387,6 +387,45 @@ static script_return_t sprite_window_set - return script_return_obj_null (); - } - -+static script_return_t sprite_window_get_bits_per_pixel (script_state_t *state, -+ void *user_data) -+{ -+ script_lib_sprite_data_t *data = user_data; -+ ply_list_node_t *node; -+ int index; -+ script_obj_t *index_obj; -+ script_lib_display_t *display; -+ unsigned int bits_per_pixel; -+ -+ index_obj = script_obj_hash_peek_element (state->local, "window"); -+ -+ if (index_obj) -+ { -+ index = script_obj_as_number (index_obj); -+ script_obj_unref(index_obj); -+ if (index < 0) -+ return script_return_obj_null (); -+ node = ply_list_get_nth_node (data->displays, index); -+ if (node == NULL) -+ return script_return_obj_null (); -+ display = ply_list_node_get_data (node); -+ bits_per_pixel = ply_pixel_display_get_bits_per_pixel (display->pixel_display); -+ return script_return_obj (script_obj_new_number (bits_per_pixel)); -+ } -+ -+ bits_per_pixel = 0; -+ for (node = ply_list_get_first_node (data->displays); -+ node; -+ node = ply_list_get_next_node (data->displays, node)) -+ { -+ display = ply_list_node_get_data (node); -+ bits_per_pixel = ply_pixel_display_get_bits_per_pixel (display->pixel_display); -+ if (bits_per_pixel) -+ break; -+ } -+ return script_return_obj (script_obj_new_number (bits_per_pixel)); -+} -+ - static uint32_t extract_rgb_color (script_state_t *state) - { - uint8_t red = CLAMP (255 * script_obj_hash_get_number (state->local, "red"), 0, 255); -@@ -663,6 +702,12 @@ script_lib_sprite_data_t *script_lib_spr - "value", - NULL); - script_add_native_function (window_hash, -+ "GetBitsPerPixel", -+ sprite_window_get_bits_per_pixel, -+ data, -+ "window", -+ NULL); -+ script_add_native_function (window_hash, - "SetBackgroundTopColor", - sprite_window_set_background_top_color, - data, -Index: plymouth-0.9.4git20200323/src/plugins/splash/text/plugin.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/plugins/splash/text/plugin.c -+++ plymouth-0.9.4git20200323/src/plugins/splash/text/plugin.c -@@ -465,8 +465,10 @@ add_text_display (ply_boot_splash_plugin - view = view_new (plugin, display); - - terminal = ply_text_display_get_terminal (view->display); -- if (ply_terminal_open (terminal)) -+ if (ply_terminal_open (terminal)) { -+ ply_terminal_set_mode (terminal, PLY_TERMINAL_MODE_TEXT); - ply_terminal_activate_vt (terminal); -+ } - - ply_text_display_set_draw_handler (view->display, - (ply_text_display_draw_handler_t) -Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-renderer.c -+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer.c -@@ -353,6 +353,21 @@ ply_renderer_get_buffer_for_head (ply_re - head); - } - -+unsigned int -+ply_renderer_get_bits_per_pixel_for_head (ply_renderer_t *renderer, -+ ply_renderer_head_t *head) -+{ -+ assert (renderer != NULL); -+ assert (renderer->plugin_interface != NULL); -+ assert (head != NULL); -+ -+ if (!renderer->plugin_interface->get_bits_per_pixel_for_head) -+ return 0; -+ -+ return renderer->plugin_interface->get_bits_per_pixel_for_head (renderer->backend, -+ head); -+} -+ - void - ply_renderer_flush_head (ply_renderer_t *renderer, - ply_renderer_head_t *head) -Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer.h -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-renderer.h -+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer.h -@@ -64,6 +64,8 @@ const char *ply_renderer_get_device_name - ply_list_t *ply_renderer_get_heads (ply_renderer_t *renderer); - ply_pixel_buffer_t *ply_renderer_get_buffer_for_head (ply_renderer_t *renderer, - ply_renderer_head_t *head); -+unsigned int ply_renderer_get_bits_per_pixel_for_head (ply_renderer_t *renderer, -+ ply_renderer_head_t *head); - - void ply_renderer_flush_head (ply_renderer_t *renderer, - ply_renderer_head_t *head); -Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-pixel-display.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-pixel-display.c -+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-pixel-display.c -@@ -52,6 +52,7 @@ struct _ply_pixel_display - unsigned long width; - unsigned long height; - int device_scale; -+ unsigned int bits_per_pixel; - - ply_pixel_display_draw_handler_t draw_handler; - void *draw_handler_user_data; -@@ -80,6 +81,9 @@ ply_pixel_display_new (ply_renderer_t - display->height = size.height; - display->device_scale = ply_pixel_buffer_get_device_scale (pixel_buffer); - -+ display->bits_per_pixel = ply_renderer_get_bits_per_pixel_for_head (renderer, -+ head); -+ - return display; - } - -@@ -113,6 +117,12 @@ ply_pixel_display_get_device_scale (ply_ - return display->device_scale; - } - -+unsigned int -+ply_pixel_display_get_bits_per_pixel (ply_pixel_display_t *display) -+{ -+ return display->bits_per_pixel; -+} -+ - static void - ply_pixel_display_flush (ply_pixel_display_t *display) - { -Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer-plugin.h -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-renderer-plugin.h -+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer-plugin.h -@@ -55,6 +55,8 @@ typedef struct - - ply_pixel_buffer_t * (*get_buffer_for_head)(ply_renderer_backend_t * backend, - ply_renderer_head_t * head); -+ unsigned int (*get_bits_per_pixel_for_head)(ply_renderer_backend_t * backend, -+ ply_renderer_head_t * head); - - ply_renderer_input_source_t * (*get_input_source)(ply_renderer_backend_t * backend); - bool (*open_input_source)(ply_renderer_backend_t *backend, -Index: plymouth-0.9.4git20200323/src/client/ply-boot-client.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/client/ply-boot-client.c -+++ plymouth-0.9.4git20200323/src/client/ply-boot-client.c -@@ -262,14 +262,30 @@ ply_boot_client_process_incoming_replies - return; - } - -- request_node = ply_list_get_first_node (client->requests_waiting_for_replies); -- assert (request_node != NULL); -+ if (!ply_read (client->socket_fd, byte, sizeof(uint8_t))) { -+ ply_error ("could not read response from boot status daemon"); -+ return; -+ } - -- request = (ply_boot_client_request_t *) ply_list_node_get_data (request_node); -- assert (request != NULL); -+ for (request_node = ply_list_get_first_node (client->requests_waiting_for_replies); -+ ; request_node = ply_list_get_next_node (client->requests_waiting_for_replies, request_node)) { -+ assert (request_node != NULL); -+ request = (ply_boot_client_request_t *) ply_list_node_get_data (request_node); -+ assert (request != NULL); - -- if (!ply_read (client->socket_fd, byte, sizeof(uint8_t))) -- goto out; -+ if (! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD) -+ || ! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_CACHED_PASSWORD) -+ || ! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUESTION) -+ || ! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE)) { -+ if (! memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ANSWER, sizeof (uint8_t)) -+ || ! memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NO_ANSWER, sizeof (uint8_t))) -+ break; -+ } else { -+ if (memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ANSWER, sizeof (uint8_t)) -+ && memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NO_ANSWER, sizeof (uint8_t))) -+ break; -+ } -+ } - - if (memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK, sizeof(uint8_t)) == 0) { - if (request->handler != NULL) -Index: plymouth-0.9.4git20200323/src/plugins/renderers/frame-buffer/plugin.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/plugins/renderers/frame-buffer/plugin.c -+++ plymouth-0.9.4git20200323/src/plugins/renderers/frame-buffer/plugin.c -@@ -637,6 +637,16 @@ get_buffer_for_head (ply_renderer_backen - return backend->head.pixel_buffer; - } - -+static unsigned int -+get_bits_per_pixel_for_head (ply_renderer_backend_t *backend, -+ ply_renderer_head_t *head) -+{ -+ if (head != &backend->head) -+ return 0; -+ -+ return backend->bytes_per_pixel * 8; -+} -+ - static bool - has_input_source (ply_renderer_backend_t *backend, - ply_renderer_input_source_t *input_source) -@@ -753,6 +763,7 @@ ply_renderer_backend_get_interface (void - .flush_head = flush_head, - .get_heads = get_heads, - .get_buffer_for_head = get_buffer_for_head, -+ .get_bits_per_pixel_for_head = get_bits_per_pixel_for_head, - .get_input_source = get_input_source, - .open_input_source = open_input_source, - .set_handler_for_input_source = set_handler_for_input_source, -Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-pixel-display.h -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-pixel-display.h -+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-pixel-display.h -@@ -49,6 +49,8 @@ void ply_pixel_display_free (ply_pixel_d - ply_renderer_t *ply_pixel_display_get_renderer (ply_pixel_display_t *display); - ply_renderer_head_t *ply_pixel_display_get_renderer_head (ply_pixel_display_t *display); - -+unsigned int ply_pixel_display_get_bits_per_pixel (ply_pixel_display_t *display); -+ - unsigned long ply_pixel_display_get_width (ply_pixel_display_t *display); - unsigned long ply_pixel_display_get_height (ply_pixel_display_t *display); - int ply_pixel_display_get_device_scale (ply_pixel_display_t *display); diff --git a/debian/patches/resolve_no_splash.patch b/debian/patches/resolve_no_splash.patch deleted file mode 100644 index 1e21712..0000000 --- a/debian/patches/resolve_no_splash.patch +++ /dev/null @@ -1,22 +0,0 @@ -Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-device-manager.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-device-manager.c -+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-device-manager.c -@@ -524,7 +524,8 @@ get_terminal (ply_device_manager_t *mana - if (strncmp (device_name, "/dev/", strlen ("/dev/")) == 0) - full_name = strdup (device_name); - else -- asprintf (&full_name, "/dev/%s", device_name); -+ asprintf (&full_name, "/dev/%s", "tty0"); -+ //asprintf (&full_name, "/dev/%s", device_name); - - if (strcmp (full_name, "/dev/tty0") == 0 || - strcmp (full_name, "/dev/tty") == 0 || -@@ -971,6 +972,7 @@ ply_device_manager_watch_devices (ply_de - #ifdef HAVE_UDEV - watch_for_udev_events (manager); - create_devices_for_subsystem (manager, SUBSYSTEM_DRM); -+ create_devices_for_subsystem (manager, SUBSYSTEM_FRAME_BUFFER); - ply_event_loop_watch_for_timeout (manager->loop, - device_timeout, - (ply_event_loop_timeout_handler_t) diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index c8c1f42..0000000 --- a/debian/patches/series +++ /dev/null @@ -1,21 +0,0 @@ -0005-cmdline.patch -drop-systemd-vconsole-setup-service.patch -git-drm-improve.patch - -gitlab-center-messages.patch - -## Ubuntu -misc-changes.patch -details-remove-separator.patch -details-update-status.patch -initramfsless-boot.patch -ubuntu-add-splash-option.patch -ubuntu-default-devicetimeout.patch -timeout-for-ping.patch -ubuntu-spinner-style.patch -ubuntu-spinner-fsck.patch - -# Ubuntu themes -ubuntu-logo.patch -ubuntu-text.patch -resolve_no_splash.patch diff --git a/debian/patches/timeout-for-ping.patch b/debian/patches/timeout-for-ping.patch deleted file mode 100644 index fe198d2..0000000 --- a/debian/patches/timeout-for-ping.patch +++ /dev/null @@ -1,38 +0,0 @@ -Description: Don't wait forever for a ping reply. - In the event that plymouthd is not responding the plymouth client will wait - forever when sending a ping to the daemon. Instead of waiting forever timeout - after a couple of seconds. - -Origin: vendor -Author: Brian Murray -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1705345 -Forwarded: no -Last-Update: 2018-03-29 - -Index: plymouth-0.9.4git20200109/src/client/plymouth.c -=================================================================== ---- plymouth-0.9.4git20200109.orig/src/client/plymouth.c -+++ plymouth-0.9.4git20200109/src/client/plymouth.c -@@ -75,6 +75,13 @@ typedef struct - char *keys; - } key_answer_state_t; - -+ply_event_loop_timeout_handler_t timeout_handler(void *user_data) -+{ -+ ply_event_loop_t *loop = user_data; -+ ply_trace ("ping: timed out waiting for plymouthd"); -+ ply_event_loop_exit(loop, 1); -+} -+ - static char ** - split_string (const char *command, - const char delimiter) -@@ -1145,6 +1152,8 @@ main (int argc, - on_success, - (ply_boot_client_response_handler_t) - on_failure, &state); -+ ply_event_loop_watch_for_timeout (state.loop, 2.0, -+ timeout_handler, state.loop); - } else if (should_check_for_active_vt) { - ply_boot_client_ask_daemon_has_active_vt (state.client, - (ply_boot_client_response_handler_t) diff --git a/debian/patches/ubuntu-add-splash-option.patch b/debian/patches/ubuntu-add-splash-option.patch deleted file mode 100644 index 07b39d4..0000000 --- a/debian/patches/ubuntu-add-splash-option.patch +++ /dev/null @@ -1,102 +0,0 @@ -Description: Ensure that we only show plymouth when splash option is provided - Consequently (with debian and ubuntu's patch), plymouth is only triggered if: - - plymouth.enable=0 isn't set - - nosplash isn't set - - we set splash (like on desktop flavors) on the kernel cmdline -Author: Didier Roche -Forwarded: not-needed - ---- - systemd-units/plymouth-halt.service.in | 1 + - systemd-units/plymouth-kexec.service.in | 1 + - systemd-units/plymouth-poweroff.service.in | 1 + - systemd-units/plymouth-reboot.service.in | 1 + - systemd-units/plymouth-start.service.in | 1 + - systemd-units/systemd-ask-password-plymouth.path.in | 1 + - systemd-units/systemd-ask-password-plymouth.service.in | 1 + - 7 files changed, 7 insertions(+) - -Index: plymouth-0.9.4git20200323/systemd-units/plymouth-halt.service.in -=================================================================== ---- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-halt.service.in -+++ plymouth-0.9.4git20200323/systemd-units/plymouth-halt.service.in -@@ -5,6 +5,7 @@ Before=systemd-halt.service - DefaultDependencies=no - ConditionKernelCommandLine=!plymouth.enable=0 - ConditionKernelCommandLine=!nosplash -+ConditionKernelCommandLine=splash - ConditionVirtualization=!container - - [Service] -Index: plymouth-0.9.4git20200323/systemd-units/plymouth-kexec.service.in -=================================================================== ---- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-kexec.service.in -+++ plymouth-0.9.4git20200323/systemd-units/plymouth-kexec.service.in -@@ -5,6 +5,7 @@ Before=systemd-kexec.service - DefaultDependencies=no - ConditionKernelCommandLine=!plymouth.enable=0 - ConditionKernelCommandLine=!nosplash -+ConditionKernelCommandLine=splash - ConditionVirtualization=!container - - [Service] -Index: plymouth-0.9.4git20200323/systemd-units/plymouth-poweroff.service.in -=================================================================== ---- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-poweroff.service.in -+++ plymouth-0.9.4git20200323/systemd-units/plymouth-poweroff.service.in -@@ -5,6 +5,7 @@ Before=systemd-poweroff.service - DefaultDependencies=no - ConditionKernelCommandLine=!plymouth.enable=0 - ConditionKernelCommandLine=!nosplash -+ConditionKernelCommandLine=splash - ConditionVirtualization=!container - - [Service] -Index: plymouth-0.9.4git20200323/systemd-units/plymouth-reboot.service.in -=================================================================== ---- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-reboot.service.in -+++ plymouth-0.9.4git20200323/systemd-units/plymouth-reboot.service.in -@@ -5,6 +5,7 @@ Before=systemd-reboot.service - DefaultDependencies=no - ConditionKernelCommandLine=!plymouth.enable=0 - ConditionKernelCommandLine=!nosplash -+ConditionKernelCommandLine=splash - ConditionVirtualization=!container - - [Service] -Index: plymouth-0.9.4git20200323/systemd-units/plymouth-start.service.in -=================================================================== ---- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-start.service.in -+++ plymouth-0.9.4git20200323/systemd-units/plymouth-start.service.in -@@ -6,6 +6,7 @@ After=systemd-udev-trigger.service syste - Before=systemd-ask-password-plymouth.service - ConditionKernelCommandLine=!plymouth.enable=0 - ConditionKernelCommandLine=!nosplash -+ConditionKernelCommandLine=splash - ConditionVirtualization=!container - - [Service] -Index: plymouth-0.9.4git20200323/systemd-units/systemd-ask-password-plymouth.path.in -=================================================================== ---- plymouth-0.9.4git20200323.orig/systemd-units/systemd-ask-password-plymouth.path.in -+++ plymouth-0.9.4git20200323/systemd-units/systemd-ask-password-plymouth.path.in -@@ -7,6 +7,7 @@ After=plymouth-start.service - Before=basic.target shutdown.target - ConditionKernelCommandLine=!plymouth.enable=0 - ConditionKernelCommandLine=!nosplash -+ConditionKernelCommandLine=splash - ConditionPathExists=/run/plymouth/pid - ConditionVirtualization=!container - -Index: plymouth-0.9.4git20200323/systemd-units/systemd-ask-password-plymouth.service.in -=================================================================== ---- plymouth-0.9.4git20200323.orig/systemd-units/systemd-ask-password-plymouth.service.in -+++ plymouth-0.9.4git20200323/systemd-units/systemd-ask-password-plymouth.service.in -@@ -7,6 +7,7 @@ After=plymouth-start.service - Before=shutdown.target - ConditionKernelCommandLine=!plymouth.enable=0 - ConditionKernelCommandLine=!nosplash -+ConditionKernelCommandLine=splash - ConditionVirtualization=!container - ConditionPathExists=@plymouthruntimedir@/pid - diff --git a/debian/patches/ubuntu-default-devicetimeout.patch b/debian/patches/ubuntu-default-devicetimeout.patch deleted file mode 100644 index fd93561..0000000 --- a/debian/patches/ubuntu-default-devicetimeout.patch +++ /dev/null @@ -1,28 +0,0 @@ -Description: Set default device timeout to 8.0, otherwise graphics fails. - The patch is needed because Ubuntu doesn't install the upstream configuration - file defaults.plymouth (which contains DeviceTimeout=8), but uses - alternatives instead. -Original-Author: Dimitri John Ledkov -Author: Daniel van Vugt -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1838725 -Forwarded: not-needed -Last-Update: 2020-04-01 ---- - src/main.c | 4 ++++ - 1 file changed, 4 insertions(+) - -Index: plymouth_0.9.4git20200323-0ubuntu6/src/main.c -=================================================================== ---- plymouth_0.9.4git20200323-0ubuntu6.orig/src/main.c -+++ plymouth_0.9.4git20200323-0ubuntu6/src/main.c -@@ -2265,6 +2265,10 @@ main (int argc, - find_system_default_splash (&state); - find_distribution_default_splash (&state); - -+ /* Device timeout may not be NAN or zero */ -+ if (isnan (state.device_timeout) || state.device_timeout <= 0.0) -+ state.device_timeout = 8.0; -+ - if (ply_kernel_command_line_has_argument ("plymouth.ignore-serial-consoles")) - device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES; - diff --git a/debian/patches/ubuntu-logo.patch b/debian/patches/ubuntu-logo.patch deleted file mode 100644 index 6a1e2c4..0000000 --- a/debian/patches/ubuntu-logo.patch +++ /dev/null @@ -1,1258 +0,0 @@ -Description: Add ubuntu-logo theme -Author: Alberto Milone -Forwarded: not-needed -Index: plymouth-0.9.4git20200323/themes/ubuntu-logo/Makefile.am -=================================================================== ---- /dev/null -+++ plymouth-0.9.4git20200323/themes/ubuntu-logo/Makefile.am -@@ -0,0 +1,24 @@ -+themedir = $(datadir)/plymouth/themes/ubuntu-logo -+nodist_theme_DATA = ubuntu-logo.plymouth -+dist_theme_DATA = ubuntu-logo.script \ -+ ubuntu-logo.grub \ -+ ubuntu-logo.png \ -+ ubuntu-logo16.png \ -+ noise-texture.png \ -+ password-field.png \ -+ password-field16.png \ -+ progress-dot-off.png \ -+ progress-dot-off16.png \ -+ progress-dot-on.png \ -+ progress-dot-on16.png -+ -+ -+ -+MAINTAINERCLEANFILES = Makefile.in ubuntu-logo.plymouth -+CLEANFILES = ubuntu-logo.plymouth -+ -+ubuntu-logo.plymouth: $(srcdir)/ubuntu-logo.plymouth.in -+ sed -e 's,[@]PLYMOUTH_THEME_PATH[@],$(PLYMOUTH_THEME_PATH),g' \ -+ $(srcdir)/ubuntu-logo.plymouth.in > ubuntu-logo.plymouth -+ -+EXTRA_DIST = ubuntu-logo.plymouth.in -Index: plymouth-0.9.4git20200323/themes/ubuntu-logo/ubuntu-logo.plymouth.in -=================================================================== ---- /dev/null -+++ plymouth-0.9.4git20200323/themes/ubuntu-logo/ubuntu-logo.plymouth.in -@@ -0,0 +1,8 @@ -+[Plymouth Theme] -+Name=Ubuntu Logo -+Description=A theme that features a blank background with a logo. -+ModuleName=script -+ -+[script] -+ImageDir=@PLYMOUTH_THEME_PATH@/ubuntu-logo -+ScriptFile=@PLYMOUTH_THEME_PATH@/ubuntu-logo/ubuntu-logo.script -Index: plymouth-0.9.4git20200323/themes/ubuntu-logo/ubuntu-logo.script -=================================================================== ---- /dev/null -+++ plymouth-0.9.4git20200323/themes/ubuntu-logo/ubuntu-logo.script -@@ -0,0 +1,1178 @@ -+# ubuntu-logo.script - boot splash plugin -+# -+# Copyright (C) 2009 Canonical Ltd. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2, or (at your option) -+# any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -+# 02111-1307, USA. -+# -+# Written by: Alberto Milone -+# -+# Based on the example provided with the "script plugin" written by: -+# Charlie Brej -+# -+# Question stuff written by: Markus Waas -+# -+# -+ -+# Set the text colour in (rgb / 256) -+text_colour.red = 1.0; -+text_colour.green = 1.0; -+text_colour.blue = 1.0; -+ -+# Tinted text #988592 -+tinted_text_colour.red = 0.59; -+tinted_text_colour.green = 0.52; -+tinted_text_colour.blue = 0.57; -+ -+# Action Text - #ffffff - RGB 255 255 255 -+action_text_colour.red = 1.0; -+action_text_colour.green = 1.0; -+action_text_colour.blue = 1.0; -+ -+# Orange - #ff4012 - RGB 255 64 18 -+debugsprite = Sprite(); -+debugsprite_bottom = Sprite(); -+debugsprite_medium = Sprite(); -+ -+# Ubuntu Font -+ubuntufont = "Ubuntu, sans-serif 11"; -+ubuntualignment = "center"; -+ -+ -+# are we currently prompting for a password? -+prompt_active = 0; -+ -+# General purpose function to create text -+fun WriteText (text, colour) { -+ image = Image.Text (text, colour.red, colour.green, colour.blue, color.alpha, ubuntufont, ubuntualignment); -+ return image; -+} -+ -+fun ImageToText (text) { -+ image = WriteText (text, text_colour); -+ return image; -+} -+ -+fun ImageToTintedText (text) { -+ image = WriteText (text, tinted_text_colour); -+ return image; -+} -+ -+fun ImageToActionText (text) { -+ image = WriteText (text, action_text_colour); -+ return image; -+} -+ -+fun Debug(text) { -+ debugsprite.SetImage(ImageToText (text)); -+} -+ -+fun DebugBottom(text) { -+ debugsprite_bottom.SetImage(ImageToText (text)); -+ debugsprite_bottom.SetPosition(0, (Window.GetHeight (0) - 20), 1); -+} -+ -+fun DebugMedium(text) { -+ debugsprite_medium.SetImage(ImageToText (text)); -+ debugsprite_medium.SetPosition(0, (Window.GetHeight (0) - 60), 1); -+} -+ -+fun TextYOffset() { -+ local.y; -+ local.text_height; -+ local.min_height; -+ -+ # Put the 1st line below the logo + some spacing -+ y = logo.y + logo.height + (progress_indicator.bullet_height * 7 ); # + logo_spacing; -+ -+ text_height = first_line_height * 7.5; -+ -+ min_height = Window.GetHeight(); -+ if (y + text_height > min_height) -+ y = min_height - text_height; -+ -+ if (y < progress_indicator.y + progress_indicator.height) -+ return progress_indicator.y + progress_indicator.height; -+ return y; -+} -+ -+#------------------------------String functions------------------------------- -+ -+# This is the equivalent for strstr() -+fun StringString(string, substring) { -+ start = 0; -+ while (String(string).CharAt (start)) { -+ walk = 0; -+ while (String(substring).CharAt (walk) == String(string).CharAt (start + walk) ) { -+ walk++; -+ if (!String(substring).CharAt (walk)) return start; -+ } -+ start++; -+ } -+ -+ return NULL; -+} -+ -+fun StringLength (string) { -+ index = 0; -+ while (String(string).CharAt(index)) index++; -+ return index; -+} -+ -+fun StringCopy (source, beginning, end) { -+ local.destination = ""; -+ for (index = beginning; ( ( (end == NULL) || (index <= end) ) && (String(source).CharAt(index)) ); index++) { -+ local.destination += String(source).CharAt(index); -+ } -+ -+ return local.destination; -+} -+ -+fun StringReplace (source, pattern, replacement) { -+ local.found = StringString(source, pattern); -+ if (local.found == NULL) -+ return source; -+ -+ local.new_string = StringCopy (source, 0, local.found - 1) + -+ replacement + -+ StringCopy (source, local.found + StringLength(pattern), NULL); -+ -+ return local.new_string; -+} -+ -+# it makes sense to use it only for -+# numbers up to 100 -+fun StringToInteger (str) { -+ int = -1; -+ for (i=0; i<=100; i++) { -+ if (i+"" == str) { -+ int = i; -+ break; -+ } -+ } -+ return int; -+} -+ -+#----------------------------------------------------------------------------- -+# Aubergine evolution -+# Previous background colour -+# #300a24 --> 0.19, 0.04, 0.14 -+# New background colour -+# #2c001e --> 0.16, 0.00, 0.12 -+# Yaru background colour -+# #4f194c --> 0.3098, 0.0980, 0.2980 -+# -+Window.SetBackgroundTopColor (0.3098, 0.0980, 0.2980); # Nice colour on top of the screen fading to -+Window.SetBackgroundBottomColor (0.3098, 0.0980, 0.2980); # an equally nice colour on the bottom -+ -+bits_per_pixel = Window.GetBitsPerPixel (); -+if (bits_per_pixel == 4) { -+ logo_filename = "ubuntu-logo16.png"; -+ progress_dot_off_filename = "progress-dot-off16.png"; -+ progress_dot_on_filename = "progress-dot-on16.png"; -+ password_field_filename = "password-field16.png"; -+ question_field_filename = "password-field16.png"; -+} else { -+ logo_filename = "ubuntu-logo.png"; -+ progress_dot_off_filename = "progress-dot-off.png"; -+ progress_dot_on_filename = "progress-dot-on.png"; -+ password_field_filename = "password-field.png"; -+ question_field_filename = "password-field.png"; -+ -+ noise_filename = "noise-texture.png"; -+ noise.image = Image(noise_filename); -+ noise.width = Window.GetWidth(); -+ noise.height = Window.GetHeight(); -+ noise.image = noise.image.Tile(noise.width, noise.height); -+ noise.sprite = Sprite (); -+ noise.sprite.SetImage (noise.image); -+ noise.x = 0; -+ noise.y = 0; -+ noise.z = 100; -+ noise.sprite.SetX (noise.x); -+ noise.sprite.SetY (noise.y); -+ noise.sprite.SetZ (noise.z); -+ noise.sprite.SetOpacity (1); -+} -+ -+logo.image = Image (logo_filename); -+logo.sprite = Sprite (); -+logo.sprite.SetImage (logo.image); -+logo.width = logo.image.GetWidth (); -+logo.height = logo.image.GetHeight (); -+logo.x = Window.GetX () + Window.GetWidth () / 2 - logo.width / 2; -+logo.y = Window.GetY () + Window.GetHeight () / 2 - logo.height; -+logo.z = 1000; -+logo.sprite.SetX (logo.x); -+logo.sprite.SetY (logo.y); -+logo.sprite.SetZ (logo.z); -+logo.sprite.SetOpacity (1); -+ -+# Spacing below the logo - in pixels -+logo_spacing = logo.height * 4; -+ -+message_notification[0].image = ImageToTintedText (""); -+message_notification[1].image = ImageToTintedText (""); -+fsck_notification.image = ImageToActionText (""); -+ -+status = "normal"; -+ -+progress_indicator.bullet_off = Image (progress_dot_off_filename); -+progress_indicator.bullet_on = Image (progress_dot_on_filename); -+progress_indicator.bullet_width = progress_indicator.bullet_off.GetWidth (); -+progress_indicator.bullet_height = progress_indicator.bullet_off.GetHeight (); -+progress_indicator.bullet_hspacing = progress_indicator.bullet_width * 1.1; -+progress_indicator.width = progress_indicator.bullet_width * 5; -+progress_indicator.height = progress_indicator.bullet_height; -+progress_indicator.y = logo.y + logo.height + (logo.height / 4); -+progress_indicator.x = Window.GetX () + Window.GetWidth () / 2 - progress_indicator.width / 2; # logo.x + 26; -+ -+# use a fixed string with ascending and descending stems to calibrate the -+# bounding box for the first message, so the messages below don't move up -+# and down according to *their* height. -+first_line_height = ImageToTintedText ("AfpqtM").GetHeight(); -+ -+# if the user has a 640x480 or 800x600 display, we can't quite fit everything -+# (including passphrase prompts) with the target spacing, so scoot the text up -+# a bit if needed. -+top_of_the_text = TextYOffset(); -+ -+#-----------------------------------------Logo functions------------------------------ -+ -+# Call this when updating the screen -+fun draw_logo () { -+ noise.sprite.SetX (noise.x); -+ noise.sprite.SetY (noise.y); -+ noise.sprite.SetZ (noise.z); -+ noise.sprite.SetOpacity (1); -+ logo.sprite.SetX (logo.x); -+ logo.sprite.SetY (logo.y); -+ logo.sprite.SetZ (logo.z); -+ logo.sprite.SetOpacity (1); -+} -+ -+ -+#-----------------------------------------Progress Indicator-------------------------- -+fun set_progress_indicator () { -+ -+ -+ # Here we assume that we can store half bullets on each half of the screen -+ # together with some spacing -+ local.x = progress_indicator.x; -+ -+ for (index = 0; index <= 4; index++) { -+ # Set the "off" bullets -+ progress_indicator.bullets_off[index].sprite = Sprite (progress_indicator.bullet_off); -+ progress_indicator.bullets_off[index].sprite.SetPosition (local.x, progress_indicator.y, 1000); -+ progress_indicator.bullets_off[index].x = local.x; -+ progress_indicator.bullets_off[index].y = progress_indicator.y; -+ progress_indicator.bullets_off[index].sprite.SetOpacity (1); -+ -+ #local.debug_medium_string = "Progress indicator " + index + ": x = " + progress_indicator.bullets_off[index].x + -+ # ", y = " + progress_indicator.bullets_off[index].y + ", logo width = " + logo.width + -+ # ", logo height = " + logo.height + " " + screen_width + " " + screen_height; -+ # -+ #(index % 2) && DebugMedium (local.debug_medium_string) || DebugBottom (local.debug_medium_string); -+ -+ # Set the "on" bullets on top of the "off" bullets and make them transparent -+ progress_indicator.bullets_on[index].sprite = Sprite (progress_indicator.bullet_on); -+ progress_indicator.bullets_on[index].x = progress_indicator.bullets_off[index].x; -+ progress_indicator.bullets_on[index].y = progress_indicator.bullets_off[index].y; -+ progress_indicator.bullets_on[index].sprite.SetPosition (progress_indicator.bullets_on[index].x, progress_indicator.bullets_on[index].y, 10000); -+ -+ progress_indicator.bullets_on[index].sprite.SetOpacity (0); -+ -+ local.x += progress_indicator.bullet_hspacing; -+ } -+ #local.debug_string = "Progress indicator: x1 = " + progress_indicator.x + ", x2 = " + local.x + ", y = " + progress_indicator.y + -+ # ", x logo = " + logo.x + ", y logo = " + logo.y + ", indicator width = " + progress_indicator.width; -+ #Debug(progress_indicator.bullets_off[0].x); -+} -+ -+ -+# We have 2 bullets, one on top of the other: -+# The white one is on top of the red one and the former should -+# slowly fade so as to get a nice transition effect. -+fun switch_on_bullet (bullets_off, bullets_on, bullet_number, opacity) { -+ local.x = bullets_on[bullet_number].x; -+ local.y = bullets_on[bullet_number].y; -+ local.z = bullets_on[bullet_number].z; -+ -+ # Hide the bullets which are off -+ bullets_off[bullet_number].sprite.SetOpacity (0); -+ -+ # Show the bullets which are on -+ bullets_on[bullet_number].sprite.SetPosition (local.x, local.y, local.z); -+ bullets_on[bullet_number].sprite.SetOpacity (opacity); -+ -+ # Bump the number of times we have switched on bullets -+ global.times_bullets_switched++; -+} -+ -+fun switch_off_bullets () { -+ # Debug("Switching off progress indicator"); -+ -+ set_progress_indicator (); -+ global.times_bullets_switched = 0; -+ global.on_off = 1; -+} -+ -+# This is something that we can call when we exit -+fun switch_on_bullets () { -+ # Debug("Switching off progress indicator"); -+ if (!global.progress_indicator.bullets_on) set_progress_indicator (); -+ local = global.progress_indicator; -+ -+ for (index = 0; bullets_on[index]; index++) { -+ switch_on_bullet (bullets_off, bullets_on, index, 1.0); -+ } -+} -+ -+ -+# Implement in boot progress callback -+fun animate_progress_indicator (progress, time) { -+ if (global.progress_time == NULL) { -+ global.progress_time = progress; #time; -+ switch_off_bullets (); -+ } -+ -+# Debug ("progress = " + progress + ", time = " + time + " times switched = " + global.times_bullets_switched + " on_off " + global.on_off); -+ -+# if (global.times_bullets_switched == NULL) -+# global.times_bullets_switched = 5; -+ -+# if (global.on_off == NULL) -+# global.on_off = 0; -+ -+ if ((progress - global.progress_time) >= 1.0) { -+ global.progress_time = progress; -+ -+ if (global.times_bullets_switched == 5) { -+ # Change which bullets are switched on -+ # and which ones are switched off -+ global.on_off = !global.on_off; -+ global.times_bullets_switched = 0; -+ } -+ -+ if (global.on_off) { -+ switch_on_bullet (progress_indicator.bullets_off, progress_indicator.bullets_on, -+ global.times_bullets_switched, 1.0); -+ } -+ else { -+ switch_on_bullet (progress_indicator.bullets_on, progress_indicator.bullets_off, -+ global.times_bullets_switched, 1.0); -+ } -+ } -+ -+ -+ # Start setting bullets to "on" with translucency -+# for (index = 0; index <= 5; index++) { -+# opacity = 0.0; -+# while (opacity <= 1.0) { -+# switch_on_bullet (progress_indicator.bullets_off, progress_indicator.bullets_on, -+# index, opacity); -+# opacity += 0.1; -+# } -+# } -+} -+ -+ -+#-----------------------------------------Label utility functions--------------------- -+ -+# label should be either a string or NULL -+# Images for n lines will be created and returned as items of the -+# message_label array -+# -+fun get_message_label (label, is_fake, is_action_line) { -+ # Debug("Get Label position"); -+ local.message_label; -+ -+ if (is_fake) -+ # Create a fake label so as to get the y coordinate of -+ # a standard-length label. -+ local.message_image = ImageToTintedText ("This is a fake message"); -+ else -+ local.message_image = (is_action_line) && ImageToActionText (label) || ImageToTintedText (label); -+ -+ message_label.width = message_image.GetWidth (); -+ message_label.height = message_image.GetHeight (); -+ -+ # Center the line horizontally -+ message_label.x = Window.GetX () + Window.GetWidth () / 2 - message_label.width / 2; -+ -+ message_label.y = top_of_the_text; -+ -+ # Put the 2nd line below the fsck line -+ if (is_action_line) { -+ local.fsck_label.y = message_label.y + (first_line_height + first_line_height / 2); -+ message_label.y = local.fsck_label.y + (first_line_height * 2); -+ } -+ -+ # Debug("action label x = " + message_label.x + " y = " + message_label.y ); -+ -+# message_debug = "msg_x = " + message_label.x + " msg_y = " + message_label.y + -+# "msg_width = " + message_label.width + " msg_height = " + -+# message_label.height + " message = " + label; -+# Debug(message_debug); -+ -+ return message_label; -+ -+} -+ -+# Create an fsck label and/or get its position -+fun get_fsck_label (label, is_fake) { -+ # Debug("Get Label position"); -+ local.fsck_label = global.progress_label; -+ -+ if (is_fake) -+ fsck_label.image = ImageToTintedText ("This is a fake message"); -+ else -+ fsck_label.image = ImageToTintedText (label); -+ -+ fsck_label.width = fsck_label.image.GetWidth (); -+ fsck_label.height = fsck_label.image.GetHeight (); -+ -+ # Centre the label horizontally -+ fsck_label.x = Window.GetX () + Window.GetWidth () / 2 - fsck_label.width / 2; -+ -+ local.first_label = get_message_label (label, 1, 0); -+ -+ # Place the label below the 1st message line -+ fsck_label.y = local.first_label.y + local.first_label.height + (local.first_label.height / 2); -+ -+# message_debug = "msg_x = " + fsck_label.x + " msg_y = " + fsck_label.y + -+# "msg_width = " + fsck_label.width + " msg_height = " + -+# fsck_label.height + " message = " + label; -+# Debug(message_debug); -+ -+ return fsck_label; -+} -+ -+#-----------------------------------------Message stuff -------------------------------- -+# -+ -+# Set up a message label -+# -+# NOTE: this is called when doing something like 'plymouth message "hello world"' -+# -+fun setup_message (message_text, x, y, z, index) { -+ # Debug("Message setup"); -+ global.message_notification[index].image = (index) && ImageToActionText (message_text) || ImageToTintedText (message_text); -+ -+ # Set up the text message, if any -+ message_notification[index].x = x; -+ message_notification[index].y = y; -+ message_notification[index].z = z; -+ -+ message_notification[index].sprite = Sprite (); -+ message_notification[index].sprite.SetImage (message_notification[index].image); -+ message_notification[index].sprite.SetX (message_notification[index].x); -+ message_notification[index].sprite.SetY (message_notification[index].y); -+ message_notification[index].sprite.SetZ (message_notification[index].z); -+ -+} -+ -+fun show_message (index) { -+ if (global.message_notification[index].sprite) global.message_notification[index].sprite.SetOpacity(1); -+} -+ -+fun hide_message (index) { -+ if (global.message_notification[index].sprite) global.message_notification[index].sprite.SetOpacity(0); -+} -+ -+ -+ -+ -+# the callback function is called when new message should be displayed. -+# First arg is message to display. -+fun message_callback (message) -+{ -+ # Debug("Message callback"); -+ is_fake = 0; -+ if (!message || (message == "")) is_fake = 1; -+ -+ local.substring = "keys:"; -+ -+ # Look for the "keys:" prefix -+ local.keys = StringString(message, local.substring); -+ -+ local.is_action_line = (keys != NULL); -+ #Debug("keys " + local.keys + " substring length = " + StringLength(local.substring)); -+ -+ # Get the message without the "keys:" prefix -+ if (keys != NULL) -+ message = StringCopy (message, keys + StringLength(local.substring), NULL); -+ -+ # Get the message without the "fsckd-cancel-msg" prefix as we don't support i18n -+ substring = "fsckd-cancel-msg:"; -+ keys = StringString(message, substring); -+ if (keys != NULL) -+ message = StringCopy(message, keys + StringLength(substring), NULL); -+ -+ local.label.is_fake = is_fake; -+ label = get_message_label(message, is_fake, is_action_line); -+ label.z = 10000; -+ -+ setup_message (message, label.x, label.y, label.z, is_action_line); -+ if (prompt_active && local.is_action_line) -+ hide_message (is_action_line); -+ else -+ show_message (is_action_line); -+ -+} -+ -+ -+#-----------------------------------------Display Password stuff ----------------------- -+# -+ -+fun password_dialogue_setup (message_label) { -+ # Debug("Password dialog setup"); -+ -+ local.entry; -+ local.bullet_image; -+ -+ bullet_image = Image (progress_dot_off_filename); -+ entry.image = Image (password_field_filename); -+ -+ # Hide the normal labels -+ prompt_active = 1; -+ if (message_notification[1].sprite) hide_message (1); -+ -+ # Set the prompt label -+ label = get_message_label(message_label, 0, 1); -+ label.z = 10000; -+ -+ setup_message (message_label, label.x, label.y, label.z, 2); -+ show_message (2); -+ -+ # Set up the text entry which contains the bullets -+ entry.sprite = Sprite (); -+ entry.sprite.SetImage (entry.image); -+ -+ # Centre the box horizontally -+ entry.x = Window.GetX () + Window.GetWidth () / 2 - entry.image.GetWidth () / 2; -+ -+ # Put the entry below the second label. -+ entry.y = message_notification[2].y + label.height; -+ -+ #Debug ("entry x = " + entry.x + ", y = " + entry.y); -+ entry.z = 10000; -+ entry.sprite.SetX (entry.x); -+ entry.sprite.SetY (entry.y); -+ entry.sprite.SetZ (entry.z); -+ -+ global.password_dialogue = local; -+} -+ -+fun password_dialogue_opacity (opacity) { -+ # Debug("Password dialog opacity"); -+ global.password_dialogue.opacity = opacity; -+ local = global.password_dialogue; -+ -+ # You can make the box translucent with a float -+ # entry.sprite.SetOpacity (0.3); -+ entry.sprite.SetOpacity (opacity); -+ label.sprite.SetOpacity (opacity); -+ -+ if (bullets) { -+ for (index = 0; bullets[index]; index++) { -+ bullets[index].sprite.SetOpacity (opacity); -+ } -+ } -+} -+ -+ -+# The callback function is called when the display should display a password dialogue. -+# First arg is prompt string, the second is the number of bullets. -+fun display_password_callback (prompt, bullets) { -+ # Debug("Password dialog setup"); -+ -+ global.status = "password"; -+ if (!global.password_dialogue) password_dialogue_setup(prompt); -+ password_dialogue_opacity (1); -+ bullet_width = password_dialogue.bullet_image.GetWidth(); -+ bullet_y = password_dialogue.entry.y + -+ password_dialogue.entry.image.GetHeight () / 2 - -+ password_dialogue.bullet_image.GetHeight () / 2; -+ margin = bullet_width; -+ spaces = Math.Int( (password_dialogue.entry.image.GetWidth () - (margin * 2) ) / ( 2 * bullet_width / 3 ) ); -+ #Debug ("spaces = " + spaces + ", bullets = " + bullets); -+ bullets_area.width = margin + spaces * ( 2 * bullet_width / 3); -+ bullets_area.x = Window.GetX () + Window.GetWidth () / 2 - bullets_area.width / 2; -+ #DebugBottom ("pwd_entry x = " + password_dialogue.entry.x + ", bullets_area.x = " + bullets_area.x + ", bullets_area.width = " + bullets_area.width); -+ if (bullets > spaces) -+ bullets = spaces; -+ for (index = 0; password_dialogue.bullets[index] || index < spaces ; index++){ -+ if (!password_dialogue.bullets[index]) { -+ password_dialogue.bullets[index].sprite = Sprite (); -+ password_dialogue.bullets[index].sprite.SetImage (password_dialogue.bullet_image); -+ password_dialogue.bullets[index].x = bullets_area.x + # password_dialogue.entry.x + margin + -+ index * ( 2 * bullet_width / 3 ) ; -+ password_dialogue.bullets[index].sprite.SetX (password_dialogue.bullets[index].x); -+ password_dialogue.bullets[index].y = bullet_y; -+ password_dialogue.bullets[index].sprite.SetY (password_dialogue.bullets[index].y); -+ password_dialogue.bullets[index].z = password_dialogue.entry.z + 100 - index; -+ password_dialogue.bullets[index].sprite.SetZ (password_dialogue.bullets[index].z); -+ } -+ -+ password_dialogue.bullets[index].sprite.SetOpacity (0); -+ -+ if (index < bullets ) { -+ password_dialogue.bullets[index].sprite.SetOpacity (1); -+ } -+ } -+} -+ -+Plymouth.SetDisplayPasswordFunction (display_password_callback); -+ -+Plymouth.SetMessageFunction (message_callback); -+ -+Plymouth.SetBootProgressFunction (animate_progress_indicator); -+ -+# Plymouth.SetBootProgressFunction: the callback function is called with two numbers, the progress (between 0 and 1) and the time spent booting so far -+# Plymouth.SetRootMountedFunction: the callback function is called when a new root is mounted -+# Plymouth.SetKeyboardInputFunction: the callback function is called with a string containing a new character entered on the keyboard -+ -+#----------------------------------------- FSCK Counter -------------------------------- -+ -+# Initialise the counter -+fun init_fsck_count () { -+ # The number of fsck checks in this cycle -+ global.counter.total = 0; -+ # The number of fsck checks already performed + the current one -+ global.counter.current = 1; -+ # The previous fsck -+ global.counter.last = 0; -+} -+ -+# Increase the total counter -+fun increase_fsck_count () { -+ global.counter.total++; -+} -+ -+fun increase_current_fsck_count () { -+ global.counter.last = global.counter.current++; -+} -+ -+# Clear the counter -+fun clear_fsck_count () { -+ global.counter = NULL; -+ init_fsck_count (); -+} -+ -+#----------------------------------------- Progress Label ------------------------------ -+ -+ -+# Change the opacity level of a progress label -+# -+# opacity = 1 -> show -+# opacity = 0 -> hide -+# opacity = 0.3 (or any other float) -> translucent -+# -+fun set_progress_label_opacity (opacity) { -+ # the label -+ progress_label.sprite.SetOpacity (opacity); -+ -+ # Make the slot available again when hiding the bar -+ # So that another bar can take its place -+ if (opacity == 0) { -+ progress_label.is_available = 1; -+ progress_label.device = ""; -+ } -+} -+ -+# Set up a new Progress Bar -+# -+# TODO: Make it possible to reuse (rather than recreate) a bar -+# if .is_available = 1. Ideally this would just reset the -+# label, the associated -+# device and the image size of the sprite. -+ -+fun init_progress_label (device, status_string) { -+ # Make the slot unavailable -+ global.progress_label.is_available = 0; -+ progress_label.progress = 0; -+ progress_label.device = device; -+ progress_label.status_string = status_string; -+} -+ -+# See if the progress label is keeping track of the fsck -+# of "device" -+# -+fun device_has_progress_label (device) { -+ #DebugBottom ("label device = " + progress_label.device + " checking device " + device); -+ return (progress_label.device == device); -+} -+ -+# Update the Progress bar which corresponds to index -+# -+fun update_progress_label (progress) { -+ # If progress is NULL then we just refresh the label. -+ # This happens when only counter.total has changed. -+ if (progress != NULL) { -+ progress_label.progress = progress; -+ -+ #Debug("device " + progress_label.device + " progress " + progress); -+ -+ # If progress >= 100% hide the label and make it available again -+ if (progress >= 100) { -+ set_progress_label_opacity (0); -+ -+ # See if we any other fsck check is complete -+ # and, if so, hide the progress bars and the labels -+ on_fsck_completed (); -+ -+ return 0; -+ } -+ } -+ # Update progress label here -+ # -+ # FIXME: the queue logic from this theme should really be moved into mountall -+ # instead of using string replacement to deal with localised strings. -+ label = StringReplace (progress_label.status_string[0], "%1$d", global.counter.current); -+ label = StringReplace (label, "%2$d", global.counter.total); -+ label = StringReplace (label, "%3$d", progress_label.progress); -+ label = StringReplace (label, "%%", "%"); -+ -+ progress_label = get_fsck_label (label, 0); -+ #progress_label.progress = progress; -+ -+ progress_label.sprite = Sprite (progress_label.image); -+ -+ # Set up the bar -+ progress_label.sprite.SetPosition(progress_label.x, progress_label.y, 1); -+ -+ set_progress_label_opacity (1); -+ -+} -+ -+# Refresh the label so as to update counters -+fun refresh_progress_label () { -+ update_progress_label (NULL); -+} -+ -+#----------------------------------------- FSCK Queue ---------------------------------- -+ -+# Initialise the fsck queue -+fun init_queue () { -+ global.fsck_queue[0].device; -+ global.fsck_queue[0].progress; -+ global.fsck_queue.counter = 0; -+ global.fsck_queue.biggest_item = 0; -+} -+ -+fun clear_queue () { -+ global.fsck_queue = NULL; -+ init_queue (); -+} -+ -+# Return either the device index in the queue or -1 -+fun queue_look_up_by_device (device) { -+ for (i=0; i <= fsck_queue.biggest_item; i++) { -+ if ((fsck_queue[i]) && (fsck_queue[i].device == device)) -+ return i; -+ } -+ return -1; -+} -+ -+# Keep track of an fsck process in the queue -+fun add_fsck_to_queue (device, progress) { -+ # Look for an empty slot in the queue -+ for (i=0; global.fsck_queue[i].device; i++) { -+ continue; -+ } -+ local.index = i; -+ -+ # Set device and progress -+ global.fsck_queue[local.index].device = device; -+ global.fsck_queue[local.index].progress = progress; -+ -+ # Increase the queue counter -+ global.fsck_queue.counter++; -+ -+ # Update the max index of the array for iterations -+ if (local.index > global.fsck_queue.biggest_item) -+ global.fsck_queue.biggest_item = local.index; -+ -+ #DebugMedium ("Adding " + device + " at " + local.index); -+} -+ -+fun is_queue_empty () { -+ return (fsck_queue.counter == 0); -+} -+ -+fun is_progress_label_available () { -+ return (progress_label.is_available == 1); -+} -+ -+ -+# This should cover the case in which the fsck checks in -+# the queue are completed before the ones showed in the -+# progress label -+fun on_queued_fsck_completed () { -+ if (!is_queue_empty ()) -+ return; -+ -+ # Hide the extra label, if any -+ #if (progress_bar.extra_label.sprite) -+ # progress_bar.extra_label.sprite.SetOpacity(0); -+} -+ -+fun remove_fsck_from_queue (index) { -+ # Free memory which was previously allocated for -+ # device and progress -+ global.fsck_queue[index].device = NULL; -+ global.fsck_queue[index].progress = NULL; -+ -+ # Decrease the queue counter -+ global.fsck_queue.counter--; -+ -+ # See if there are other processes in the queue -+ # if not, clear the extra_label -+ on_queued_fsck_completed (); -+} -+ -+fun on_fsck_completed () { -+ # We have moved on to tracking the next fsck -+ increase_current_fsck_count (); -+ -+ if (!is_progress_label_available ()) -+ return; -+ -+ if (!is_queue_empty ()) -+ return; -+ -+ # Hide the progress label -+ if (progress_label.sprite) -+ progress_label.sprite.SetOpacity (0); -+ -+ # Clear the queue -+ clear_queue (); -+ -+ # Clear the fsck counter -+ clear_fsck_count (); -+} -+ -+# Update an fsck process that we keep track of in the queue -+fun update_progress_in_queue (index, device, progress) { -+ # If the fsck is complete, remove it from the queue -+ if (progress >= 100) { -+ remove_fsck_from_queue (index); -+ on_queued_fsck_completed (); -+ return; -+ } -+ -+ global.fsck_queue[index].device = device; -+ global.fsck_queue[index].progress = progress; -+ -+} -+ -+# TODO: Move it to some function -+# Create an empty queue -+#init_queue (); -+ -+ -+#----------------------------------------- FSCK Functions ------------------------------ -+ -+ -+# Either add a new bar for fsck checks or update an existing bar -+# -+# NOTE: no more than "progress_bar.max_number" bars are allowed -+# -+fun fsck_check (device, progress, status_string) { -+ -+ # The 1st time this will take place -+ if (!global.progress_label) { -+ # Increase the fsck counter -+ increase_fsck_count (); -+ -+ # Set up a new label for the check -+ init_progress_label (device, status_string); -+ update_progress_label (progress); -+ -+ return; -+ } -+ -+ -+ if (device_has_progress_label (device)) { -+ # Update the progress of the existing label -+ update_progress_label (progress); -+ } -+ else { -+ # See if there's already a slot in the queue for the device -+ local.queue_device_index = queue_look_up_by_device(device); -+ -+ # See if the progress_label is available -+ if (progress_label.is_available) { -+ -+# local.my_string = "available index " + local.available_index + " progress_bar counter is " + progress_bar.counter; -+# Debug(local.my_string); -+ -+ -+ # If the fsck check for the device was in the queue, then -+ # remove it from the queue -+ if (local.queue_device_index >= 0) { -+ remove_fsck_from_queue (index); -+ } -+ else { -+ # Increase the fsck counter -+ increase_fsck_count (); -+ } -+ -+# local.my_string += local.message; -+ #Debug("setting new label for device " + device + " progress " + progress); -+ -+ # Set up a new label for the check -+ init_progress_label (device, status_string); -+ update_progress_label (progress); -+ -+ } -+ # If the progress_label is not available -+ else { -+ -+ # If the fsck check for the device is already in the queue -+ # just update its progress in the queue -+ if (local.queue_device_index >= 0) { -+ #DebugMedium("Updating queue at " + local.queue_device_index + " for device " + device); -+ update_progress_in_queue (local.queue_device_index, device, progress); -+ } -+ # Otherwise add the check to the queue -+ else { -+ #DebugMedium("Adding device " + device + " to queue at " + local.queue_device_index); -+ add_fsck_to_queue (device, progress); -+ -+ # Increase the fsck counter -+ increase_fsck_count (); -+ -+ refresh_progress_label (); -+ } -+ -+ } -+ } -+ -+# if (!is_queue_empty ()) { -+# DebugBottom("Extra label for "+ device); -+ #} -+# else { -+# DebugBottom("No extra label for " + device + ". 1st Device in the queue "+ fsck_queue[0].device + " counter = " + global.fsck_queue.counter); -+# } -+} -+ -+ -+#-----------------------------------------Update Status stuff -------------------------- -+# -+# The update_status_callback is what we can use to pass plymouth whatever we want so -+# as to make use of features which are available only in this program (as opposed to -+# being available for any theme for the script plugin). -+# -+# Example: -+# -+# Thanks to the current implementation, some scripts can call "plymouth --update=fsck:sda1:40" -+# and this program will know that 1) we're performing and fsck check, 2) we're checking sda1, -+# 3) the program should set the label progress to 40% -+# -+# Other features can be easily added by parsing the string that we pass plymouth with "--update" -+# -+fun update_status_callback (status) { -+# Debug(status); -+ if (!status) return; -+ -+ string_it = 0; -+ update_strings[string_it] = ""; -+ -+ for (i=0; (String(status).CharAt(i) != ""); i++) { -+ local.temp_char = String(status).CharAt(i); -+ if (temp_char != ":") -+ update_strings[string_it] += temp_char; -+ else -+ update_strings[++string_it] = ""; -+ } -+ -+# my_string = update_strings[0] + " " + update_strings[1] + " " + update_strings[2]; -+# Debug(my_string); -+ # Let's assume that we're dealing with these strings fsck:sda1:40 -+ if ((string_it >= 2) && (update_strings[0] == "fsck")) { -+ -+ device = update_strings[1]; -+ progress = update_strings[2]; -+ status_string[0] = update_strings[3]; # "Checking disk %1$d of %2$d (%3$d %% complete)" -+ if (!status_string[0]) -+ status_string[0] = "Checking disk %1$d of %2$d (%3$d %% complete)"; -+ -+ if ((device != "") && (progress != "")) { -+ progress = StringToInteger (progress); -+ -+ # Make sure that the fsck_queue is initialised -+ if (!global.fsck_queue) -+ init_queue (); -+ -+ # Make sure that the fsck counter is initialised -+ if (!global.counter) -+ init_fsck_count (); -+ -+# if (!global.progress_bar.extra_label.sprite) -+# create_extra_fsck_label (); -+ -+ # Keep track of the fsck check -+ fsck_check (device, progress, status_string); -+ } -+ -+ } -+ -+ # systemd-fsckd pass fsckd::: -+ if (update_strings[0] == "fsckd") { -+ number_devices = StringToInteger(update_strings[1]); -+ -+ if (number_devices > 0) { -+ label = update_strings[3]; -+ -+ progress_label = get_fsck_label (label, 0); -+ progress_label.sprite = Sprite (progress_label.image); -+ progress_label.sprite.SetPosition(progress_label.x, progress_label.y, 1); -+ progress_label.sprite.SetOpacity (1); -+ } else { -+ if (progress_label.sprite) -+ progress_label.sprite.SetOpacity (0); -+ } -+ } -+ -+} -+Plymouth.SetUpdateStatusFunction (update_status_callback); -+ -+#-----------------------------------------Display Question stuff ----------------------- -+ -+fun question_dialogue_setup (message_label, text_image) { -+ #Debug("Question dialog setup"); -+ -+ local.field; -+ local.content; -+ local.margin; -+ -+ field.image = Image (question_field_filename); -+ content = Sprite (); -+ bullet_image = Image (progress_dot_off_filename); -+ margin = bullet_image.GetWidth() / 2; -+ -+ # Hide the normal labels -+ prompt_active = 1; -+ if (message_notification[1].sprite) hide_message (1); -+ -+ # Set the prompt label -+ label = get_message_label(message_label, 0, 1); -+ label.z = 10000; -+ -+ setup_message (message_label, label.x, label.y, label.z, 2); -+ show_message (2); -+ -+ # Set up the text field which contains the contents -+ field.sprite = Sprite (); -+ field.sprite.SetImage (field.image); -+ -+ # Centre the box horizontally -+ field.x = Window.GetX () + Window.GetWidth () / 2 - field.image.GetWidth () / 2; -+ content_x = field.x + margin; -+ -+ # Put the field below the second label. -+ field.y = message_notification[2].y + label.height; -+ content_y = field.y + field.image.GetHeight () / 2 - text_image.GetHeight () / 2; -+ -+ #Debug ("field x = " + field.x + ", y = " + field.y); -+ field.z = 10000; -+ field.sprite.SetX (field.x); -+ field.sprite.SetY (field.y); -+ field.sprite.SetZ (field.z); -+ -+ #Debug ("content_x = " + content_x + " content_y = " + content_y); -+ content_z = field.z + 1; -+ content.SetPosition (content_x, content_y, content_z); -+ -+ global.question_dialogue = local; -+} -+ -+# The callback function is called when the display should display a question dialogue. -+# First arg is prompt string, the second is the field contents. -+fun display_question_callback (prompt, contents) { -+ global.status = "question"; -+ #Debug ("Reply: " + contents); -+ -+ textImage = ImageToText(contents); -+ if (!global.question_dialogue) { -+ question_dialogue_setup(prompt, textImage); -+ } -+ -+ margin = global.question_dialogue.margin; -+ fieldWidth = global.question_dialogue.field.image.GetWidth (); -+ for (i = 0; ( (textImage.GetWidth () + 2 * margin ) > fieldWidth ); i++) { -+ textImage = ImageToText(StringCopy (contents, i, StringLength (contents))); -+ } -+ -+ global.question_dialogue.content.SetImage (textImage); -+} -+ -+ -+Plymouth.SetDisplayQuestionFunction (display_question_callback); -+ -+#-----------------------------------------Refresh stuff -------------------------------- -+# -+# Calling Plymouth.SetRefreshFunction with a function will set that function to be -+# called up to 50 times every second, e.g. -+# -+# NOTE: if a refresh function is not set, Plymouth doesn't seem to be able to update -+# the screen correctly -+# -+fun refresh_callback () -+{ -+ draw_logo (); -+} -+Plymouth.SetRefreshFunction (refresh_callback); -+ -+ -+#-----------------------------------------Display Normal stuff ----------------------- -+# -+# The callback function is called when the display should return to normal -+fun display_normal_callback () -+{ -+ global.status = "normal"; -+ if (global.password_dialogue) { -+ password_dialogue_opacity (0); -+ global.password_dialogue = NULL; -+ if (message_notification[2].sprite) hide_message(2); -+ prompt_active = 0; -+ } -+ if (global.question_dialogue) { -+ question_dialogue_opacity (0); -+ global.question_dialogue = NULL; -+ if (message_notification[2].sprite) hide_message(2); -+ prompt_active = 0; -+ } -+ -+ if (message_notification[1].sprite) show_message (1); -+ -+} -+ -+Plymouth.SetDisplayNormalFunction (display_normal_callback); -+ -+ -+#----------------------------------------- Quit -------------------------------- -+ -+# TODO: Maybe we should also hide any other dialog -+# Show the logo and make the progress indicator look full when on exit -+fun quit_callback () -+{ -+ logo.sprite.SetOpacity (1); -+ switch_on_bullets (); -+} -+ -+Plymouth.SetQuitFunction(quit_callback); -Index: plymouth-0.9.4git20200323/themes/ubuntu-logo/ubuntu-logo.grub -=================================================================== ---- /dev/null -+++ plymouth-0.9.4git20200323/themes/ubuntu-logo/ubuntu-logo.grub -@@ -0,0 +1,5 @@ -+# previously #2c001e 44,0,30,0 -+# now yaru #4f194c 79,25,76 -+#if background_color 79,25,76,0; then -+# clear -+#fi -Index: plymouth-0.9.4git20200323/configure.ac -=================================================================== ---- plymouth-0.9.4git20200323.orig/configure.ac -+++ plymouth-0.9.4git20200323/configure.ac -@@ -330,6 +330,7 @@ AC_CONFIG_FILES([Makefile po/Makefile.in - themes/glow/Makefile - themes/spinner/Makefile - themes/script/Makefile -+ themes/ubuntu-logo/Makefile - themes/bgrt/Makefile - images/Makefile - scripts/plymouth-generate-initrd -Index: plymouth-0.9.4git20200323/themes/Makefile.am -=================================================================== ---- plymouth-0.9.4git20200323.orig/themes/Makefile.am -+++ plymouth-0.9.4git20200323/themes/Makefile.am -@@ -1,2 +1,2 @@ --SUBDIRS = spinfinity fade-in text details solar glow script spinner tribar bgrt -+SUBDIRS = spinfinity fade-in text details solar glow script spinner tribar ubuntu-logo bgrt - MAINTAINERCLEANFILES = Makefile.in diff --git a/debian/patches/ubuntu-spinner-fsck.patch b/debian/patches/ubuntu-spinner-fsck.patch deleted file mode 100644 index 41e54cb..0000000 --- a/debian/patches/ubuntu-spinner-fsck.patch +++ /dev/null @@ -1,289 +0,0 @@ -From 60bb5d20a12c6bc92e0bf5aa0aea8f4ca3ddebd5 Mon Sep 17 00:00:00 2001 -From: Daniel van Vugt -Date: Fri, 27 Mar 2020 18:47:39 +0800 -Subject: [PATCH] two-step: Add support for fsck status messages - -Related to https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/62 but -not a full solution. Only supports two-step right now. - -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1867130 ---- - src/plugins/splash/two-step/plugin.c | 160 ++++++++++++++++++++++++--- - 1 file changed, 146 insertions(+), 14 deletions(-) - -Index: plymouth-0.9.4git20200323/src/plugins/splash/two-step/plugin.c -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/plugins/splash/two-step/plugin.c -+++ plymouth-0.9.4git20200323/src/plugins/splash/two-step/plugin.c -@@ -178,6 +178,12 @@ struct _ply_boot_splash_plugin - ply_trigger_t *idle_trigger; - ply_trigger_t *stop_trigger; - -+ char *main_message; -+ char *fsck_message; -+ char *footer; -+ char *fsck_device; -+ int fsck_percent; -+ - uint32_t root_is_mounted : 1; - uint32_t is_visible : 1; - uint32_t is_animating : 1; -@@ -185,6 +191,8 @@ struct _ply_boot_splash_plugin - uint32_t use_firmware_background : 1; - uint32_t dialog_clears_firmware_background : 1; - uint32_t message_below_animation : 1; -+ uint32_t transient_progress_bar : 1; -+ uint32_t in_fsck : 1; - }; - - ply_boot_splash_plugin_interface_t *ply_boot_splash_plugin_get_interface (void); -@@ -196,6 +204,9 @@ static void display_message (ply_boot_sp - static void become_idle (ply_boot_splash_plugin_t *plugin, - ply_trigger_t *idle_trigger); - static void view_show_message (view_t *view, const char *message); -+static void update_message (ply_boot_splash_plugin_t *plugin); -+static void update_progress_animation (ply_boot_splash_plugin_t *plugin, -+ double percent_done); - - static view_t * - view_new (ply_boot_splash_plugin_t *plugin, -@@ -794,6 +805,20 @@ on_view_throbber_stopped (view_t *view) - view->end_trigger = NULL; - } - -+static bool -+use_progress_bar (const ply_boot_splash_plugin_t *plugin) -+{ -+ return plugin->transient_progress_bar || -+ plugin->mode_settings[plugin->mode].use_progress_bar; -+} -+ -+static bool -+use_animation (const ply_boot_splash_plugin_t *plugin) -+{ -+ return !plugin->transient_progress_bar && -+ plugin->mode_settings[plugin->mode].use_animation; -+} -+ - static void - view_start_progress_animation (view_t *view) - { -@@ -815,7 +840,7 @@ view_start_progress_animation (view_t *v - ply_pixel_display_draw_area (view->display, 0, 0, - screen_width, screen_height); - -- if (plugin->mode_settings[plugin->mode].use_progress_bar) { -+ if (use_progress_bar (plugin)) { - if (plugin->progress_bar_width != -1) - width = plugin->progress_bar_width; - else -@@ -829,8 +854,7 @@ view_start_progress_animation (view_t *v - view->animation_bottom = y + height; - } - -- if (plugin->mode_settings[plugin->mode].use_animation && -- view->throbber != NULL) { -+ if (use_animation (plugin) && view->throbber != NULL) { - width = ply_throbber_get_width (view->throbber); - height = ply_throbber_get_height (view->throbber); - x = plugin->animation_horizontal_alignment * screen_width - width / 2.0; -@@ -849,8 +873,7 @@ view_start_progress_animation (view_t *v - plugin->mode == PLY_BOOT_SPLASH_MODE_REBOOT) - return; - -- if (plugin->mode_settings[plugin->mode].use_animation && -- view->progress_animation != NULL) { -+ if (use_animation (plugin) && view->progress_animation != NULL) { - width = ply_progress_animation_get_width (view->progress_animation); - height = ply_progress_animation_get_height (view->progress_animation); - x = plugin->animation_horizontal_alignment * screen_width - width / 2.0; -@@ -1254,6 +1277,10 @@ destroy_plugin (ply_boot_splash_plugin_t - free (plugin->font); - free (plugin->title_font); - free (plugin->animation_dir); -+ free (plugin->main_message); -+ free (plugin->fsck_message); -+ free (plugin->footer); -+ free (plugin->fsck_device); - free_views (plugin); - free (plugin); - } -@@ -1265,7 +1292,7 @@ start_end_animation (ply_boot_splash_plu - ply_list_node_t *node; - view_t *view; - -- if (!plugin->mode_settings[plugin->mode].use_animation) { -+ if (!use_animation (plugin)) { - ply_trigger_pull (trigger, NULL); - return; - } -@@ -1483,23 +1510,20 @@ on_draw (view_t *view, - &view->lock_area, - lock_data); - } else { -- if (plugin->mode_settings[plugin->mode].use_progress_bar) -+ if (use_progress_bar (plugin)) - ply_progress_bar_draw_area (view->progress_bar, pixel_buffer, - x, y, width, height); - -- if (plugin->mode_settings[plugin->mode].use_animation && -- view->throbber != NULL) -+ if (use_animation (plugin) && view->throbber != NULL) - ply_throbber_draw_area (view->throbber, pixel_buffer, - x, y, width, height); - -- if (plugin->mode_settings[plugin->mode].use_animation && -- view->progress_animation != NULL) -+ if (use_animation (plugin) && view->progress_animation != NULL) - ply_progress_animation_draw_area (view->progress_animation, - pixel_buffer, - x, y, width, height); - -- if (plugin->mode_settings[plugin->mode].use_animation && -- view->end_animation != NULL) -+ if (use_animation (plugin) && view->end_animation != NULL) - ply_animation_draw_area (view->end_animation, - pixel_buffer, - x, y, width, height); -@@ -1688,10 +1712,75 @@ show_splash_screen (ply_boot_splash_plug - } - - static void -+update_fsck (ply_boot_splash_plugin_t *plugin, -+ const char *device_name, -+ float percent, -+ const char *message) -+{ -+ if (!plugin->in_fsck) { -+ stop_animation (plugin); -+ plugin->transient_progress_bar = true; -+ start_progress_animation (plugin); -+ plugin->in_fsck = true; -+ } -+ -+ free (plugin->fsck_device); -+ plugin->fsck_device = device_name ? strdup (device_name) : NULL; -+ -+ free (plugin->fsck_message); -+ plugin->fsck_message = message ? strdup (message) : message; -+ -+ plugin->fsck_percent = percent; -+ -+ update_message (plugin); -+ update_progress_animation (plugin, percent / 100.); -+} -+ -+static void -+end_fsck (ply_boot_splash_plugin_t *plugin) -+{ -+ if (!plugin->in_fsck) -+ return; -+ -+ stop_animation (plugin); -+ plugin->in_fsck = false; -+ plugin->transient_progress_bar = false; -+ update_message (plugin); -+ -+ if (use_animation (plugin)) -+ start_progress_animation (plugin); -+} -+ -+static void -+set_footer (ply_boot_splash_plugin_t *plugin, -+ const char *message) -+{ -+ free (plugin->footer); -+ plugin->footer = strdup (message); -+} -+ -+static void - update_status (ply_boot_splash_plugin_t *plugin, - const char *status) - { -+ char fsck_device[1024] = ""; -+ char fsck_message[1024] = ""; -+ float fsck_percent = 0.f; -+ - assert (plugin != NULL); -+ -+ if (sscanf (status, "fsck:%1023[^:]:%f", -+ fsck_device, &fsck_percent) == 2) { -+ ply_trace ("fsck of `%s' at %.1f%%", fsck_device, fsck_percent); -+ update_fsck (plugin, fsck_device, fsck_percent, NULL); -+ } else if (sscanf (status, "fsckd:%*d:%f:%1023[^\x01]", -+ &fsck_percent, fsck_message) == 2) { -+ ply_trace ("fsckd at %.1f%% [%s]", fsck_percent, fsck_message); -+ update_fsck (plugin, NULL, fsck_percent, fsck_message); -+ } -+ -+ if (fsck_percent >= 100) -+ end_fsck (plugin); - } - - static void -@@ -1747,6 +1836,9 @@ on_boot_progress (ply_boot_splash_plugin - if (plugin->is_idle) - return; - -+ if (plugin->transient_progress_bar) -+ return; -+ - /* - * If we do not have an end animation, we keep showing progress until - * become_idle gets called. -@@ -1916,6 +2008,37 @@ show_message (ply_boot_splash_plugin_t * - } - - static void -+update_message (ply_boot_splash_plugin_t *plugin) -+{ -+ char message[4096]; -+ size_t len = 0; -+ -+ if (plugin->in_fsck) { -+ const char *device = plugin->fsck_device; -+ -+ if (!device || !device[0]) -+ device = _("disks"); -+ -+ len += snprintf (message + len, sizeof(message) - 1 - len, -+ _("Checking %s: %d%% complete\n\n"), -+ device, plugin->fsck_percent); -+ } -+ -+ if (plugin->in_fsck && plugin->fsck_message && len < sizeof(message)) -+ len += snprintf (message + len, sizeof(message) - 1 - len, -+ "%s\n\n", plugin->fsck_message); -+ else if (plugin->main_message && len < sizeof(message)) -+ len += snprintf (message + len, sizeof(message) - 1 - len, -+ "%s\n\n", plugin->main_message); -+ -+ if (plugin->footer && len < sizeof(message)) -+ len += snprintf (message + len, sizeof(message) - 1 - len, -+ "%s", plugin->footer); -+ -+ show_message (plugin, message); -+} -+ -+static void - system_update (ply_boot_splash_plugin_t *plugin, - int progress) - { -@@ -1974,7 +2097,16 @@ static void - display_message (ply_boot_splash_plugin_t *plugin, - const char *message) - { -- show_message (plugin, message); -+ if (!strncmp (message, "fsckd-cancel-msg:", 17)) -+ set_footer (plugin, message + 17); -+ else if (!strncmp (message, "keys:", 5)) -+ set_footer (plugin, message + 5); -+ else { -+ free (plugin->main_message); -+ plugin->main_message = strdup (message); -+ } -+ -+ update_message (plugin); - } - - ply_boot_splash_plugin_interface_t * diff --git a/debian/patches/ubuntu-spinner-style.patch b/debian/patches/ubuntu-spinner-style.patch deleted file mode 100644 index 8b1fa22..0000000 --- a/debian/patches/ubuntu-spinner-style.patch +++ /dev/null @@ -1,31 +0,0 @@ -# Description: Ubuntu style for the spinner/bgrt theme -# use the Ubuntu font, display the password entry under the bios logo -# Upstream: not-needed -Index: plymouth-0.9.4git20200323/themes/bgrt/bgrt.plymouth.in -=================================================================== ---- plymouth-0.9.4git20200323.orig/themes/bgrt/bgrt.plymouth.in -+++ plymouth-0.9.4git20200323/themes/bgrt/bgrt.plymouth.in -@@ -4,11 +4,11 @@ Description=Jimmac's spinner theme using - ModuleName=two-step - - [two-step] --Font=Cantarell 12 --TitleFont=Cantarell Light 30 -+Font=Ubuntu 12 -+TitleFont=Ubuntu Light 30 - ImageDir=@PLYMOUTH_THEME_PATH@/spinner - DialogHorizontalAlignment=.5 --DialogVerticalAlignment=.382 -+DialogVerticalAlignment=.7 - TitleHorizontalAlignment=.5 - TitleVerticalAlignment=.382 - HorizontalAlignment=.5 -@@ -21,7 +21,7 @@ BackgroundStartColor=0x000000 - BackgroundEndColor=0x000000 - ProgressBarBackgroundColor=0x606060 - ProgressBarForegroundColor=0xffffff --DialogClearsFirmwareBackground=true -+DialogClearsFirmwareBackground=false - MessageBelowAnimation=true - - [boot-up] diff --git a/debian/patches/ubuntu-text.patch b/debian/patches/ubuntu-text.patch deleted file mode 100644 index c4be888..0000000 --- a/debian/patches/ubuntu-text.patch +++ /dev/null @@ -1,904 +0,0 @@ -Description: Add ubuntu-text splash plugin and theme -Author: Scott James Remnant -Forwarded: not-needed -Last-Update: 2011-01-21 - -Index: plymouth-0.9.4git20200323/configure.ac -=================================================================== ---- plymouth-0.9.4git20200323.orig/configure.ac -+++ plymouth-0.9.4git20200323/configure.ac -@@ -309,6 +309,7 @@ AC_CONFIG_FILES([Makefile po/Makefile.in - src/plugins/splash/Makefile - src/plugins/splash/fade-throbber/Makefile - src/plugins/splash/tribar/Makefile -+ src/plugins/splash/ubuntu-text/Makefile - src/plugins/splash/text/Makefile - src/plugins/splash/details/Makefile - src/plugins/splash/space-flares/Makefile -@@ -332,6 +333,7 @@ AC_CONFIG_FILES([Makefile po/Makefile.in - themes/script/Makefile - themes/ubuntu-logo/Makefile - themes/bgrt/Makefile -+ themes/ubuntu-text/Makefile - images/Makefile - scripts/plymouth-generate-initrd - scripts/plymouth-populate-initrd -Index: plymouth-0.9.4git20200323/themes/Makefile.am -=================================================================== ---- plymouth-0.9.4git20200323.orig/themes/Makefile.am -+++ plymouth-0.9.4git20200323/themes/Makefile.am -@@ -1,2 +1,2 @@ --SUBDIRS = spinfinity fade-in text details solar glow script spinner tribar ubuntu-logo bgrt -+SUBDIRS = spinfinity fade-in text details solar glow script spinner tribar ubuntu-logo bgrt ubuntu-text - MAINTAINERCLEANFILES = Makefile.in -Index: plymouth-0.9.4git20200323/themes/ubuntu-text/ubuntu-text.plymouth.in -=================================================================== ---- /dev/null -+++ plymouth-0.9.4git20200323/themes/ubuntu-text/ubuntu-text.plymouth.in -@@ -0,0 +1,11 @@ -+[Plymouth Theme] -+Name=Ubuntu Text -+Description=Text mode theme based on ubuntu-logo theme -+ModuleName=ubuntu-text -+ -+[ubuntu-text] -+title=Ubuntu 18.04 LTS -+black=0x2c001e -+white=0xffffff -+brown=0xff4012 -+blue=0x988592 -Index: plymouth-0.9.4git20200323/themes/ubuntu-text/Makefile.am -=================================================================== ---- /dev/null -+++ plymouth-0.9.4git20200323/themes/ubuntu-text/Makefile.am -@@ -0,0 +1,4 @@ -+themedir = $(datadir)/plymouth/themes/ubuntu-text -+dist_theme_DATA = ubuntu-text.plymouth.in -+ -+MAINTAINERCLEANFILES = Makefile.in -Index: plymouth-0.9.4git20200323/src/plugins/splash/Makefile.am -=================================================================== ---- plymouth-0.9.4git20200323.orig/src/plugins/splash/Makefile.am -+++ plymouth-0.9.4git20200323/src/plugins/splash/Makefile.am -@@ -1,2 +1,2 @@ --SUBDIRS = fade-throbber text details space-flares two-step script tribar -+SUBDIRS = fade-throbber text details space-flares two-step script tribar ubuntu-text - MAINTAINERCLEANFILES = Makefile.in -Index: plymouth-0.9.4git20200323/src/plugins/splash/ubuntu-text/Makefile.am -=================================================================== ---- /dev/null -+++ plymouth-0.9.4git20200323/src/plugins/splash/ubuntu-text/Makefile.am -@@ -0,0 +1,23 @@ -+INCLUDES = -I$(top_srcdir) \ -+ -I$(srcdir)/../../../libply \ -+ -I$(srcdir)/../../../libply-splash-core \ -+ -I$(srcdir)/../../.. \ -+ -I$(srcdir)/../.. \ -+ -I$(srcdir)/.. \ -+ -I$(srcdir) -+ -+plugindir = $(libdir)/plymouth -+plugin_LTLIBRARIES = ubuntu-text.la -+ -+ubuntu_text_la_CFLAGS = $(PLYMOUTH_CFLAGS) \ -+ -DPLYMOUTH_BACKGROUND_COLOR=$(background_color) \ -+ -DPLYMOUTH_BACKGROUND_END_COLOR=$(background_end_color) \ -+ -DPLYMOUTH_BACKGROUND_START_COLOR=$(background_start_color) -+ -+ubuntu_text_la_LDFLAGS = -module -avoid-version -export-dynamic -+ubuntu_text_la_LIBADD = $(PLYMOUTH_LIBS) \ -+ ../../../libply/libply.la \ -+ ../../../libply-splash-core/libply-splash-core.la -+ubuntu_text_la_SOURCES = $(srcdir)/plugin.c -+ -+MAINTAINERCLEANFILES = Makefile.in -Index: plymouth-0.9.4git20200323/src/plugins/splash/ubuntu-text/plugin.c -=================================================================== ---- /dev/null -+++ plymouth-0.9.4git20200323/src/plugins/splash/ubuntu-text/plugin.c -@@ -0,0 +1,805 @@ -+/* ubuntu-text.c - boot splash plugin -+ * -+ * Copyright (C) 2010 Canonical Ltd. -+ * Copyright (C) 2008 Red Hat, Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -+ * 02111-1307, USA. -+ * -+ * Written by: Scott James Remnant -+ * Adam Jackson -+ * Ray Strode -+ */ -+#include "config.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "ply-trigger.h" -+#include "ply-boot-splash-plugin.h" -+#include "ply-buffer.h" -+#include "ply-event-loop.h" -+#include "ply-key-file.h" -+#include "ply-list.h" -+#include "ply-logger.h" -+#include "ply-text-display.h" -+#include "ply-text-progress-bar.h" -+#include "ply-utils.h" -+ -+#include -+ -+#define CLEAR_LINE_SEQUENCE "\033[2K\r\n" -+#define BACKSPACE "\b\033[0K" -+ -+typedef enum { -+ PLY_BOOT_SPLASH_DISPLAY_NORMAL, -+ PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY, -+ PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY -+} ply_boot_splash_display_type_t; -+ -+struct _ply_boot_splash_plugin -+{ -+ ply_event_loop_t *loop; -+ ply_boot_splash_mode_t mode; -+ -+ ply_list_t *views; -+ -+ ply_boot_splash_display_type_t state; -+ -+ char *message; -+ -+ uint32_t is_animating : 1; -+ uint32_t black; -+ uint32_t white; -+ uint32_t brown; -+ uint32_t blue; -+ char *title; -+}; -+ -+typedef struct -+{ -+ ply_boot_splash_plugin_t *plugin; -+ ply_text_display_t *display; -+ -+} view_t; -+ -+static void hide_splash_screen (ply_boot_splash_plugin_t *plugin, -+ ply_event_loop_t *loop); -+ -+static view_t * -+view_new (ply_boot_splash_plugin_t *plugin, -+ ply_text_display_t *display) -+{ -+ view_t *view; -+ -+ view = calloc (1, sizeof (view_t)); -+ view->plugin = plugin; -+ view->display = display; -+ -+ return view; -+} -+ -+static void -+view_free (view_t *view) -+{ -+ free (view); -+} -+ -+static void -+view_show_message (view_t *view) -+{ -+ ply_boot_splash_plugin_t *plugin; -+ int display_width, display_height, y; -+ ply_terminal_color_t color; -+ char *message; -+ -+ plugin = view->plugin; -+ -+ display_width = ply_text_display_get_number_of_columns (view->display); -+ display_height = ply_text_display_get_number_of_rows (view->display); -+ -+ if (!strncmp (plugin->message, "keys:", 5)) -+ { -+ message = plugin->message + 5; -+ color = PLY_TERMINAL_COLOR_WHITE; -+ y = display_height - 4; -+ } -+ else -+ { -+ message = plugin->message; -+ color = PLY_TERMINAL_COLOR_BLUE; -+ y = display_height / 2 + 7; -+ } -+ -+ ply_text_display_set_cursor_position (view->display, 0, y); -+ ply_text_display_clear_line (view->display); -+ ply_text_display_set_cursor_position (view->display, -+ (display_width - -+ strlen (message)) / 2, -+ y); -+ -+ ply_text_display_set_foreground_color (view->display, color); -+ ply_text_display_write (view->display, "%s", message); -+} -+ -+static void -+view_show_prompt (view_t *view, -+ const char *prompt, -+ const char *entered_text) -+{ -+ int display_width, display_height; -+ -+ display_width = ply_text_display_get_number_of_columns (view->display); -+ display_height = ply_text_display_get_number_of_rows (view->display); -+ -+ ply_text_display_set_cursor_position (view->display, 0, -+ display_height / 2 + 8); -+ ply_text_display_clear_line (view->display); -+ ply_text_display_set_cursor_position (view->display, -+ display_width / 2 - (strlen (prompt)), -+ display_height / 2 + 8); -+ -+ ply_text_display_write (view->display, "%s:%s", prompt, entered_text); -+ -+ ply_text_display_show_cursor (view->display); -+} -+ -+static void -+view_start_animation (view_t *view) -+{ -+ ply_boot_splash_plugin_t *plugin; -+ ply_terminal_t *terminal; -+ -+ assert (view != NULL); -+ -+ plugin = view->plugin; -+ -+ terminal = ply_text_display_get_terminal (view->display); -+ -+ ply_terminal_set_color_hex_value (terminal, -+ PLY_TERMINAL_COLOR_BLACK, -+ plugin->black); -+ ply_terminal_set_color_hex_value (terminal, -+ PLY_TERMINAL_COLOR_WHITE, -+ plugin->white); -+ ply_terminal_set_color_hex_value (terminal, -+ PLY_TERMINAL_COLOR_BROWN, -+ plugin->brown); -+ ply_terminal_set_color_hex_value (terminal, -+ PLY_TERMINAL_COLOR_BLUE, -+ plugin->blue); -+ -+ ply_text_display_set_background_color (view->display, -+ PLY_TERMINAL_COLOR_BLACK); -+ ply_text_display_clear_screen (view->display); -+ ply_text_display_hide_cursor (view->display); -+} -+ -+static void -+view_redraw (view_t *view) -+{ -+ unsigned long screen_width, screen_height; -+ -+ screen_width = ply_text_display_get_number_of_columns (view->display); -+ screen_height = ply_text_display_get_number_of_rows (view->display); -+ -+ ply_text_display_draw_area (view->display, 0, 0, -+ screen_width, screen_height); -+} -+ -+static void -+redraw_views (ply_boot_splash_plugin_t *plugin) -+{ -+ ply_list_node_t *node; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ view_redraw (view); -+ -+ node = next_node; -+ } -+} -+ -+static void -+view_hide (view_t *view) -+{ -+ if (view->display != NULL) -+ { -+ ply_terminal_t *terminal; -+ -+ terminal = ply_text_display_get_terminal (view->display); -+ -+ ply_text_display_set_background_color (view->display, PLY_TERMINAL_COLOR_DEFAULT); -+ ply_text_display_clear_screen (view->display); -+ ply_text_display_show_cursor (view->display); -+ -+ ply_terminal_reset_colors (terminal); -+ } -+} -+ -+static void -+hide_views (ply_boot_splash_plugin_t *plugin) -+{ -+ ply_list_node_t *node; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ view_hide (view); -+ -+ node = next_node; -+ } -+} -+ -+static void -+pause_views (ply_boot_splash_plugin_t *plugin) -+{ -+ ply_list_node_t *node; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ ply_text_display_pause_updates (view->display); -+ -+ node = next_node; -+ } -+} -+ -+static void -+unpause_views (ply_boot_splash_plugin_t *plugin) -+{ -+ ply_list_node_t *node; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ ply_text_display_unpause_updates (view->display); -+ -+ node = next_node; -+ } -+} -+ -+static ply_boot_splash_plugin_t * -+create_plugin (ply_key_file_t *key_file) -+{ -+ char *option; -+ -+ ply_boot_splash_plugin_t *plugin; -+ -+ ply_trace ("creating plugin"); -+ -+ plugin = calloc (1, sizeof (ply_boot_splash_plugin_t)); -+ plugin->message = NULL; -+ -+ plugin->views = ply_list_new (); -+ -+ /* Not a pretty API for setting defaults for your config file... */ -+ plugin->black = 0x2c001e; -+ plugin->white = 0xffffff; -+ plugin->brown = 0xff4012; -+ plugin->blue = 0x988592; -+ -+ option = ply_key_file_get_value (key_file, "ubuntu-text", "black"); -+ if (option) -+ sscanf(option, "0x%x", &plugin->black); -+ option = ply_key_file_get_value (key_file, "ubuntu-text", "white"); -+ if (option) -+ sscanf(option, "0x%x", &plugin->white); -+ option = ply_key_file_get_value (key_file, "ubuntu-text", "brown"); -+ if (option) -+ sscanf(option, "0x%x", &plugin->brown); -+ option = ply_key_file_get_value (key_file, "ubuntu-text", "blue"); -+ if (option) -+ sscanf(option, "0x%x", &plugin->blue); -+ -+ plugin->title = ply_key_file_get_value (key_file, "ubuntu-text", "title"); -+ -+ return plugin; -+} -+ -+static void -+detach_from_event_loop (ply_boot_splash_plugin_t *plugin) -+{ -+ plugin->loop = NULL; -+ -+ ply_trace ("detaching from event loop"); -+} -+ -+static void -+free_views (ply_boot_splash_plugin_t *plugin) -+{ -+ ply_list_node_t *node; -+ -+ node = ply_list_get_first_node (plugin->views); -+ -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ view_free (view); -+ ply_list_remove_node (plugin->views, node); -+ -+ node = next_node; -+ } -+ -+ ply_list_free (plugin->views); -+ plugin->views = NULL; -+} -+ -+static void -+destroy_plugin (ply_boot_splash_plugin_t *plugin) -+{ -+ ply_trace ("destroying plugin"); -+ -+ if (plugin == NULL) -+ return; -+ -+ /* It doesn't ever make sense to keep this plugin on screen -+ * after exit -+ */ -+ hide_splash_screen (plugin, plugin->loop); -+ -+ free_views (plugin); -+ if (plugin->message != NULL) -+ free (plugin->message); -+ -+ free (plugin); -+} -+ -+static void -+show_message (ply_boot_splash_plugin_t *plugin) -+{ -+ ply_list_node_t *node; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ view_show_message (view); -+ -+ node = next_node; -+ } -+} -+ -+static void -+animate_frame (ply_boot_splash_plugin_t *plugin, -+ int frame) -+{ -+ ply_list_node_t *node; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ int display_width, display_height; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ display_width = ply_text_display_get_number_of_columns (view->display); -+ display_height = ply_text_display_get_number_of_rows (view->display); -+ -+ ply_text_display_set_cursor_position (view->display, -+ (display_width - 12) / 2, -+ display_height / 2); -+ -+ ply_text_display_set_background_color (view->display, PLY_TERMINAL_COLOR_BLACK); -+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); -+ ply_text_display_write (view->display, "%s", plugin->title); -+ -+ ply_text_display_set_cursor_position (view->display, -+ (display_width - 10) / 2, -+ (display_height / 2) + 2); -+ -+ if ((frame < 1) || (frame > 4)) -+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); -+ else -+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN); -+ ply_text_display_write (view->display, "%s", ". "); -+ -+ if ((frame < 2) || (frame > 5)) -+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); -+ else -+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN); -+ ply_text_display_write (view->display, "%s", ". "); -+ -+ if ((frame < 3) || (frame > 6)) -+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); -+ else -+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN); -+ ply_text_display_write (view->display, "%s", ". "); -+ -+ if (frame < 4) -+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE); -+ else -+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN); -+ ply_text_display_write (view->display, "%s", "."); -+ -+ node = next_node; -+ } -+} -+ -+static void -+on_timeout (ply_boot_splash_plugin_t *plugin) -+{ -+ static int frame = 0; -+ -+ frame += 1; -+ frame %= 8; -+ -+ animate_frame (plugin, frame); -+ -+ ply_event_loop_watch_for_timeout (plugin->loop, 1.0, -+ (ply_event_loop_timeout_handler_t) -+ on_timeout, plugin); -+} -+ -+static void -+start_animation (ply_boot_splash_plugin_t *plugin) -+{ -+ ply_list_node_t *node; -+ -+ assert (plugin != NULL); -+ assert (plugin->loop != NULL); -+ -+ redraw_views (plugin); -+ -+ if (plugin->message != NULL) -+ show_message (plugin); -+ -+ if (plugin->is_animating) -+ return; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ view_start_animation (view); -+ -+ node = next_node; -+ } -+ -+ plugin->is_animating = true; -+ -+ animate_frame (plugin, 0); -+ ply_event_loop_watch_for_timeout (plugin->loop, 1.0, -+ (ply_event_loop_timeout_handler_t) -+ on_timeout, plugin); -+} -+ -+static void -+stop_animation (ply_boot_splash_plugin_t *plugin) -+{ -+ assert (plugin != NULL); -+ assert (plugin->loop != NULL); -+ -+ if (!plugin->is_animating) -+ return; -+ -+ plugin->is_animating = false; -+ -+ ply_event_loop_stop_watching_for_timeout (plugin->loop, -+ (ply_event_loop_timeout_handler_t) -+ on_timeout, plugin); -+ -+ redraw_views (plugin); -+} -+ -+static void -+on_draw (view_t *view, -+ ply_terminal_t *terminal, -+ int x, -+ int y, -+ int width, -+ int height) -+{ -+} -+ -+static void -+add_text_display (ply_boot_splash_plugin_t *plugin, -+ ply_text_display_t *display) -+{ -+ view_t *view; -+ ply_terminal_t *terminal; -+ -+ view = view_new (plugin, display); -+ -+ terminal = ply_text_display_get_terminal (view->display); -+ if (ply_terminal_open (terminal)) -+ { -+ ply_terminal_set_mode (terminal, PLY_TERMINAL_MODE_TEXT); -+ ply_terminal_activate_vt (terminal); -+ } -+ -+ ply_text_display_set_draw_handler (view->display, -+ (ply_text_display_draw_handler_t) -+ on_draw, view); -+ -+ ply_list_append_data (plugin->views, view); -+} -+ -+static void -+remove_text_display (ply_boot_splash_plugin_t *plugin, -+ ply_text_display_t *display) -+{ -+ ply_list_node_t *node; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ view_t *view; -+ ply_list_node_t *next_node; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ if (view->display == display) -+ { -+ ply_text_display_set_draw_handler (view->display, -+ NULL, NULL); -+ view_free (view); -+ ply_list_remove_node (plugin->views, node); -+ return; -+ } -+ -+ node = next_node; -+ } -+} -+ -+static bool -+show_splash_screen (ply_boot_splash_plugin_t *plugin, -+ ply_event_loop_t *loop, -+ ply_buffer_t *boot_buffer, -+ ply_boot_splash_mode_t mode) -+{ -+ assert (plugin != NULL); -+ -+ plugin->loop = loop; -+ plugin->mode = mode; -+ ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t) -+ detach_from_event_loop, -+ plugin); -+ -+ ply_show_new_kernel_messages (false); -+ start_animation (plugin); -+ -+ return true; -+} -+ -+static void -+update_status (ply_boot_splash_plugin_t *plugin, -+ const char *status) -+{ -+ assert (plugin != NULL); -+ -+ ply_trace ("status update"); -+} -+ -+static void -+hide_splash_screen (ply_boot_splash_plugin_t *plugin, -+ ply_event_loop_t *loop) -+{ -+ assert (plugin != NULL); -+ -+ ply_trace ("hiding splash screen"); -+ -+ if (plugin->loop != NULL) -+ { -+ stop_animation (plugin); -+ -+ ply_event_loop_stop_watching_for_exit (plugin->loop, -+ (ply_event_loop_exit_handler_t) -+ detach_from_event_loop, -+ plugin); -+ detach_from_event_loop (plugin); -+ } -+ -+ hide_views (plugin); -+ ply_show_new_kernel_messages (true); -+} -+ -+static void -+display_normal (ply_boot_splash_plugin_t *plugin) -+{ -+ pause_views (plugin); -+ if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL) -+ { -+ plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL; -+ start_animation (plugin); -+ redraw_views (plugin); -+ } -+ unpause_views (plugin); -+} -+ -+static void -+display_message (ply_boot_splash_plugin_t *plugin, -+ const char *message) -+{ -+ if (plugin->message != NULL) -+ free (plugin->message); -+ -+ plugin->message = strdup (message); -+ start_animation (plugin); -+} -+ -+static void -+show_password_prompt (ply_boot_splash_plugin_t *plugin, -+ const char *prompt, -+ int bullets) -+{ -+ ply_list_node_t *node; -+ int i; -+ char *entered_text; -+ -+ entered_text = calloc (bullets + 1, sizeof (char)); -+ -+ for (i = 0; i < bullets; i++) -+ entered_text[i] = '*'; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ view_show_prompt (view, prompt, entered_text); -+ -+ node = next_node; -+ } -+ free (entered_text); -+} -+ -+static void -+show_prompt (ply_boot_splash_plugin_t *plugin, -+ const char *prompt, -+ const char *text) -+{ -+ ply_list_node_t *node; -+ -+ node = ply_list_get_first_node (plugin->views); -+ while (node != NULL) -+ { -+ ply_list_node_t *next_node; -+ view_t *view; -+ -+ view = ply_list_node_get_data (node); -+ next_node = ply_list_get_next_node (plugin->views, node); -+ -+ view_show_prompt (view, prompt, text); -+ -+ node = next_node; -+ } -+} -+ -+static void -+display_password (ply_boot_splash_plugin_t *plugin, -+ const char *prompt, -+ int bullets) -+{ -+ pause_views (plugin); -+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL) -+ stop_animation (plugin); -+ -+ plugin->state = PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY; -+ -+ if (!prompt) -+ prompt = "Password"; -+ -+ show_password_prompt (plugin, prompt, bullets); -+ -+ unpause_views (plugin); -+} -+ -+static void -+display_question (ply_boot_splash_plugin_t *plugin, -+ const char *prompt, -+ const char *entry_text) -+{ -+ pause_views (plugin); -+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL) -+ stop_animation (plugin); -+ -+ plugin->state = PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY; -+ -+ if (!prompt) -+ prompt = "Password"; -+ -+ show_prompt (plugin, prompt, entry_text); -+ -+ unpause_views (plugin); -+} -+ -+ -+ply_boot_splash_plugin_interface_t * -+ply_boot_splash_plugin_get_interface (void) -+{ -+ static ply_boot_splash_plugin_interface_t plugin_interface = -+ { -+ .create_plugin = create_plugin, -+ .destroy_plugin = destroy_plugin, -+ .add_text_display = add_text_display, -+ .remove_text_display = remove_text_display, -+ .show_splash_screen = show_splash_screen, -+ .update_status = update_status, -+ .hide_splash_screen = hide_splash_screen, -+ .display_normal = display_normal, -+ .display_message = display_message, -+ .display_password = display_password, -+ .display_question = display_question, -+ }; -+ -+ return &plugin_interface; -+} -+ -+/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/debian/source/format b/debian/source/format index 163aaf8..89ae9db 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native)