ac5e855
diff -up plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c.textbar plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c
ac5e855
--- plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c.textbar	2008-08-19 15:14:04.000000000 -0400
ac5e855
+++ plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c	2008-09-05 15:21:28.000000000 -0400
ac5e855
@@ -50,11 +50,14 @@
8542591
 #include <linux/kd.h>
8542591
 
8542591
 #ifndef FRAMES_PER_SECOND
8542591
-#define FRAMES_PER_SECOND 10
8542591
+#define FRAMES_PER_SECOND 5
8542591
 #endif
8542591
 
8542591
 #define NUMBER_OF_INDICATOR_COLUMNS 6
ac5e855
 
ac5e855
+#define OS_STRING " "
ac5e855
+char *os_string = OS_STRING;
ac5e855
+
ac5e855
 struct _ply_text_pulser
ac5e855
 {
ac5e855
   ply_event_loop_t *loop;
ac5e855
@@ -75,13 +78,11 @@ ply_text_pulser_new (void)
8542591
 
8542591
   pulser = calloc (1, sizeof (ply_text_pulser_t));
8542591
 
8542591
-  pulser->number_of_rows = 0;
8542591
-  pulser->number_of_columns = 0;
8542591
   pulser->row = 0;
8542591
   pulser->column = 0;
8542591
   pulser->spinner_position = 0;
8542591
-  pulser->number_of_columns = 40;
8542591
-  pulser->number_of_rows = 1;
8542591
+  pulser->number_of_columns = 0;
8542591
+  pulser->number_of_rows = 0;
8542591
 
8542591
   return pulser;
8542591
 }
ac5e855
@@ -96,41 +97,95 @@ ply_text_pulser_free (ply_text_pulser_t 
8542591
 }
8542591
 
ac5e855
 static void
8542591
-draw_trough (ply_text_pulser_t *pulser,
8542591
-             int                column,
8542591
-             int                row)
8542591
-{
8542591
-  char *bytes;
8542591
-
8542591
-  ply_window_set_text_cursor_position (pulser->window,
8542591
-                                       column,
8542591
-                                       row);
8542591
-  ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_BROWN);
8542591
-  bytes = malloc (pulser->number_of_columns);
8542591
-  memset (bytes, ' ', pulser->number_of_columns);
8542591
-  write (STDOUT_FILENO, bytes, pulser->number_of_columns);
8542591
-  free (bytes);
ac5e855
+get_os_string (void)
ac5e855
+{
ac5e855
+   int fd;
ac5e855
+   char *buf, *pos, *pos2;
ac5e855
+   struct stat sbuf;
ac5e855
+   
ac5e855
+   fd = open("/etc/system-release", O_RDONLY);
ac5e855
+   if (fd == -1) return;
ac5e855
+   if (fstat(fd, &sbuf) == -1) return;
ac5e855
+   buf = calloc(sbuf.st_size + 1, sizeof(char));
ac5e855
+   read(fd, buf, sbuf.st_size);
ac5e855
+   close(fd);
ac5e855
+   
ac5e855
+   pos = strstr(buf, " release ");
ac5e855
+   if (!pos) goto out;
ac5e855
+   pos2 = strstr(pos, " (");
ac5e855
+   if (!pos2) goto out;
ac5e855
+   *pos = '\0';
ac5e855
+   pos+= 9;
ac5e855
+   *pos2 = '\0';
ac5e855
+   asprintf(&os_string," %s %s", buf, pos);
ac5e855
+out:
ac5e855
+   free(buf);
ac5e855
+}
ac5e855
+
8542591
+/* Hi Will! */
8542591
+static double
8542591
+woodsify(double time, double estimate)
8542591
+{
8542591
+    return 1.0 - pow(2.0, -pow(time, 1.45) / estimate);
8542591
 }
8542591
 
8542591
+#define STARTUP_TIME 20.0
8542591
+
8542591
 static void
8542591
 animate_at_time (ply_text_pulser_t *pulser,
8542591
                  double             time)
8542591
 {
8542591
-  ply_window_set_mode (pulser->window, PLY_WINDOW_MODE_TEXT);
ac5e855
+    int i, width = pulser->number_of_columns - 2 - strlen(os_string);
8542591
+    double brown_fraction, blue_fraction, white_fraction;
8542591
+
8542591
+    ply_window_set_mode (pulser->window, PLY_WINDOW_MODE_TEXT);
8542591
+    ply_window_set_text_cursor_position(pulser->window,
8542591
+					pulser->column,
8542591
+					pulser->row);
8542591
+
8542591
+    brown_fraction = woodsify(time, STARTUP_TIME);
8542591
+    blue_fraction  = woodsify(time, STARTUP_TIME / brown_fraction);
8542591
+    white_fraction = woodsify(time, STARTUP_TIME / blue_fraction);
8542591
+
8542591
+    for (i = 0; i < width; i += 1) {
8542591
+	double f = (double)i / (double)width;
8542591
+	if (f < white_fraction)
8542591
+	    ply_window_set_background_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_WHITE);
8542591
+	else if (f < blue_fraction)
8542591
+	    ply_window_set_background_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_BLUE);
8542591
+	else if (f < brown_fraction)
8542591
+	    ply_window_set_background_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_BROWN);
8542591
+	else break;
8542591
 
8542591
-  draw_trough (pulser, pulser->column, pulser->row);
8542591
+	write (STDOUT_FILENO, " ", strlen (" "));
8542591
+    }
ac5e855
+
ac5e855
+    ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_BLACK);
8542591
 
8542591
-  ply_window_set_text_cursor_position (pulser->window,
8542591
-                                       pulser->column + pulser->spinner_position,
8542591
-                                       pulser->row);
8542591
-  pulser->spinner_position = (pulser->number_of_columns - strlen ("      ") + 1)  * (.5 * sin (time) + .5);
8542591
-  ply_window_set_text_cursor_position (pulser->window,
8542591
-                                       pulser->column + pulser->spinner_position,
8542591
-                                       pulser->row);
8542591
-
8542591
-  ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_GREEN);
8542591
-  write (STDOUT_FILENO, "      ", strlen ("      "));
8542591
-  ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_DEFAULT);
8542591
+    if (brown_fraction > 0.5) {
8542591
+	if (white_fraction > 0.875)
8542591
+	    ply_window_set_foreground_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_WHITE);
8542591
+	else if (blue_fraction > 0.66)
8542591
+	    ply_window_set_foreground_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_BLUE);
8542591
+	else
8542591
+	    ply_window_set_foreground_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_BROWN);
8542591
+
8542591
+	ply_window_set_text_cursor_position(pulser->window,
8542591
+					    pulser->column + width,
8542591
+					    pulser->row);
8542591
+
8542591
+
ac5e855
+	write (STDOUT_FILENO, os_string, strlen(os_string));
8542591
+	
8542591
+	ply_window_set_foreground_color (pulser->window,
8542591
+					 PLY_WINDOW_COLOR_DEFAULT);
8542591
+    }
8542591
 }
8542591
 
8542591
 static void
ac5e855
@@ -161,9 +216,7 @@ on_timeout (ply_text_pulser_t *pulser)
8542591
 bool
8542591
 ply_text_pulser_start (ply_text_pulser_t  *pulser,
8542591
                        ply_event_loop_t   *loop,
8542591
-                       ply_window_t       *window,
8542591
-                       int                 column,
8542591
-                       int                 row)
8542591
+                       ply_window_t       *window)
8542591
 {
8542591
   assert (pulser != NULL);
8542591
   assert (pulser->loop == NULL);
ac5e855
@@ -171,10 +224,14 @@ ply_text_pulser_start (ply_text_pulser_t
8542591
   pulser->loop = loop;
8542591
   pulser->window = window;
8542591
 
8542591
-  pulser->row = row;
8542591
-  pulser->column = column;
8542591
+  pulser->number_of_rows = ply_window_get_number_of_text_rows(window);
8542591
+  pulser->row = pulser->number_of_rows - 1;
8542591
+  pulser->number_of_columns = ply_window_get_number_of_text_columns(window);
8542591
+  pulser->column = 2;
8542591
 
8542591
   pulser->start_time = ply_get_timestamp ();
ac5e855
+  
ac5e855
+  get_os_string ();
8542591
 
ac5e855
   ply_event_loop_watch_for_timeout (pulser->loop,
ac5e855
                                     1.0 / FRAMES_PER_SECOND,
ac5e855
diff -up plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h.textbar plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h
ac5e855
--- plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h.textbar	2008-08-19 15:14:04.000000000 -0400
ac5e855
+++ plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h	2008-09-05 15:19:22.000000000 -0400
8542591
@@ -38,9 +38,7 @@ void ply_text_pulser_free (ply_text_puls
8542591
 bool ply_text_pulser_load (ply_text_pulser_t *pulser);
8542591
 bool ply_text_pulser_start (ply_text_pulser_t  *pulser,
8542591
                             ply_event_loop_t   *loop,
8542591
-                            ply_window_t       *window,
8542591
-                            int                 column,
8542591
-                            int                 row);
8542591
+                            ply_window_t       *window);
8542591
 void ply_text_pulser_stop (ply_text_pulser_t *pulser);
8542591
 
8542591
 int ply_text_pulser_get_number_of_rows (ply_text_pulser_t *pulser);
ac5e855
diff -up plymouth-0.6.0/src/plugins/splash/text/plugin.c.textbar plymouth-0.6.0/src/plugins/splash/text/plugin.c
ac5e855
--- plymouth-0.6.0/src/plugins/splash/text/plugin.c.textbar	2008-08-27 10:57:18.000000000 -0400
ac5e855
+++ plymouth-0.6.0/src/plugins/splash/text/plugin.c	2008-09-05 15:19:22.000000000 -0400
8542591
@@ -105,28 +105,33 @@ start_animation (ply_boot_splash_plugin_
8542591
   assert (plugin->loop != NULL);
8542591
 
8542591
   ply_window_set_color_hex_value (plugin->window,
8542591
+                                  PLY_WINDOW_COLOR_BLACK,
8542591
+                                  0x000000);
8542591
+  ply_window_set_color_hex_value (plugin->window,
8542591
+                                  PLY_WINDOW_COLOR_WHITE,
8542591
+                                  0xffffff);
8542591
+  ply_window_set_color_hex_value (plugin->window,
8542591
+                                  PLY_WINDOW_COLOR_BLUE,
8542591
+                                  0x0073B3);
8542591
+  ply_window_set_color_hex_value (plugin->window,
8542591
                                   PLY_WINDOW_COLOR_BROWN,
8542591
-                                  PLYMOUTH_BACKGROUND_END_COLOR);
8542591
+                                  0x00457E);
8542591
+#if 0
8542591
   ply_window_set_color_hex_value (plugin->window,
8542591
                                   PLY_WINDOW_COLOR_BLUE,
8542591
                                   PLYMOUTH_BACKGROUND_START_COLOR);
8542591
   ply_window_set_color_hex_value (plugin->window,
8542591
                                   PLY_WINDOW_COLOR_GREEN,
8542591
                                   PLYMOUTH_BACKGROUND_COLOR);
8542591
+#endif
8542591
 
8542591
-  ply_window_set_background_color (plugin->window, PLY_WINDOW_COLOR_BLUE);
8542591
+  ply_window_set_background_color (plugin->window, PLY_WINDOW_COLOR_BLACK);
8542591
   ply_window_clear_screen (plugin->window);
8542591
   ply_window_hide_text_cursor (plugin->window);
8542591
 
8542591
-  window_width = ply_window_get_number_of_text_columns (plugin->window);
8542591
-  window_height = ply_window_get_number_of_text_rows (plugin->window);
8542591
-  width = ply_text_pulser_get_number_of_columns (plugin->pulser);
8542591
-  height = ply_text_pulser_get_number_of_rows (plugin->pulser);
8542591
   ply_text_pulser_start (plugin->pulser,
8542591
                          plugin->loop,
8542591
-                         plugin->window,
8542591
-                         window_width / 2.0 - width / 2.0,
8542591
-                         window_height / 2.0 - height / 2.0);
8542591
+                         plugin->window);
8542591
 }
8542591
 
8542591
 static void
ac5e855
diff -up plymouth-0.6.0/scripts/plymouth-populate-initrd.in.foo plymouth-0.6.0/scripts/plymouth-populate-initrd.in
ac5e855
--- plymouth-0.6.0/scripts/plymouth-populate-initrd.in.foo	2008-09-05 15:23:17.000000000 -0400
ac5e855
+++ plymouth-0.6.0/scripts/plymouth-populate-initrd.in	2008-09-05 15:23:51.000000000 -0400
ac5e855
@@ -60,6 +60,7 @@ inst ${BINDIR}/plymouth $INITRDDIR
ac5e855
 inst ${LIBDIR}/plymouth/text.so $INITRDDIR
ac5e855
 inst ${LIBDIR}/plymouth/details.so $INITRDDIR
ac5e855
 inst ${PLYMOUTH_LOGO_FILE} $INITRDDIR
ac5e855
+inst /etc/system-release $INITRDDIR
ac5e855
 mkdir -p ${INITRDDIR}${DATADIR}/plymouth
ac5e855
 
ac5e855
 PLUGIN_NAME=$(plymouth-set-default-plugin)