From 39287d08182475cdda8e75584a113e0e2c5cccd8 Mon Sep 17 00:00:00 2001 From: Sergey Bolshakov Date: Fri, 25 May 2007 16:37:51 +0400 Subject: [PATCH] - added /sbin/splash execution, if exists --- Makefile | 3 +++ propagator.spec | 9 +++++++-- stage1.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ff0583f..c30cd5f 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,9 @@ STAGE1_DEFS = ifneq ($(WITH_SHELL),) STAGE1_DEFS += -DSPAWN_SHELL endif +ifneq ($(WITH_SPLASH),) +STAGE1_DEFS += -DSPAWN_SPLASH +endif ifeq ($(WITH_ADSL),) STAGE1_DEFS += -DDISABLE_ADSL endif diff --git a/propagator.spec b/propagator.spec index b7f8349..b92398c 100644 --- a/propagator.spec +++ b/propagator.spec @@ -1,8 +1,9 @@ %def_with shell +%def_with splash Name: propagator Version: 20070301 -Release: alt3 +Release: alt4 Summary: 'Early userspace' set of binaries License: GPL @@ -20,7 +21,8 @@ including init and various helpers for hw probing and bootstrapping. %setup -c %build -make %{?_with_shell:WITH_SHELL=t} LIBDIR=%_libdir CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" +make %{?_with_shell:WITH_SHELL=t} %{?_with_splash:WITH_SPLASH=t} \ + LIBDIR=%_libdir CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" %install %make_install DESTDIR=%buildroot LIBDIR=%_libdir install @@ -30,6 +32,9 @@ make %{?_with_shell:WITH_SHELL=t} LIBDIR=%_libdir CFLAGS="$RPM_OPT_FLAGS -D_GNU_ %_libdir/%name %changelog +* Fri May 25 2007 Sergey Bolshakov 20070301-alt4 +- spawn animated splash, if possible + * Wed Apr 18 2007 Sergey Bolshakov 20070301-alt3 - do not warn user after insmod'ing already existing module, closes \#11549 diff --git a/stage1.c b/stage1.c index 8c40514..0c6b2b7 100644 --- a/stage1.c +++ b/stage1.c @@ -107,6 +107,7 @@ void stg1_info_message(char *msg, ...) /************************************************************ * spawns a shell on console #2 */ static pid_t shell_pid = 0; +static pid_t splash_pid = 0; static void spawn_shell(void) { @@ -147,6 +148,37 @@ static void spawn_shell(void) #endif } +static void spawn_splash(void) +{ +#ifdef SPAWN_SPLASH + int fd; + char * splash_name[] = { "/sbin/splash", NULL }; + + log_message("spawning a splash screen"); + fd = open("/dev/null", O_RDWR); + if (fd == -1) { + log_message("cannot open /dev/null"); + return; + } + else if (access(splash_name[0], X_OK)) { + log_message("%s doesn't exist", splash_name[0]); + return; + } + + if (!(splash_pid = fork())) { + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + close(fd); + setsid(); + execve(splash_name[0], splash_name, NULL); + log_message("execve of %s failed: %s", splash_name[0], strerror(errno)); + exit(-1); + } + + close(fd); +#endif +} char * interactive_fifo = "/tmp/stage1-fifo"; static pid_t interactive_pid = 0; @@ -392,6 +424,7 @@ int main(int argc, char **argv, char **env) process_cmdline(); handle_env(env); spawn_shell(); + spawn_splash(); prepare_progress(); update_splash(); init_modules_insmoding(); @@ -432,6 +465,9 @@ int main(int argc, char **argv, char **env) if (shell_pid != 0) kill(shell_pid, 9); + + if (splash_pid != 0) + kill(splash_pid, 9); pass_env(4);