Put /etc/system-release on the initrd, and read that instead of hardcoding

'Fedora 10'.
This commit is contained in:
Bill Nottingham 2008-09-05 19:39:41 +00:00
parent 46974c014a
commit ac5e8555ae
2 changed files with 70 additions and 22 deletions

View File

@ -1,7 +1,7 @@
diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c
--- plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx 2008-06-30 17:51:25.000000000 -0400
+++ plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c 2008-08-12 12:44:42.000000000 -0400
@@ -50,7 +50,7 @@
diff -up plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c.textbar plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c
--- plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c.textbar 2008-08-19 15:14:04.000000000 -0400
+++ plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c 2008-09-05 15:21:28.000000000 -0400
@@ -50,11 +50,14 @@
#include <linux/kd.h>
#ifndef FRAMES_PER_SECOND
@ -10,7 +10,14 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
#endif
#define NUMBER_OF_INDICATOR_COLUMNS 6
@@ -75,13 +75,11 @@ ply_text_pulser_new (void)
+#define OS_STRING " "
+char *os_string = OS_STRING;
+
struct _ply_text_pulser
{
ply_event_loop_t *loop;
@@ -75,13 +78,11 @@ ply_text_pulser_new (void)
pulser = calloc (1, sizeof (ply_text_pulser_t));
@ -26,11 +33,10 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
return pulser;
}
@@ -95,42 +93,71 @@ ply_text_pulser_free (ply_text_pulser_t
free (pulser);
@@ -96,41 +97,95 @@ ply_text_pulser_free (ply_text_pulser_t
}
-static void
static void
-draw_trough (ply_text_pulser_t *pulser,
- int column,
- int row)
@ -45,6 +51,31 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
- memset (bytes, ' ', pulser->number_of_columns);
- write (STDOUT_FILENO, bytes, pulser->number_of_columns);
- free (bytes);
+get_os_string (void)
+{
+ int fd;
+ char *buf, *pos, *pos2;
+ struct stat sbuf;
+
+ fd = open("/etc/system-release", O_RDONLY);
+ if (fd == -1) return;
+ if (fstat(fd, &sbuf) == -1) return;
+ buf = calloc(sbuf.st_size + 1, sizeof(char));
+ read(fd, buf, sbuf.st_size);
+ close(fd);
+
+ pos = strstr(buf, " release ");
+ if (!pos) goto out;
+ pos2 = strstr(pos, " (");
+ if (!pos2) goto out;
+ *pos = '\0';
+ pos+= 9;
+ *pos2 = '\0';
+ asprintf(&os_string," %s %s", buf, pos);
+out:
+ free(buf);
+}
+
+/* Hi Will! */
+static double
+woodsify(double time, double estimate)
@ -53,14 +84,13 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
}
+#define STARTUP_TIME 20.0
+#define OS_STRING " Fedora 10"
+
static void
animate_at_time (ply_text_pulser_t *pulser,
double time)
{
- ply_window_set_mode (pulser->window, PLY_WINDOW_MODE_TEXT);
+ int i, width = pulser->number_of_columns - 2 - strlen(OS_STRING);
+ int i, width = pulser->number_of_columns - 2 - strlen(os_string);
+ double brown_fraction, blue_fraction, white_fraction;
+
+ ply_window_set_mode (pulser->window, PLY_WINDOW_MODE_TEXT);
@ -88,6 +118,8 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
- draw_trough (pulser, pulser->column, pulser->row);
+ write (STDOUT_FILENO, " ", strlen (" "));
+ }
+
+ ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_BLACK);
- ply_window_set_text_cursor_position (pulser->window,
- pulser->column + pulser->spinner_position,
@ -100,8 +132,6 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
- ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_GREEN);
- write (STDOUT_FILENO, " ", strlen (" "));
- ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_DEFAULT);
+ ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_BLACK);
+
+ if (brown_fraction > 0.5) {
+ if (white_fraction > 0.875)
+ ply_window_set_foreground_color (pulser->window,
@ -118,7 +148,7 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
+ pulser->row);
+
+
+ write (STDOUT_FILENO, OS_STRING, strlen(OS_STRING));
+ write (STDOUT_FILENO, os_string, strlen(os_string));
+
+ ply_window_set_foreground_color (pulser->window,
+ PLY_WINDOW_COLOR_DEFAULT);
@ -126,7 +156,7 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
}
static void
@@ -161,9 +188,7 @@ on_timeout (ply_text_pulser_t *pulser)
@@ -161,9 +216,7 @@ on_timeout (ply_text_pulser_t *pulser)
bool
ply_text_pulser_start (ply_text_pulser_t *pulser,
ply_event_loop_t *loop,
@ -137,7 +167,7 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
{
assert (pulser != NULL);
assert (pulser->loop == NULL);
@@ -171,8 +196,10 @@ ply_text_pulser_start (ply_text_pulser_t
@@ -171,10 +224,14 @@ ply_text_pulser_start (ply_text_pulser_t
pulser->loop = loop;
pulser->window = window;
@ -149,10 +179,14 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0
+ pulser->column = 2;
pulser->start_time = ply_get_timestamp ();
+
+ get_os_string ();
diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h.jx plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h
--- plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h.jx 2008-06-21 23:48:59.000000000 -0400
+++ plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h 2008-08-12 12:36:51.000000000 -0400
ply_event_loop_watch_for_timeout (pulser->loop,
1.0 / FRAMES_PER_SECOND,
diff -up plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h.textbar plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h
--- plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h.textbar 2008-08-19 15:14:04.000000000 -0400
+++ plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h 2008-09-05 15:19:22.000000000 -0400
@@ -38,9 +38,7 @@ void ply_text_pulser_free (ply_text_puls
bool ply_text_pulser_load (ply_text_pulser_t *pulser);
bool ply_text_pulser_start (ply_text_pulser_t *pulser,
@ -164,9 +198,9 @@ diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h.jx plymouth-0.5.0
void ply_text_pulser_stop (ply_text_pulser_t *pulser);
int ply_text_pulser_get_number_of_rows (ply_text_pulser_t *pulser);
diff -up plymouth-0.5.0/src/splash-plugins/text/plugin.c.jx plymouth-0.5.0/src/splash-plugins/text/plugin.c
--- plymouth-0.5.0/src/plugins/splash/text/plugin.c.jx 2008-07-29 15:15:51.000000000 -0400
+++ plymouth-0.5.0/src/plugins/splash/text/plugin.c 2008-08-12 12:36:51.000000000 -0400
diff -up plymouth-0.6.0/src/plugins/splash/text/plugin.c.textbar plymouth-0.6.0/src/plugins/splash/text/plugin.c
--- plymouth-0.6.0/src/plugins/splash/text/plugin.c.textbar 2008-08-27 10:57:18.000000000 -0400
+++ plymouth-0.6.0/src/plugins/splash/text/plugin.c 2008-09-05 15:19:22.000000000 -0400
@@ -105,28 +105,33 @@ start_animation (ply_boot_splash_plugin_
assert (plugin->loop != NULL);
@ -210,3 +244,14 @@ diff -up plymouth-0.5.0/src/splash-plugins/text/plugin.c.jx plymouth-0.5.0/src/s
}
static void
diff -up plymouth-0.6.0/scripts/plymouth-populate-initrd.in.foo plymouth-0.6.0/scripts/plymouth-populate-initrd.in
--- plymouth-0.6.0/scripts/plymouth-populate-initrd.in.foo 2008-09-05 15:23:17.000000000 -0400
+++ plymouth-0.6.0/scripts/plymouth-populate-initrd.in 2008-09-05 15:23:51.000000000 -0400
@@ -60,6 +60,7 @@ inst ${BINDIR}/plymouth $INITRDDIR
inst ${LIBDIR}/plymouth/text.so $INITRDDIR
inst ${LIBDIR}/plymouth/details.so $INITRDDIR
inst ${PLYMOUTH_LOGO_FILE} $INITRDDIR
+inst /etc/system-release $INITRDDIR
mkdir -p ${INITRDDIR}${DATADIR}/plymouth
PLUGIN_NAME=$(plymouth-set-default-plugin)

View File

@ -1,7 +1,7 @@
Summary: Plymouth Graphical Boot Animation and Logger
Name: plymouth
Version: 0.6.0
Release: 0.2008.09.05.2%{?dist}
Release: 0.2008.09.05.3%{?dist}
License: GPLv2+
Group: System Environment/Base
Source0: http://freedesktop.org/software/plymouth/releases/%{name}-%{version}.tar.bz2
@ -226,6 +226,9 @@ fi
%{_libdir}/plymouth/spinfinity.so
%changelog
* Fri Sep 5 2008 Bill Nottingham <notting@redhat.com> 0.6.0-0.2008.09.05.3
- make the text plugin use the system release info rather than a hardcoded 'Fedora 10'
* Fri Sep 5 2008 Ray Strode <rstrode@redhat.com> 0.5.0-0.2008.09.05.2
- Try to support multiple serial consoles better
(bug 460565)