- added /sbin/splash execution, if exists

This commit is contained in:
Sergey Bolshakov 2007-05-25 16:37:51 +04:00
parent 388464dd56
commit 39287d0818
3 changed files with 46 additions and 2 deletions

View File

@ -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

View File

@ -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 <sbolshakov@altlinux.ru> 20070301-alt4
- spawn animated splash, if possible
* Wed Apr 18 2007 Sergey Bolshakov <sbolshakov@altlinux.ru> 20070301-alt3
- do not warn user after insmod'ing already existing module, closes \#11549

View File

@ -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);