diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2014-06-11 09:34:15 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2014-06-11 09:36:00 +0300 |
commit | 7284aa23593651e26ab726d375487d3fc55a6863 (patch) | |
tree | 56a81c95ad5fd51072275f762476eaa589c28768 /src/pies.c | |
parent | cf4ab27d35038a7e4b1d5db119729c142b15abb7 (diff) | |
download | pies-7284aa23593651e26ab726d375487d3fc55a6863.tar.gz pies-7284aa23593651e26ab726d375487d3fc55a6863.tar.bz2 |
Init emulator mode; bugfix.
* src/pies.c (main) [INIT_EMU]: Enable "init emulator" mode.
* src/sysvinit.c (enablecomp)
(sysvinit_runlevel_setup): Use struct enstate to pass information
to the callback. This fixes bug introduced by the previous commit,
which caused "wait" keyword to be ignored.
Diffstat (limited to 'src/pies.c')
-rw-r--r-- | src/pies.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -2232,6 +2232,15 @@ main (int argc, char **argv) set_quoting_style (NULL, shell_quoting_style); init_process = getpid () == 1; +#ifdef INIT_EMU +# warning "pies compiled with init emulation code" + if (!init_process) + { + fprintf (stderr, "%s: to enable init emulation code,\n", program_name); + fprintf (stderr, "%s: define environment variable INIT_EMU=<inittab>[:<pies_init_file>]\n", program_name); + init_process = getenv ("INIT_EMU") != NULL; + } +#endif /* Set default logging */ diag_setup (DIAG_TO_SYSLOG | (stderr_closed_p () ? 0 : DIAG_TO_STDERR)); @@ -2239,8 +2248,24 @@ main (int argc, char **argv) config_init (); if (init_process) { +#ifdef INIT_EMU + char *emu = getenv ("INIT_EMU"); + if (emu) + { + char *inittab = strtok (emu, ":"); + char *piesinit = strtok (NULL, ":"); + add_config (CONF_INITTAB, inittab); + add_config (CONF_PIES, piesinit ? piesinit : "/etc/pies.init"); + } + else + { + add_config (CONF_INITTAB, "/etc/inittab"); + add_config (CONF_PIES, "/etc/pies.init"); + } +#else add_config (CONF_INITTAB, "/etc/inittab"); add_config (CONF_PIES, "/etc/pies.init"); +#endif for (index = 1; index < argc; index++) { if (!strcmp(argv[index], "single") || !strcmp(argv[index], "-s")) |