]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
details: Don't replay boot buffer on serial consoles
authorRay Strode <rstrode@redhat.com>
Tue, 30 Aug 2022 18:41:36 +0000 (14:41 -0400)
committerRay Strode <halfline@gmail.com>
Sat, 15 Oct 2022 19:39:12 +0000 (19:39 +0000)
commit 0e59dde8 changed the details plugin to clear the terminal when
first opening it. This was done to prevent duplicate messages from
showing up when toggling back and forth between details and graphical
splashes.

That has the negative side effect of purging serial console output too
though. Furthermore, it makes little sense to replay the boot buffer
on serial consoles, since serial consoles don't aggressively purge
scrollback like VTs do.

This commit adds a check to make sure the terminal is a VT before trying
to clear and replay the scrollback buffer.

Closes: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/187
src/plugins/splash/details/plugin.c

index 094ee58cfb3135c10e69fb270869f6cd16d75b67..8321456c62023a331758231b038f3331cd46ae2a 100644 (file)
@@ -202,6 +202,29 @@ view_write (view_t     *view,
         ply_terminal_write (terminal, "%.*s", (int) number_of_bytes, text);
 }
 
+static void
+view_write_boot_buffer (view_t *view)
+{
+        ply_boot_splash_plugin_t *plugin;
+        ply_terminal_t *terminal;
+
+        plugin = view->plugin;
+
+        terminal = ply_text_display_get_terminal (view->display);
+
+        ply_text_display_clear_screen (view->display);
+        ply_terminal_activate_vt (terminal);
+
+        if (plugin->boot_buffer != NULL) {
+                size_t size;
+                const char *bytes;
+
+                size = ply_buffer_get_size (plugin->boot_buffer);
+                bytes = ply_buffer_get_bytes (plugin->boot_buffer);
+                view_write (view, bytes, size);
+        }
+}
+
 static void
 write_on_views (ply_boot_splash_plugin_t *plugin,
                 const char               *text,
@@ -237,20 +260,12 @@ add_text_display (ply_boot_splash_plugin_t *plugin,
         view = view_new (plugin, display);
 
         terminal = ply_text_display_get_terminal (view->display);
-        if (ply_terminal_open (terminal)) {
-                ply_text_display_clear_screen (view->display);
-                ply_terminal_activate_vt (terminal);
-        }
+        ply_terminal_open (terminal);
 
         ply_list_append_data (plugin->views, view);
 
-        if (plugin->boot_buffer != NULL) {
-                size_t size;
-                const char *bytes;
-
-                size = ply_buffer_get_size (plugin->boot_buffer);
-                bytes = ply_buffer_get_bytes (plugin->boot_buffer);
-                view_write (view, bytes, size);
+        if (ply_terminal_is_vt (terminal)) {
+                view_write_boot_buffer (view);
         }
 }