Ubuntu

Merge lp:~pali/ubuntu/natty/plymouth/plymouth into lp:ubuntu/oneiric/plymouth

Proposed by Pali on 2011-05-22
Status: Rejected
Rejected by: Martin Pitt on 2012-02-29
Proposed branch: lp:~pali/ubuntu/natty/plymouth/plymouth
Merge into: lp:ubuntu/oneiric/plymouth
Diff against target: 565 lines (+274/-62) 6 files modified
To merge this branch: bzr merge lp:~pali/ubuntu/natty/plymouth/plymouth
Reviewer Review Type Date Requested Status
Ubuntu branches 2011-05-22 Pending
Review via email: mp+61897@code.launchpad.net

Description of the Change

Added support for scrolling boot log messages in theme ubuntu-logo and in plugins: text and ubuntu-text.
Log message must start with prefix 'log:', status reason message must be 'log:ok' or 'log:failed'
Scrolling boot log messages looks like in old usplash

Examples:
 $ plymouth message --text='log:Starting daemon xyz' # Show message 'Starting daemon xyz...'
 $ plymouth message --text='log:ok' # Append status reason message 'ok'
 $ plymouth message --text='log:Starting daemon abc' # Show next message 'Starting daemon abc...'
 $ plymouth message --text='log:failed' # Append status reason message 'failed'

To post a comment you must log in.
Martin Pitt (pitti) wrote :

Pali,

thanks for your work on this!

I think the chance of getting this accepted would be higher if you would send this as a patch to upstream instead:

  https://bugs.freedesktop.org/enter_bug.cgi?product=plymouth

That way, the experts of that software can review your patch and integrate it upstream, instead of distros carrying big patches for new features.

Thanks!

Pali (pali) wrote :

Ok,

I try to add support for 'log:' to all plymouth themes/splashes and correct handling in plymouth-upstart bridge.
Then I send all patches to upstream.

I'd like to have full functional verbose boot log in plymouth with upstart (not in ubuntu and text theme).

Can you tell me if which of these plugins is ubuntu specified and which is in upstream?
* text
* ubuntu-text
* ubuntu-logo
* details

Colin Watson (cjwatson) wrote :

Well, that's true for the text splash; and I agree that it would be good to have that interface be standard. However, once the patch to the text splash has been reviewed, we'll still need Ubuntu-specific changes to the ubuntu-text and ubuntu-logo splash.

Colin Watson (cjwatson) wrote :

It'll be clear when you look at upstream's git repository; but text and
details are upstream, while ubuntu-text and ubuntu-logo are
Ubuntu-specific.

Pali (pali) wrote :

Thanks for info!

Pali (pali) wrote :

Now I finished my patches. Boot log messages working fine with details, text, ubuntu-text and ubuntu-logo theme.
Writing log messages from upstart-bridge is done by plymouth 'log:' prefix too (removed old code with write messages directly to console).

So is patches ready for merge.

What missing is kubuntu-logo theme which is in different package (kubuntu-default-settings). But this theme is same as ubuntu-logo (diff say me differences only in background image).

Problem is with pushing patches to upstream. Ubuntu plymouth in bzr and upstream plymouth in git are very divergented. It is not simple to apply my patches on top of git plymouth repostory.

Pali (pali) wrote :
Scott Moser (smoser) wrote :

Pali,
  I believe that Martin (comment 2011-05-30) was suggesting that you try to get your changes into upstream plymouth (probably by mailing to the mailing list http://lists.freedesktop.org/mailman/listinfo/plymouth ).
  It looks like you've done a fair amount of valuable work, but Ubuntu would rather not carry that delta without an idea as to whether or not upstream is accepting of it.

Pali (pali) wrote :

Relevant patch for upstream (text, details and upstart plugins) was sent to mailingslist. Other changes are ubuntu specified (ubuntu-text, ubuntu-logo).

Sebastien Bacher (seb128) wrote :

could you give a pointer to the list discussion? http://lists.freedesktop.org/archives/plymouth/2011-June has no mention of it

Sebastien Bacher (seb128) wrote :

setting the merge request to "work in progress", you should set it back to "needs review" once you sent the patches that need to go upstream to fdo

Pali (pali) wrote :

I sent mail, but I'm not member of mailinglist, so I got:

Your mail to 'plymouth' with the subject

    [PATCH] Add support for scrolling boot log messages

Is being held until the list moderator can review it for approval.

The reason it is being held:

    Post by non-member to a members-only list

Pali (pali) wrote :
Pali (pali) wrote :
Pali (pali) wrote :

Patch which redirect System V init script boot log messages to plymouth is here:
https://code.launchpad.net/~pali/ubuntu/oneiric/lsb/lsb/+merge/68212

Clint Byrum (clint-fewbar) wrote :

Pali, thanks so much for pushing this upstream. It looks like there are a lot of patches from that list without a response. Maybe send Ray a private request for a review? I think this is pretty cool and would be a useful feature, but agree that we probably would prefer that it be accepted upstream.

Chris Halse Rogers (raof) wrote :

I note that Ray has (finally :)) commented on your patches and raised some design questions. Have you seen his reply, and are you planning to modify your patch in response? It'd be great to get all these boot-splash improvements in!

Martin Pitt (pitti) wrote :

This is (and should be) handled upstream now, thus I close this merge proposal. Thanks!

Pali (pali) wrote :

This merge request also change file themes/ubuntu-logo/ubuntu-logo.script which is not in upstream and ubuntu specific.

Pali (pali) wrote :

This cannot be upstreamed, because ubuntu using ubuntu specified settings like theme, logo...

Evan Broder (broder) wrote :

Pali, I'm a little confused why you've reopened this merge proposal. It seems to be the same patchset that you originally proposed, and that Ray reviewed on the plymouth mailing list. We do not generally accept invasive patches like this when they haven't been accepted by upstream.

Please work on modifying the patches so that upstream will accept the non-Ubuntu-specific portions, and then we can consider the Ubuntu-specific stuff.

Unmerged revisions

1406. By Pali on 2011-10-30

ubuntu-logo: fix position and count of boot log messages

1405. By Pali on 2011-10-30

Make sure that plymouth-upstart-bridge will be started after plymouth in runlevel 0 and 6

1404. By Pali on 2011-06-17

plymouth-upstart-bridge has now no console output

1403. By Pali on 2011-06-03

ubuntu-text plugin: Increase count of buffered message lines to 40

1402. By Pali on 2011-06-03

text plugin: Increase count of buffered message lines to 40, fixed centering log messages

1401. By Pali on 2011-06-03

Clean code plymouth-upstart-bridge

1400. By Pali on 2011-06-03

Removed duplicated code ( printing boot log messages ) in plymouth-upstart-bridge
Now it is in splash plugins

1399. By Pali on 2011-06-03

Added support for for scrolling boot log messages in plymouth-upstart-bridge

1398. By Pali on 2011-06-03

Added support for scrolling boot log messages in details plugin

1397. By Pali on 2011-05-22

Added support for scrolling boot log messages in text plugin

Preview Diff

1=== modified file 'debian/plymouth.plymouth-upstart-bridge.upstart'
2--- debian/plymouth.plymouth-upstart-bridge.upstart 2011-01-21 18:09:36 +0000
3+++ debian/plymouth.plymouth-upstart-bridge.upstart 2011-06-17 20:26:30 +0000
4@@ -9,6 +9,4 @@
5 or runlevel [06])
6 stop on stopping plymouth
7
8-console output
9-
10 exec plymouth-upstart-bridge
11
12=== modified file 'src/plugins/splash/details/plugin.c'
13--- src/plugins/splash/details/plugin.c 2011-04-21 06:55:41 +0000
14+++ src/plugins/splash/details/plugin.c 2011-06-17 20:26:30 +0000
15@@ -18,6 +18,7 @@
16 * 02111-1307, USA.
17 *
18 * Written by: Ray Strode <rstrode@redhat.com>
19+ * Pali Rohár <pali.rohar@gmail.com>
20 */
21 #include "config.h"
22
23@@ -428,6 +429,43 @@
24
25 if (!strncmp (message, "keys:", strlen ("keys:")))
26 message_to_display = message + strlen ("keys:");
27+ else if (!strncmp (message, "log:", strlen ("log:")))
28+ {
29+ if (!strncmp (message, "log:ok", 6) || !strncmp(message, "log:failed", 10))
30+ {
31+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
32+ {
33+ ply_list_node_t *node = ply_list_get_first_node (plugin->views);
34+
35+ while (node != NULL)
36+ {
37+ view_t *view = ply_list_node_get_data (node);
38+ node = ply_list_get_next_node (plugin->views, node);
39+
40+ int cols = ply_text_display_get_number_of_columns (view->display) - 7;
41+ ply_text_display_write (view->display, "\033[1A\033[%dC", cols); // Move cursor to previous end of line
42+
43+ if (!strncmp (message, "log:ok", 6))
44+ ply_text_display_write (view->display, "[ OK ]\r\n");
45+ else
46+ {
47+ ply_text_display_write (view->display, "[");
48+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_RED);
49+ ply_text_display_write (view->display, "fail");
50+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_DEFAULT);
51+ ply_text_display_write (view->display, "]\r\n");
52+ }
53+ }
54+ }
55+
56+ return;
57+ }
58+ else
59+ {
60+ message_to_display = calloc (strlen (message + 4) + strlen(" * ") + 3, sizeof (char));
61+ sprintf (message_to_display, " * %s", message + 4);
62+ }
63+ }
64 else
65 message_to_display = message;
66
67
68=== modified file 'src/plugins/splash/text/plugin.c'
69--- src/plugins/splash/text/plugin.c 2010-04-13 23:02:26 +0000
70+++ src/plugins/splash/text/plugin.c 2011-06-17 20:26:30 +0000
71@@ -19,6 +19,7 @@
72 *
73 * Written by: Adam Jackson <ajax@redhat.com>
74 * Ray Strode <rstrode@redhat.com>
75+ * Pali Rohár <pali.rohar@gmail.com>
76 */
77 #include "config.h"
78
79@@ -57,6 +58,8 @@
80 #define CLEAR_LINE_SEQUENCE "\033[2K\r\n"
81 #define BACKSPACE "\b\033[0K"
82
83+#define MAX_LOG_MESSAGES 40
84+
85 typedef enum {
86 PLY_BOOT_SPLASH_DISPLAY_NORMAL,
87 PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY,
88@@ -73,6 +76,7 @@
89 ply_boot_splash_display_type_t state;
90
91 char *message;
92+ char *log_messages[MAX_LOG_MESSAGES];
93
94 uint32_t is_animating : 1;
95 };
96@@ -112,6 +116,11 @@
97 }
98
99 static void
100+view_text_display_message (view_t *view,
101+ int x, int y,
102+ const char *message);
103+
104+static void
105 view_show_message (view_t *view)
106 {
107 ply_boot_splash_plugin_t *plugin;
108@@ -122,15 +131,77 @@
109 display_width = ply_text_display_get_number_of_columns (view->display);
110 display_height = ply_text_display_get_number_of_rows (view->display);
111
112- ply_text_display_set_cursor_position (view->display, 0,
113- display_height / 2);
114+ if (!strncmp (plugin->message, "log:", 4))
115+ {
116+ int max_width, begin, i, y;
117+
118+ if (!strncmp (plugin->message, "log:ok", 6) || !strncmp(plugin->message, "log:failed", 10))
119+ {
120+ if (plugin->log_messages[MAX_LOG_MESSAGES-1] != NULL)
121+ {
122+ int size = strlen (plugin->log_messages[MAX_LOG_MESSAGES-1]);
123+ if (!(size > 2 && !strncmp (plugin->log_messages[MAX_LOG_MESSAGES-1] + size - 2, "ok", 2)) &&
124+ !(size > 6 && !strncmp (plugin->log_messages[MAX_LOG_MESSAGES-1] + size - 6, "failed", 6)))
125+ {
126+ char *new_message = calloc (strlen (plugin->message + 4) + strlen (plugin->log_messages[MAX_LOG_MESSAGES-1]) + 4, sizeof (char));
127+ sprintf (new_message, "%s %s", plugin->log_messages[MAX_LOG_MESSAGES-1], plugin->message + 4);
128+ free (plugin->log_messages[MAX_LOG_MESSAGES-1]);
129+ plugin->log_messages[MAX_LOG_MESSAGES-1] = new_message;
130+ }
131+ }
132+ }
133+ else
134+ {
135+ if (plugin->log_messages[0] != NULL)
136+ free (plugin->log_messages[0]);
137+
138+ for (i = 0; i < MAX_LOG_MESSAGES-1; i++)
139+ plugin->log_messages[i] = plugin->log_messages[i+1];
140+
141+ if (strlen (plugin->message + 4) > display_width - MAX_LOG_MESSAGES)
142+ plugin->message[display_width - MAX_LOG_MESSAGES] = 0;
143+
144+ plugin->log_messages[MAX_LOG_MESSAGES-1] = calloc (strlen (plugin->message + 4) + 4, sizeof (char));
145+ strcpy (plugin->log_messages[MAX_LOG_MESSAGES-1], plugin->message + 4);
146+ strcpy (plugin->log_messages[MAX_LOG_MESSAGES-1] + strlen(plugin->log_messages[MAX_LOG_MESSAGES-1]), "...");
147+ }
148+
149+ begin = MAX_LOG_MESSAGES - display_height + 5;
150+ max_width = 0;
151+ y = 3;
152+
153+ if (begin < 0)
154+ begin = 0;
155+
156+ for (i = begin; i < MAX_LOG_MESSAGES; i++)
157+ if (plugin->log_messages[i] != NULL)
158+ if (max_width < strlen (plugin->log_messages[i]))
159+ max_width = strlen (plugin->log_messages[i]);
160+
161+ if (max_width > display_width)
162+ max_width = display_width;
163+
164+ if (max_width < display_width / 2)
165+ max_width = display_width / 2;
166+
167+ for (i = begin; i < MAX_LOG_MESSAGES; i++)
168+ if (plugin->log_messages[i] != NULL)
169+ view_text_display_message (view, (display_width - max_width) / 2, y++, plugin->log_messages[i]);
170+ }
171+ else
172+ view_text_display_message (view, (display_width - strlen (plugin->message)) / 2, display_height / 2, plugin->message);
173+}
174+
175+static void
176+view_text_display_message (view_t *view,
177+ int x, int y,
178+ const char *message)
179+{
180+ ply_text_display_set_cursor_position (view->display, 0, y);
181 ply_text_display_clear_line (view->display);
182- ply_text_display_set_cursor_position (view->display,
183- (display_width -
184- strlen (plugin->message)) / 2,
185- display_height / 2);
186+ ply_text_display_set_cursor_position (view->display, x, y);
187
188- ply_text_display_write (view->display, "%s", plugin->message);
189+ ply_text_display_write (view->display, "%s", message);
190 }
191
192 static void
193@@ -317,12 +388,16 @@
194 create_plugin (ply_key_file_t *key_file)
195 {
196 ply_boot_splash_plugin_t *plugin;
197+ int i;
198
199 ply_trace ("creating plugin");
200
201 plugin = calloc (1, sizeof (ply_boot_splash_plugin_t));
202 plugin->message = NULL;
203
204+ for (i = 0; i < MAX_LOG_MESSAGES; i++)
205+ plugin->log_messages[i] = NULL;
206+
207 plugin->views = ply_list_new ();
208
209 return plugin;
210@@ -365,6 +440,7 @@
211 destroy_plugin (ply_boot_splash_plugin_t *plugin)
212 {
213 ply_trace ("destroying plugin");
214+ int i;
215
216 if (plugin == NULL)
217 return;
218@@ -378,6 +454,10 @@
219 if (plugin->message != NULL)
220 free (plugin->message);
221
222+ for (i = 0; i < MAX_LOG_MESSAGES; i++)
223+ if (plugin->log_messages[i] != NULL)
224+ free (plugin->log_messages[i]);
225+
226 free (plugin);
227 }
228
229
230=== modified file 'src/plugins/splash/ubuntu-text/plugin.c'
231--- src/plugins/splash/ubuntu-text/plugin.c 2010-11-01 18:53:55 +0000
232+++ src/plugins/splash/ubuntu-text/plugin.c 2011-06-17 20:26:30 +0000
233@@ -21,6 +21,7 @@
234 * Written by: Scott James Remnant <scott@ubuntu.com>
235 * Adam Jackson <ajax@redhat.com>
236 * Ray Strode <rstrode@redhat.com>
237+ * Pali Rohár <pali.rohar@gmail.com>
238 */
239 #include "config.h"
240
241@@ -59,6 +60,8 @@
242 #define CLEAR_LINE_SEQUENCE "\033[2K\r\n"
243 #define BACKSPACE "\b\033[0K"
244
245+#define MAX_LOG_MESSAGES 40
246+
247 typedef enum {
248 PLY_BOOT_SPLASH_DISPLAY_NORMAL,
249 PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY,
250@@ -75,6 +78,7 @@
251 ply_boot_splash_display_type_t state;
252
253 char *message;
254+ char *log_messages[MAX_LOG_MESSAGES];
255
256 uint32_t is_animating : 1;
257 uint32_t black;
258@@ -114,6 +118,12 @@
259 }
260
261 static void
262+view_text_display_message (view_t *view,
263+ int x, int y,
264+ ply_terminal_color_t color,
265+ const char *message);
266+
267+static void
268 view_show_message (view_t *view)
269 {
270 ply_boot_splash_plugin_t *plugin;
271@@ -126,6 +136,61 @@
272 display_width = ply_text_display_get_number_of_columns (view->display);
273 display_height = ply_text_display_get_number_of_rows (view->display);
274
275+ if (!strncmp (plugin->message, "log:", 4))
276+ {
277+ int max_width, begin, i;
278+
279+ if (!strncmp (plugin->message, "log:ok", 6) || !strncmp(plugin->message, "log:failed", 10))
280+ {
281+ if (plugin->log_messages[MAX_LOG_MESSAGES-1] != NULL)
282+ {
283+ int size = strlen (plugin->log_messages[MAX_LOG_MESSAGES-1]);
284+ if (!(size > 2 && !strncmp (plugin->log_messages[MAX_LOG_MESSAGES-1] + size - 2, "ok", 2)) &&
285+ !(size > 6 && !strncmp (plugin->log_messages[MAX_LOG_MESSAGES-1] + size - 6, "failed", 6)))
286+ {
287+ char *new_message = calloc (strlen (plugin->message + 4) + strlen (plugin->log_messages[MAX_LOG_MESSAGES-1]) + 4, sizeof (char));
288+ sprintf (new_message, "%s %s", plugin->log_messages[MAX_LOG_MESSAGES-1], plugin->message + 4);
289+ free (plugin->log_messages[MAX_LOG_MESSAGES-1]);
290+ plugin->log_messages[MAX_LOG_MESSAGES-1] = new_message;
291+ }
292+ }
293+ }
294+ else
295+ {
296+ if (plugin->log_messages[0] != NULL)
297+ free (plugin->log_messages[0]);
298+
299+ for (i = 0; i < MAX_LOG_MESSAGES-1; i++)
300+ plugin->log_messages[i] = plugin->log_messages[i+1];
301+
302+ if (strlen (plugin->message + 4) > display_width - MAX_LOG_MESSAGES)
303+ plugin->message[display_width - MAX_LOG_MESSAGES] = 0;
304+
305+ plugin->log_messages[MAX_LOG_MESSAGES-1] = calloc (strlen (plugin->message + 4) + 4, sizeof (char));
306+ strcpy (plugin->log_messages[MAX_LOG_MESSAGES-1], plugin->message + 4);
307+ strcpy (plugin->log_messages[MAX_LOG_MESSAGES-1] + strlen(plugin->log_messages[MAX_LOG_MESSAGES-1]), "...");
308+ }
309+
310+ begin = MAX_LOG_MESSAGES - display_height / 2 + 4;
311+ max_width = 0;
312+ color = PLY_TERMINAL_COLOR_WHITE;
313+ y = display_height / 2 + 4;
314+
315+ if (begin < 0)
316+ begin = 0;
317+
318+ for (i = begin; i < MAX_LOG_MESSAGES; i++)
319+ if (plugin->log_messages[i] != NULL)
320+ if (max_width < strlen (plugin->log_messages[i]))
321+ max_width = strlen (plugin->log_messages[i]);
322+
323+ for (i = begin; i < MAX_LOG_MESSAGES; i++)
324+ if (plugin->log_messages[i] != NULL)
325+ view_text_display_message (view, (display_width - max_width) / 2, y++, color, plugin->log_messages[i]);
326+
327+ return;
328+ }
329+
330 if (!strncmp (plugin->message, "keys:", 5))
331 {
332 message = plugin->message + 5;
333@@ -139,12 +204,18 @@
334 y = display_height / 2 + 7;
335 }
336
337+ view_text_display_message (view, (display_width - strlen (message)) / 2, y, color, message);
338+}
339+
340+static void
341+view_text_display_message (view_t *view,
342+ int x, int y,
343+ ply_terminal_color_t color,
344+ const char *message)
345+{
346 ply_text_display_set_cursor_position (view->display, 0, y);
347 ply_text_display_clear_line (view->display);
348- ply_text_display_set_cursor_position (view->display,
349- (display_width -
350- strlen (message)) / 2,
351- y);
352+ ply_text_display_set_cursor_position (view->display, x, y);
353
354 ply_text_display_set_foreground_color (view->display, color);
355 ply_text_display_write (view->display, "%s", message);
356@@ -157,7 +228,6 @@
357 {
358 ply_boot_splash_plugin_t *plugin;
359 int display_width, display_height;
360- int i;
361
362 plugin = view->plugin;
363
364@@ -320,6 +390,7 @@
365 create_plugin (ply_key_file_t *key_file)
366 {
367 char *option;
368+ int i;
369
370 ply_boot_splash_plugin_t *plugin;
371
372@@ -328,6 +399,9 @@
373 plugin = calloc (1, sizeof (ply_boot_splash_plugin_t));
374 plugin->message = NULL;
375
376+ for (i = 0; i < MAX_LOG_MESSAGES; i++)
377+ plugin->log_messages[i] = NULL;
378+
379 plugin->views = ply_list_new ();
380
381 /* Not a pretty API for setting defaults for your config file... */
382@@ -391,6 +465,7 @@
383 destroy_plugin (ply_boot_splash_plugin_t *plugin)
384 {
385 ply_trace ("destroying plugin");
386+ int i;
387
388 if (plugin == NULL)
389 return;
390@@ -404,6 +479,10 @@
391 if (plugin->message != NULL)
392 free (plugin->message);
393
394+ for (i = 0; i < MAX_LOG_MESSAGES; i++)
395+ if (plugin->log_messages[i] != NULL)
396+ free (plugin->log_messages[i]);
397+
398 free (plugin);
399 }
400
401
402=== modified file 'src/upstart-bridge/plymouth-upstart-bridge.c'
403--- src/upstart-bridge/plymouth-upstart-bridge.c 2011-01-21 18:09:36 +0000
404+++ src/upstart-bridge/plymouth-upstart-bridge.c 2011-06-17 20:26:30 +0000
405@@ -18,6 +18,7 @@
406 * 02111-1307, USA.
407 *
408 * Written by: Colin Watson <cjwatson@ubuntu.com>
409+ * Pali Rohár <pali.rohar@gmail.com>
410 */
411 #include "config.h"
412
413@@ -71,55 +72,22 @@
414 ply_upstart_monitor_instance_properties_t *instance,
415 const char *action, bool ok)
416 {
417- int xenl;
418- const char *hpa;
419+ char *message;
420+ const char *description;
421+
422+ if (job->description == NULL || job->description[0] == '\0')
423+ description = job->name;
424+ else
425+ description = job->description;
426+
427+ message = calloc (strlen (action) + strlen (description) + 10, sizeof (char));
428+ sprintf (message, "log:%s%s%s", action ? action : "", action ? " " : "", description);
429
430 ply_boot_client_update_daemon (state->client, job->name, NULL, NULL, state);
431-
432- if (job->description == NULL || job->description[0] == '\0')
433- return;
434-
435- printf (" * %s%s%s",
436- action ? action : "", action ? " " : "", job->description);
437-
438- xenl = tigetflag ("xenl");
439- hpa = get_string_capability ("hpa");
440-
441- if (xenl > 0 && hpa)
442- {
443- int cols, col;
444- char *hpa_out;
445-
446- cols = tigetnum ("cols");
447- if (cols < 6)
448- cols = 80;
449- col = cols - 7;
450-
451- hpa_out = tiparm (hpa, col);
452- fputs (hpa_out, stdout);
453-
454- if (ok)
455- puts ("[ OK ]");
456- else
457- {
458- const char *setaf, *op;
459- char *setaf_out = NULL;
460-
461- setaf = get_string_capability ("setaf");
462- if (setaf)
463- setaf_out = tiparm (setaf, 1); /* red */
464- op = get_string_capability ("op");
465-
466- printf ("[%sfail%s]\n", setaf_out ? setaf_out : "", op ? op : "");
467- }
468- }
469- else
470- {
471- if (ok)
472- puts (" ...done.");
473- else
474- puts (" ...fail!");
475- }
476+ ply_boot_client_tell_daemon_to_display_message (state->client, message, NULL, NULL, state);
477+ ply_boot_client_tell_daemon_to_display_message (state->client, ok ? "log:ok" : "log:failed", NULL, NULL, state);
478+
479+ free(message);
480 }
481
482 static void
483
484=== modified file 'themes/ubuntu-logo/ubuntu-logo.script'
485--- themes/ubuntu-logo/ubuntu-logo.script 2010-12-13 13:56:11 +0000
486+++ themes/ubuntu-logo/ubuntu-logo.script 2011-06-17 20:26:30 +0000
487@@ -18,6 +18,7 @@
488 # 02111-1307, USA.
489 #
490 # Written by: Alberto Milone <alberto.milone@canonical.com>
491+# Pali Rohár <pali.rohar@gmail.com>
492 #
493 # Based on the example provided with the "script plugin" written by:
494 # Charlie Brej <cbrej@cs.man.ac.uk>
495@@ -87,7 +88,7 @@
496 local.min_height;
497
498 # Put the 1st line below the logo + some spacing
499- y = logo.y + logo.height + (progress_indicator.bullet_height * 7 ); # + logo_spacing;
500+ y = logo.y + logo.height + (progress_indicator.bullet_height * 2 ); # + logo_spacing;
501
502 text_height = first_line_height * 7.5;
503
504@@ -221,6 +222,14 @@
505 # a bit if needed.
506 top_of_the_text = TextYOffset();
507
508+# Character 'M' is the biggest - calculate maximum characters for line
509+log_line_width = Window.GetWidth () / ImageToTintedText ("M").GetWidth () - 5;
510+# Calculate line count
511+log_line_count = ( Window.GetHeight () - top_of_the_text ) / ( ImageToTintedText ("M").GetHeight () * 1.1 );
512+
513+for (i = 0; i < log_line_count; i++)
514+ log_notification[i] = "";
515+
516 #-----------------------------------------Logo functions------------------------------
517
518 # Call this when updating the screen
519@@ -483,6 +492,46 @@
520 if (keys != NULL)
521 message = StringCopy (message, keys + StringLength(local.substring), NULL);
522
523+ local.substring = "log:";
524+ local.log = StringString (message, local.substring);
525+ if (log != NULL) {
526+ message = StringCopy (message, log + StringLength (local.substring), NULL);
527+
528+ if (message == "ok" || message == "failed") {
529+ local.last = 0;
530+ for (last = 0; last < log_line_count-1; last++) {}
531+
532+ local.len = StringLength (log_notification[last]);
533+ local.ok = "";
534+ local.failed = "";
535+
536+ if (len > 2)
537+ ok = StringCopy (log_notification[last], len - 2, NULL);
538+
539+ if (len > 6)
540+ failed = StringCopy (log_notification[last], len - 6, NULL);
541+
542+ if (len > 0 && ok != "ok" && failed != "failed")
543+ log_notification[last] += " " + message;
544+ } else {
545+ if (StringLength (message) > log_line_width-6)
546+ message = message.SubString (0, log_line_width-9);
547+ message += "...";
548+
549+ for (i = 0; i < log_line_count-1; i++)
550+ log_notification[i] = log_notification[i+1];
551+ log_notification[i] = message;
552+ }
553+
554+ message = "";
555+ for (i = 0; i < log_line_count; i++)
556+ if (log_notification[i] != "")
557+ message += log_notification[i] + "\n";
558+
559+ label = get_message_label ("", 1, 1);
560+ setup_message ("", label.x, label.y, 10000, 1);
561+ }
562+
563 local.label.is_fake = is_fake;
564 label = get_message_label(message, is_fake, is_action_line);
565 label.z = 10000;

Subscribers

People subscribed via source and target branches

to all changes: