summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rwxr-xr-xscripts/plymouth-update-initrd3
-rw-r--r--src/splash-plugins/Makefile.am2
-rw-r--r--src/splash-plugins/text/Makefile.am16
-rw-r--r--src/splash-plugins/text/text.c175
5 files changed, 195 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 6b99644..6dfe974 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,6 +46,7 @@ AC_OUTPUT([Makefile
src/libply/Makefile
src/splash-plugins/Makefile
src/splash-plugins/fedora-fade-in/Makefile
+ src/splash-plugins/text/Makefile
src/Makefile
src/rhgb-client/Makefile
src/tests/Makefile
diff --git a/scripts/plymouth-update-initrd b/scripts/plymouth-update-initrd
index 1632d04..98849f0 100755
--- a/scripts/plymouth-update-initrd
+++ b/scripts/plymouth-update-initrd
@@ -31,7 +31,7 @@ TMPDIR="$(mktemp -d $PWD/initrd.XXXXXXXXXX)"
zcat $INITRD | cpio --quiet -Hnewc -i --make-directories
sed -i -e 's@^#!\(.*\)@#!/bin/plymouth \1@' init
(cd $LIBDIR
- DEPS=$(get_lib_deps ${LIBEXECDIR}/plymouth/plymouth ${LIBDIR}/plymouth/fedora-fade-in.so)
+ DEPS=$(get_lib_deps ${LIBEXECDIR}/plymouth/plymouth ${LIBDIR}/plymouth/fedora-fade-in.so ${LIBDIR}/plymouth/text.so)
for dep in $DEPS; do
install -D -m755 $dep ${TMPDIR}$(dirname $dep)
done
@@ -48,6 +48,7 @@ TMPDIR="$(mktemp -d $PWD/initrd.XXXXXXXXXX)"
mkdir -p ${TMPDIR}${LIBDIR}/plymouth
install -m755 ${LIBDIR}/plymouth/fedora-fade-in.so ${TMPDIR}${LIBDIR}/plymouth
+ install -m755 ${LIBDIR}/plymouth/text.so ${TMPDIR}${LIBDIR}/plymouth
rm -f $NEW_INITRD
find | cpio --quiet -Hnewc -o | gzip -9 > $NEW_INITRD
diff --git a/src/splash-plugins/Makefile.am b/src/splash-plugins/Makefile.am
index 47cbdf2..19de569 100644
--- a/src/splash-plugins/Makefile.am
+++ b/src/splash-plugins/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = fedora-fade-in tests
+SUBDIRS = fedora-fade-in text tests
MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/splash-plugins/text/Makefile.am b/src/splash-plugins/text/Makefile.am
new file mode 100644
index 0000000..0a0552a
--- /dev/null
+++ b/src/splash-plugins/text/Makefile.am
@@ -0,0 +1,16 @@
+INCLUDES = -I$(top_srcdir) \
+ -I$(srcdir)/../../libply \
+ -I$(srcdir)/../.. \
+ -I$(srcdir)/.. \
+ -I$(srcdir)
+
+plugindir = $(libdir)/plymouth
+plugin_LTLIBRARIES = text.la
+
+text_la_CFLAGS = $(PLYMOUTH_CFLAGS)
+text_la_LDFLAGS = -module -avoid-version -export-dynamic
+text_la_LIBADD = $(PLYMOUTH_LIBS) ../../libply/libply.la
+text_la_SOURCES = $(srcdir)/../../ply-boot-splash-plugin.h \
+ $(srcdir)/text.c
+
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/splash-plugins/text/text.c b/src/splash-plugins/text/text.c
new file mode 100644
index 0000000..96b17b6
--- /dev/null
+++ b/src/splash-plugins/text/text.c
@@ -0,0 +1,175 @@
+/* text.c - boot splash plugin
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by: Ray Strode <rstrode@redhat.com>
+ */
+#include "config.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <values.h>
+#include <unistd.h>
+
+#include "ply-boot-splash-plugin.h"
+#include "ply-event-loop.h"
+#include "ply-list.h"
+#include "ply-logger.h"
+#include "ply-frame-buffer.h"
+#include "ply-image.h"
+#include "ply-utils.h"
+
+
+#include <linux/kd.h>
+
+struct _ply_boot_splash_plugin
+{
+ ply_event_loop_t *loop;
+
+ int console_fd;
+};
+
+ply_boot_splash_plugin_t *
+create_plugin (void)
+{
+ ply_boot_splash_plugin_t *plugin;
+
+ ply_trace ("creating plugin");
+
+ plugin = calloc (1, sizeof (ply_boot_splash_plugin_t));
+ plugin->console_fd = -1;
+
+ return plugin;
+}
+
+void
+destroy_plugin (ply_boot_splash_plugin_t *plugin)
+{
+ ply_trace ("destroying plugin");
+
+ if (plugin == NULL)
+ return;
+
+ free (plugin);
+}
+
+static bool
+open_console (ply_boot_splash_plugin_t *plugin)
+{
+ assert (plugin != NULL);
+
+ plugin->console_fd = open ("/dev/tty1", O_RDWR | O_APPEND | O_NOCTTY);
+
+ if (plugin->console_fd < 0)
+ return false;
+
+ return true;
+}
+
+static void
+close_console (ply_boot_splash_plugin_t *plugin)
+{
+ ply_trace ("closing console");
+ close (plugin->console_fd);
+ plugin->console_fd = -1;
+}
+
+bool
+show_splash_screen (ply_boot_splash_plugin_t *plugin)
+{
+ assert (plugin != NULL);
+
+ ply_trace ("opening console");
+ if (!open_console (plugin))
+ return false;
+
+ return true;
+}
+
+void
+update_status (ply_boot_splash_plugin_t *plugin,
+ const char *status)
+{
+ assert (plugin != NULL);
+
+ ply_trace ("status update");
+ write (plugin->console_fd, ".", 1);
+}
+
+static void
+detach_from_event_loop (ply_boot_splash_plugin_t *plugin)
+{
+ plugin->loop = NULL;
+
+ ply_trace ("detaching from event loop");
+}
+
+void
+hide_splash_screen (ply_boot_splash_plugin_t *plugin)
+{
+ assert (plugin != NULL);
+
+ ply_trace ("hiding splash screen");
+
+ ply_event_loop_stop_watching_for_exit (plugin->loop,
+ detach_from_event_loop,
+ plugin);
+ detach_from_event_loop (plugin);
+}
+
+void
+attach_to_event_loop (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop)
+{
+ plugin->loop = loop;
+
+ ply_trace ("attaching to event loop");
+ ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
+ detach_from_event_loop,
+ plugin);
+}
+
+ply_boot_splash_plugin_interface_t *
+ply_boot_splash_plugin_get_interface (void)
+{
+ static ply_boot_splash_plugin_interface_t plugin_interface =
+ {
+ .create_plugin = create_plugin,
+ .destroy_plugin = destroy_plugin,
+ .show_splash_screen = show_splash_screen,
+ .update_status = update_status,
+ .hide_splash_screen = hide_splash_screen,
+ .attach_to_event_loop = attach_to_event_loop
+ };
+
+ return &plugin_interface;
+}
+
+/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */