Merge lp:~xnox/ubuntu/trusty/plymouth/fsck-details into lp:ubuntu/trusty/plymouth
- Trusty (14.04)
- fsck-details
- Merge into trusty
Proposed by
Dimitri John Ledkov
Status: | Merged |
---|---|
Merged at revision: | 1463 |
Proposed branch: | lp:~xnox/ubuntu/trusty/plymouth/fsck-details |
Merge into: | lp:ubuntu/trusty/plymouth |
Diff against target: |
585 lines (+529/-0) 6 files modified
.pc/applied-patches (+1/-0) .pc/details-update-status.patch/src/plugins/splash/details/plugin.c (+468/-0) debian/changelog (+7/-0) debian/patches/details-update-status.patch (+36/-0) debian/patches/series (+1/-0) src/plugins/splash/details/plugin.c (+16/-0) |
To merge this branch: | bzr merge lp:~xnox/ubuntu/trusty/plymouth/fsck-details |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Upstart Reviewers | Pending | ||
Ubuntu branches | Pending | ||
Review via email: mp+197312@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote : | # |
Revision history for this message
Dimitri John Ledkov (xnox) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.pc/applied-patches' | |||
2 | --- .pc/applied-patches 2013-06-28 22:58:24 +0000 | |||
3 | +++ .pc/applied-patches 2013-12-02 05:06:37 +0000 | |||
4 | @@ -12,3 +12,4 @@ | |||
5 | 12 | Fix-missing-prototype-of-ply_get_timestamp.patch | 12 | Fix-missing-prototype-of-ply_get_timestamp.patch |
6 | 13 | Miscellaneous-fixes-for-compiler-warnings.patch | 13 | Miscellaneous-fixes-for-compiler-warnings.patch |
7 | 14 | autoreconf.patch | 14 | autoreconf.patch |
8 | 15 | details-update-status.patch | ||
9 | 15 | 16 | ||
10 | === added directory '.pc/details-update-status.patch' | |||
11 | === added directory '.pc/details-update-status.patch/src' | |||
12 | === added directory '.pc/details-update-status.patch/src/plugins' | |||
13 | === added directory '.pc/details-update-status.patch/src/plugins/splash' | |||
14 | === added directory '.pc/details-update-status.patch/src/plugins/splash/details' | |||
15 | === added file '.pc/details-update-status.patch/src/plugins/splash/details/plugin.c' | |||
16 | --- .pc/details-update-status.patch/src/plugins/splash/details/plugin.c 1970-01-01 00:00:00 +0000 | |||
17 | +++ .pc/details-update-status.patch/src/plugins/splash/details/plugin.c 2013-12-02 05:06:37 +0000 | |||
18 | @@ -0,0 +1,468 @@ | |||
19 | 1 | /* details.c - boot splash plugin | ||
20 | 2 | * | ||
21 | 3 | * Copyright (C) 2008 Red Hat, Inc. | ||
22 | 4 | * | ||
23 | 5 | * This program is free software; you can redistribute it and/or modify | ||
24 | 6 | * it under the terms of the GNU General Public License as published by | ||
25 | 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
26 | 8 | * any later version. | ||
27 | 9 | * | ||
28 | 10 | * This program is distributed in the hope that it will be useful, | ||
29 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
30 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
31 | 13 | * GNU General Public License for more details. | ||
32 | 14 | * | ||
33 | 15 | * You should have received a copy of the GNU General Public License | ||
34 | 16 | * along with this program; if not, write to the Free Software | ||
35 | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
36 | 18 | * 02111-1307, USA. | ||
37 | 19 | * | ||
38 | 20 | * Written by: Ray Strode <rstrode@redhat.com> | ||
39 | 21 | */ | ||
40 | 22 | #include "config.h" | ||
41 | 23 | |||
42 | 24 | #include <assert.h> | ||
43 | 25 | #include <errno.h> | ||
44 | 26 | #include <fcntl.h> | ||
45 | 27 | #include <math.h> | ||
46 | 28 | #include <signal.h> | ||
47 | 29 | #include <stdbool.h> | ||
48 | 30 | #include <stdio.h> | ||
49 | 31 | #include <stdint.h> | ||
50 | 32 | #include <stdlib.h> | ||
51 | 33 | #include <string.h> | ||
52 | 34 | #include <sys/ioctl.h> | ||
53 | 35 | #include <sys/stat.h> | ||
54 | 36 | #include <sys/time.h> | ||
55 | 37 | #include <sys/types.h> | ||
56 | 38 | #include <termios.h> | ||
57 | 39 | #include <unistd.h> | ||
58 | 40 | #include <wchar.h> | ||
59 | 41 | #include <values.h> | ||
60 | 42 | |||
61 | 43 | #include "ply-boot-splash-plugin.h" | ||
62 | 44 | #include "ply-buffer.h" | ||
63 | 45 | #include "ply-event-loop.h" | ||
64 | 46 | #include "ply-key-file.h" | ||
65 | 47 | #include "ply-list.h" | ||
66 | 48 | #include "ply-logger.h" | ||
67 | 49 | #include "ply-text-display.h" | ||
68 | 50 | #include "ply-trigger.h" | ||
69 | 51 | #include "ply-utils.h" | ||
70 | 52 | |||
71 | 53 | #include <linux/kd.h> | ||
72 | 54 | |||
73 | 55 | #define CLEAR_LINE_SEQUENCE "\033[2K\r" | ||
74 | 56 | |||
75 | 57 | typedef enum { | ||
76 | 58 | PLY_BOOT_SPLASH_DISPLAY_NORMAL, | ||
77 | 59 | PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY, | ||
78 | 60 | PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY | ||
79 | 61 | } ply_boot_splash_display_type_t; | ||
80 | 62 | |||
81 | 63 | typedef struct | ||
82 | 64 | { | ||
83 | 65 | ply_boot_splash_plugin_t *plugin; | ||
84 | 66 | ply_text_display_t *display; | ||
85 | 67 | } view_t; | ||
86 | 68 | |||
87 | 69 | ply_boot_splash_plugin_interface_t *ply_boot_splash_plugin_get_interface (void); | ||
88 | 70 | static void detach_from_event_loop (ply_boot_splash_plugin_t *plugin); | ||
89 | 71 | |||
90 | 72 | struct _ply_boot_splash_plugin | ||
91 | 73 | { | ||
92 | 74 | ply_event_loop_t *loop; | ||
93 | 75 | ply_boot_splash_mode_t mode; | ||
94 | 76 | ply_list_t *views; | ||
95 | 77 | ply_boot_splash_display_type_t state; | ||
96 | 78 | ply_list_t *messages; | ||
97 | 79 | |||
98 | 80 | }; | ||
99 | 81 | |||
100 | 82 | static view_t * | ||
101 | 83 | view_new (ply_boot_splash_plugin_t *plugin, | ||
102 | 84 | ply_text_display_t *display) | ||
103 | 85 | { | ||
104 | 86 | view_t *view; | ||
105 | 87 | |||
106 | 88 | view = calloc (1, sizeof (view_t)); | ||
107 | 89 | view->plugin = plugin; | ||
108 | 90 | view->display = display; | ||
109 | 91 | |||
110 | 92 | return view; | ||
111 | 93 | } | ||
112 | 94 | |||
113 | 95 | static void | ||
114 | 96 | view_free (view_t *view) | ||
115 | 97 | { | ||
116 | 98 | free (view); | ||
117 | 99 | } | ||
118 | 100 | |||
119 | 101 | static void | ||
120 | 102 | free_views (ply_boot_splash_plugin_t *plugin) | ||
121 | 103 | { | ||
122 | 104 | ply_list_node_t *node; | ||
123 | 105 | |||
124 | 106 | node = ply_list_get_first_node (plugin->views); | ||
125 | 107 | |||
126 | 108 | while (node != NULL) | ||
127 | 109 | { | ||
128 | 110 | ply_list_node_t *next_node; | ||
129 | 111 | view_t *view; | ||
130 | 112 | |||
131 | 113 | view = ply_list_node_get_data (node); | ||
132 | 114 | next_node = ply_list_get_next_node (plugin->views, node); | ||
133 | 115 | |||
134 | 116 | view_free (view); | ||
135 | 117 | ply_list_remove_node (plugin->views, node); | ||
136 | 118 | |||
137 | 119 | node = next_node; | ||
138 | 120 | } | ||
139 | 121 | |||
140 | 122 | ply_list_free (plugin->views); | ||
141 | 123 | plugin->views = NULL; | ||
142 | 124 | } | ||
143 | 125 | |||
144 | 126 | static void | ||
145 | 127 | free_messages (ply_boot_splash_plugin_t *plugin) | ||
146 | 128 | { | ||
147 | 129 | ply_list_node_t *node; | ||
148 | 130 | |||
149 | 131 | node = ply_list_get_first_node (plugin->messages); | ||
150 | 132 | |||
151 | 133 | while (node != NULL) | ||
152 | 134 | { | ||
153 | 135 | ply_list_node_t *next_node; | ||
154 | 136 | char *message; | ||
155 | 137 | |||
156 | 138 | message = ply_list_node_get_data (node); | ||
157 | 139 | next_node = ply_list_get_next_node (plugin->messages, node); | ||
158 | 140 | |||
159 | 141 | free (message); | ||
160 | 142 | ply_list_remove_node (plugin->messages, node); | ||
161 | 143 | |||
162 | 144 | node = next_node; | ||
163 | 145 | } | ||
164 | 146 | |||
165 | 147 | ply_list_free (plugin->messages); | ||
166 | 148 | plugin->messages = NULL; | ||
167 | 149 | } | ||
168 | 150 | |||
169 | 151 | static ply_boot_splash_plugin_t * | ||
170 | 152 | create_plugin (ply_key_file_t *key_file) | ||
171 | 153 | { | ||
172 | 154 | ply_boot_splash_plugin_t *plugin; | ||
173 | 155 | |||
174 | 156 | ply_trace ("creating plugin"); | ||
175 | 157 | |||
176 | 158 | plugin = calloc (1, sizeof (ply_boot_splash_plugin_t)); | ||
177 | 159 | plugin->views = ply_list_new (); | ||
178 | 160 | plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL; | ||
179 | 161 | plugin->messages = ply_list_new (); | ||
180 | 162 | return plugin; | ||
181 | 163 | } | ||
182 | 164 | |||
183 | 165 | static void | ||
184 | 166 | destroy_plugin (ply_boot_splash_plugin_t *plugin) | ||
185 | 167 | { | ||
186 | 168 | ply_trace ("destroying plugin"); | ||
187 | 169 | |||
188 | 170 | if (plugin == NULL) | ||
189 | 171 | return; | ||
190 | 172 | |||
191 | 173 | if (plugin->loop != NULL) | ||
192 | 174 | { | ||
193 | 175 | ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t) | ||
194 | 176 | detach_from_event_loop, | ||
195 | 177 | plugin); | ||
196 | 178 | detach_from_event_loop (plugin); | ||
197 | 179 | } | ||
198 | 180 | |||
199 | 181 | free_messages (plugin); | ||
200 | 182 | free_views (plugin); | ||
201 | 183 | |||
202 | 184 | free (plugin); | ||
203 | 185 | } | ||
204 | 186 | |||
205 | 187 | static void | ||
206 | 188 | detach_from_event_loop (ply_boot_splash_plugin_t *plugin) | ||
207 | 189 | { | ||
208 | 190 | plugin->loop = NULL; | ||
209 | 191 | |||
210 | 192 | ply_trace ("detaching from event loop"); | ||
211 | 193 | } | ||
212 | 194 | |||
213 | 195 | static void | ||
214 | 196 | view_write (view_t *view, | ||
215 | 197 | const char *text, | ||
216 | 198 | size_t number_of_bytes) | ||
217 | 199 | { | ||
218 | 200 | ply_terminal_t *terminal; | ||
219 | 201 | |||
220 | 202 | terminal = ply_text_display_get_terminal (view->display); | ||
221 | 203 | ply_terminal_write (terminal, "%.*s", (int) number_of_bytes, text); | ||
222 | 204 | } | ||
223 | 205 | |||
224 | 206 | static void | ||
225 | 207 | write_on_views (ply_boot_splash_plugin_t *plugin, | ||
226 | 208 | const char *text, | ||
227 | 209 | size_t number_of_bytes) | ||
228 | 210 | { | ||
229 | 211 | ply_list_node_t *node; | ||
230 | 212 | |||
231 | 213 | if (number_of_bytes == 0) | ||
232 | 214 | return; | ||
233 | 215 | |||
234 | 216 | node = ply_list_get_first_node (plugin->views); | ||
235 | 217 | |||
236 | 218 | while (node != NULL) | ||
237 | 219 | { | ||
238 | 220 | ply_list_node_t *next_node; | ||
239 | 221 | view_t *view; | ||
240 | 222 | |||
241 | 223 | view = ply_list_node_get_data (node); | ||
242 | 224 | next_node = ply_list_get_next_node (plugin->views, node); | ||
243 | 225 | |||
244 | 226 | view_write (view, text, number_of_bytes); | ||
245 | 227 | |||
246 | 228 | node = next_node; | ||
247 | 229 | } | ||
248 | 230 | |||
249 | 231 | } | ||
250 | 232 | |||
251 | 233 | static void | ||
252 | 234 | add_text_display (ply_boot_splash_plugin_t *plugin, | ||
253 | 235 | ply_text_display_t *display) | ||
254 | 236 | { | ||
255 | 237 | view_t *view; | ||
256 | 238 | ply_terminal_t *terminal; | ||
257 | 239 | |||
258 | 240 | view = view_new (plugin, display); | ||
259 | 241 | |||
260 | 242 | terminal = ply_text_display_get_terminal (view->display); | ||
261 | 243 | if (ply_terminal_open (terminal)) | ||
262 | 244 | ply_terminal_activate_vt (terminal); | ||
263 | 245 | |||
264 | 246 | ply_list_append_data (plugin->views, view); | ||
265 | 247 | } | ||
266 | 248 | |||
267 | 249 | static void | ||
268 | 250 | remove_text_display (ply_boot_splash_plugin_t *plugin, | ||
269 | 251 | ply_text_display_t *display) | ||
270 | 252 | { | ||
271 | 253 | ply_list_node_t *node; | ||
272 | 254 | |||
273 | 255 | node = ply_list_get_first_node (plugin->views); | ||
274 | 256 | while (node != NULL) | ||
275 | 257 | { | ||
276 | 258 | view_t *view; | ||
277 | 259 | ply_list_node_t *next_node; | ||
278 | 260 | |||
279 | 261 | view = ply_list_node_get_data (node); | ||
280 | 262 | next_node = ply_list_get_next_node (plugin->views, node); | ||
281 | 263 | |||
282 | 264 | if (view->display == display) | ||
283 | 265 | { | ||
284 | 266 | ply_list_remove_node (plugin->views, node); | ||
285 | 267 | return; | ||
286 | 268 | } | ||
287 | 269 | |||
288 | 270 | node = next_node; | ||
289 | 271 | } | ||
290 | 272 | } | ||
291 | 273 | |||
292 | 274 | static bool | ||
293 | 275 | show_splash_screen (ply_boot_splash_plugin_t *plugin, | ||
294 | 276 | ply_event_loop_t *loop, | ||
295 | 277 | ply_buffer_t *boot_buffer, | ||
296 | 278 | ply_boot_splash_mode_t mode) | ||
297 | 279 | { | ||
298 | 280 | size_t size; | ||
299 | 281 | |||
300 | 282 | assert (plugin != NULL); | ||
301 | 283 | |||
302 | 284 | plugin->loop = loop; | ||
303 | 285 | plugin->mode = mode; | ||
304 | 286 | |||
305 | 287 | ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t) | ||
306 | 288 | detach_from_event_loop, | ||
307 | 289 | plugin); | ||
308 | 290 | |||
309 | 291 | if (boot_buffer) | ||
310 | 292 | { | ||
311 | 293 | size = ply_buffer_get_size (boot_buffer); | ||
312 | 294 | |||
313 | 295 | write_on_views (plugin, ply_buffer_get_bytes (boot_buffer), size); | ||
314 | 296 | } | ||
315 | 297 | |||
316 | 298 | return true; | ||
317 | 299 | } | ||
318 | 300 | |||
319 | 301 | static void | ||
320 | 302 | update_status (ply_boot_splash_plugin_t *plugin, | ||
321 | 303 | const char *status) | ||
322 | 304 | { | ||
323 | 305 | assert (plugin != NULL); | ||
324 | 306 | |||
325 | 307 | ply_trace ("status update"); | ||
326 | 308 | } | ||
327 | 309 | |||
328 | 310 | static void | ||
329 | 311 | on_boot_output (ply_boot_splash_plugin_t *plugin, | ||
330 | 312 | const char *output, | ||
331 | 313 | size_t size) | ||
332 | 314 | { | ||
333 | 315 | ply_trace ("writing '%s' to all views (%d bytes)", | ||
334 | 316 | output, (int) size); | ||
335 | 317 | write_on_views (plugin, output, size); | ||
336 | 318 | } | ||
337 | 319 | |||
338 | 320 | static void | ||
339 | 321 | hide_splash_screen (ply_boot_splash_plugin_t *plugin, | ||
340 | 322 | ply_event_loop_t *loop) | ||
341 | 323 | { | ||
342 | 324 | assert (plugin != NULL); | ||
343 | 325 | |||
344 | 326 | ply_trace ("hiding splash screen"); | ||
345 | 327 | |||
346 | 328 | ply_event_loop_stop_watching_for_exit (plugin->loop, | ||
347 | 329 | (ply_event_loop_exit_handler_t) | ||
348 | 330 | detach_from_event_loop, | ||
349 | 331 | plugin); | ||
350 | 332 | detach_from_event_loop (plugin); | ||
351 | 333 | } | ||
352 | 334 | |||
353 | 335 | static void | ||
354 | 336 | display_normal (ply_boot_splash_plugin_t *plugin) | ||
355 | 337 | { | ||
356 | 338 | ply_list_node_t *node; | ||
357 | 339 | |||
358 | 340 | if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL) | ||
359 | 341 | write_on_views (plugin, "\r\n", strlen ("\r\n")); | ||
360 | 342 | |||
361 | 343 | plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL; | ||
362 | 344 | |||
363 | 345 | node = ply_list_get_first_node (plugin->messages); | ||
364 | 346 | while (node != NULL) | ||
365 | 347 | { | ||
366 | 348 | const char *message; | ||
367 | 349 | ply_list_node_t *next_node; | ||
368 | 350 | |||
369 | 351 | message = ply_list_node_get_data (node); | ||
370 | 352 | next_node = ply_list_get_next_node (plugin->messages, node); | ||
371 | 353 | |||
372 | 354 | write_on_views (plugin, message, strlen (message)); | ||
373 | 355 | write_on_views (plugin, "\r\n", strlen ("\r\n")); | ||
374 | 356 | |||
375 | 357 | ply_list_remove_node (plugin->messages, node); | ||
376 | 358 | node = next_node; | ||
377 | 359 | } | ||
378 | 360 | } | ||
379 | 361 | |||
380 | 362 | /* @shorten_prompt: | ||
381 | 363 | * | ||
382 | 364 | * Points prompt to the character immediately after the | ||
383 | 365 | * last '\n' in prompt | ||
384 | 366 | */ | ||
385 | 367 | static void shorten_prompt(const char ** prompt) | ||
386 | 368 | { | ||
387 | 369 | int last_nl=-1, i=0; | ||
388 | 370 | const char * str = *prompt; | ||
389 | 371 | for(i=0; str[i] != '\0'; i++) { | ||
390 | 372 | if(str[i] == '\n') { | ||
391 | 373 | last_nl = i; | ||
392 | 374 | } | ||
393 | 375 | } | ||
394 | 376 | if (last_nl >= 0) { | ||
395 | 377 | if((str[last_nl] == '\n') && (last_nl < i)){ | ||
396 | 378 | *prompt = &str[last_nl + 1]; | ||
397 | 379 | } | ||
398 | 380 | } | ||
399 | 381 | } | ||
400 | 382 | |||
401 | 383 | static void | ||
402 | 384 | display_password (ply_boot_splash_plugin_t *plugin, | ||
403 | 385 | const char *prompt, | ||
404 | 386 | int bullets) | ||
405 | 387 | { | ||
406 | 388 | int i; | ||
407 | 389 | if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY) | ||
408 | 390 | write_on_views (plugin, "\r\n", strlen ("\r\n")); | ||
409 | 391 | else | ||
410 | 392 | write_on_views (plugin, | ||
411 | 393 | CLEAR_LINE_SEQUENCE, | ||
412 | 394 | strlen (CLEAR_LINE_SEQUENCE)); | ||
413 | 395 | plugin->state = PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY; | ||
414 | 396 | |||
415 | 397 | if (prompt) { | ||
416 | 398 | if (bullets > 0) | ||
417 | 399 | shorten_prompt(&prompt); | ||
418 | 400 | write_on_views (plugin, | ||
419 | 401 | prompt, | ||
420 | 402 | strlen (prompt)); | ||
421 | 403 | } | ||
422 | 404 | else | ||
423 | 405 | write_on_views (plugin, | ||
424 | 406 | "Password:", | ||
425 | 407 | strlen ("Password:")); | ||
426 | 408 | |||
427 | 409 | for (i = 0; i < bullets; i++) | ||
428 | 410 | write_on_views (plugin, "*", strlen ("*")); | ||
429 | 411 | } | ||
430 | 412 | |||
431 | 413 | static void | ||
432 | 414 | display_question (ply_boot_splash_plugin_t *plugin, | ||
433 | 415 | const char *prompt, | ||
434 | 416 | const char *entry_text) | ||
435 | 417 | { | ||
436 | 418 | if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY) | ||
437 | 419 | write_on_views (plugin, "\r\n", strlen ("\r\n")); | ||
438 | 420 | else | ||
439 | 421 | write_on_views (plugin, | ||
440 | 422 | CLEAR_LINE_SEQUENCE, | ||
441 | 423 | strlen (CLEAR_LINE_SEQUENCE)); | ||
442 | 424 | |||
443 | 425 | plugin->state = PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY; | ||
444 | 426 | if (prompt) | ||
445 | 427 | write_on_views (plugin, prompt, strlen (prompt)); | ||
446 | 428 | |||
447 | 429 | write_on_views (plugin, ":", strlen (":")); | ||
448 | 430 | write_on_views (plugin, entry_text, strlen (entry_text)); | ||
449 | 431 | } | ||
450 | 432 | |||
451 | 433 | static void | ||
452 | 434 | display_message (ply_boot_splash_plugin_t *plugin, | ||
453 | 435 | const char *message) | ||
454 | 436 | { | ||
455 | 437 | if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL) | ||
456 | 438 | { | ||
457 | 439 | write_on_views (plugin, message, strlen (message)); | ||
458 | 440 | write_on_views (plugin, "\r\n", strlen ("\r\n")); | ||
459 | 441 | } | ||
460 | 442 | else | ||
461 | 443 | ply_list_append_data (plugin->messages, strdup (message)); | ||
462 | 444 | } | ||
463 | 445 | |||
464 | 446 | ply_boot_splash_plugin_interface_t * | ||
465 | 447 | ply_boot_splash_plugin_get_interface (void) | ||
466 | 448 | { | ||
467 | 449 | static ply_boot_splash_plugin_interface_t plugin_interface = | ||
468 | 450 | { | ||
469 | 451 | .create_plugin = create_plugin, | ||
470 | 452 | .destroy_plugin = destroy_plugin, | ||
471 | 453 | .add_text_display = add_text_display, | ||
472 | 454 | .remove_text_display = remove_text_display, | ||
473 | 455 | .show_splash_screen = show_splash_screen, | ||
474 | 456 | .update_status = update_status, | ||
475 | 457 | .on_boot_output = on_boot_output, | ||
476 | 458 | .hide_splash_screen = hide_splash_screen, | ||
477 | 459 | .display_normal = display_normal, | ||
478 | 460 | .display_password = display_password, | ||
479 | 461 | .display_question = display_question, | ||
480 | 462 | .display_message = display_message, | ||
481 | 463 | }; | ||
482 | 464 | |||
483 | 465 | return &plugin_interface; | ||
484 | 466 | } | ||
485 | 467 | |||
486 | 468 | /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ | ||
487 | 0 | 469 | ||
488 | === modified file 'debian/changelog' | |||
489 | --- debian/changelog 2013-11-28 21:05:57 +0000 | |||
490 | +++ debian/changelog 2013-12-02 05:06:37 +0000 | |||
491 | @@ -1,3 +1,10 @@ | |||
492 | 1 | plymouth (0.8.8-0ubuntu11) UNRELEASED; urgency=low | ||
493 | 2 | |||
494 | 3 | * Implement update status (U) splash plugin function for details plugin, | ||
495 | 4 | simply display those updates as text messages. (LP: #540645) | ||
496 | 5 | |||
497 | 6 | -- Dmitrijs Ledkovs <xnox@ubuntu.com> Mon, 02 Dec 2013 04:08:09 +0000 | ||
498 | 7 | |||
499 | 1 | plymouth (0.8.8-0ubuntu10) trusty; urgency=low | 8 | plymouth (0.8.8-0ubuntu10) trusty; urgency=low |
500 | 2 | 9 | ||
501 | 3 | * Update font dependency from ttf-dejavu-core to fonts-dejavu-core. | 10 | * Update font dependency from ttf-dejavu-core to fonts-dejavu-core. |
502 | 4 | 11 | ||
503 | === added file 'debian/patches/details-update-status.patch' | |||
504 | --- debian/patches/details-update-status.patch 1970-01-01 00:00:00 +0000 | |||
505 | +++ debian/patches/details-update-status.patch 2013-12-02 05:06:37 +0000 | |||
506 | @@ -0,0 +1,36 @@ | |||
507 | 1 | Description: Implement update status (U) splash plugin function for details plugins | ||
508 | 2 | Author: Dmitrijs Ledkovs <xnox@ubuntu.com> | ||
509 | 3 | Bug-Ubuntu: https://bugs.launchpad.net/bugs/540645 | ||
510 | 4 | |||
511 | 5 | --- a/src/plugins/splash/details/plugin.c | ||
512 | 6 | +++ b/src/plugins/splash/details/plugin.c | ||
513 | 7 | @@ -79,6 +79,9 @@ | ||
514 | 8 | |||
515 | 9 | }; | ||
516 | 10 | |||
517 | 11 | +static void display_message (ply_boot_splash_plugin_t *plugin, | ||
518 | 12 | + const char *message); | ||
519 | 13 | + | ||
520 | 14 | static view_t * | ||
521 | 15 | view_new (ply_boot_splash_plugin_t *plugin, | ||
522 | 16 | ply_text_display_t *display) | ||
523 | 17 | @@ -305,6 +308,19 @@ | ||
524 | 18 | assert (plugin != NULL); | ||
525 | 19 | |||
526 | 20 | ply_trace ("status update"); | ||
527 | 21 | + | ||
528 | 22 | + int progress = 0; | ||
529 | 23 | + | ||
530 | 24 | + if (! strncmp("fsck:", status, 5)) { | ||
531 | 25 | + /* Chop localised formatted string */ | ||
532 | 26 | + /* fsck:sda1:50:Checking disk %1$d of %2$d (%3$d%% complete) */ | ||
533 | 27 | + sscanf(status, "fsck:.*:%d:.*", &progress); | ||
534 | 28 | + char *end = strrchr(status, ':'); | ||
535 | 29 | + strncpy (end, "%\0", 2); | ||
536 | 30 | + } | ||
537 | 31 | + | ||
538 | 32 | + if (progress < 100) | ||
539 | 33 | + display_message (plugin, status); | ||
540 | 34 | } | ||
541 | 35 | |||
542 | 36 | static void | ||
543 | 0 | 37 | ||
544 | === modified file 'debian/patches/series' | |||
545 | --- debian/patches/series 2013-06-28 22:58:24 +0000 | |||
546 | +++ debian/patches/series 2013-12-02 05:06:37 +0000 | |||
547 | @@ -12,3 +12,4 @@ | |||
548 | 12 | Fix-missing-prototype-of-ply_get_timestamp.patch | 12 | Fix-missing-prototype-of-ply_get_timestamp.patch |
549 | 13 | Miscellaneous-fixes-for-compiler-warnings.patch | 13 | Miscellaneous-fixes-for-compiler-warnings.patch |
550 | 14 | autoreconf.patch | 14 | autoreconf.patch |
551 | 15 | details-update-status.patch | ||
552 | 15 | 16 | ||
553 | === modified file 'src/plugins/splash/details/plugin.c' | |||
554 | --- src/plugins/splash/details/plugin.c 2012-04-30 06:03:00 +0000 | |||
555 | +++ src/plugins/splash/details/plugin.c 2013-12-02 05:06:37 +0000 | |||
556 | @@ -79,6 +79,9 @@ | |||
557 | 79 | 79 | ||
558 | 80 | }; | 80 | }; |
559 | 81 | 81 | ||
560 | 82 | static void display_message (ply_boot_splash_plugin_t *plugin, | ||
561 | 83 | const char *message); | ||
562 | 84 | |||
563 | 82 | static view_t * | 85 | static view_t * |
564 | 83 | view_new (ply_boot_splash_plugin_t *plugin, | 86 | view_new (ply_boot_splash_plugin_t *plugin, |
565 | 84 | ply_text_display_t *display) | 87 | ply_text_display_t *display) |
566 | @@ -305,6 +308,19 @@ | |||
567 | 305 | assert (plugin != NULL); | 308 | assert (plugin != NULL); |
568 | 306 | 309 | ||
569 | 307 | ply_trace ("status update"); | 310 | ply_trace ("status update"); |
570 | 311 | |||
571 | 312 | int progress = 0; | ||
572 | 313 | |||
573 | 314 | if (! strncmp("fsck:", status, 5)) { | ||
574 | 315 | /* Chop localised formatted string */ | ||
575 | 316 | /* fsck:sda1:50:Checking disk %1$d of %2$d (%3$d%% complete) */ | ||
576 | 317 | sscanf(status, "fsck:.*:%d:.*", &progress); | ||
577 | 318 | char *end = strrchr(status, ':'); | ||
578 | 319 | strncpy (end, "%\0", 2); | ||
579 | 320 | } | ||
580 | 321 | |||
581 | 322 | if (progress < 100) | ||
582 | 323 | display_message (plugin, status); | ||
583 | 308 | } | 324 | } |
584 | 309 | 325 | ||
585 | 310 | static void | 326 | static void |
Print out fsck messages in plymouth details plugin, in the form of:
fsck:/:17%