appending noinitd=xdm will skip the xdm service when first booting, #181858.

This commit is contained in:
Roy Marples 2007-07-23 11:36:12 +00:00
parent f1f5b0c367
commit af2d9995d7
2 changed files with 77 additions and 26 deletions

View File

@ -1,6 +1,10 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts # ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2 # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
23 Jul 2007; Roy Marples <uberlord@gentoo.org>:
appending noinitd=xdm will skip the xdm service when first booting, #181858.
22 Jul 2007; Roy Marples <uberlord@gentoo.org>: 22 Jul 2007; Roy Marples <uberlord@gentoo.org>:
Harden gendepends.sh some more so we only capture the stdout we want from Harden gendepends.sh some more so we only capture the stdout we want from

View File

@ -337,6 +337,44 @@ static int do_options (int argc, char **argv)
return (ok ? EXIT_SUCCESS : EXIT_FAILURE); return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
} }
#ifdef __linux__
static char *proc_getent (const char *ent)
{
FILE *fp;
char buffer[RC_LINEBUFFER];
char *p;
char *value = NULL;
int i;
if (! (fp = fopen ("/proc/cmdline", "r"))) {
eerror ("failed to open `/proc/cmdline': %s", strerror (errno));
return (NULL);
}
memset (buffer, 0, sizeof (buffer));
if (fgets (buffer, RC_LINEBUFFER, fp) &&
(p = strstr (buffer, ent)))
{
i = p - buffer;
if (i == '\0' || buffer[i - 1] == ' ') {
/* Trim the trailing carriage return if present */
i = strlen (buffer) - 1;
if (buffer[i] == '\n')
buffer[i] = 0;
p += strlen (ent);
if (*p == '=')
p++;
value = strdup (strsep (&p, " "));
}
} else
errno = ENOENT;
fclose (fp);
return (value);
}
#endif
static char read_key (bool block) static char read_key (bool block)
{ {
struct termios termios; struct termios termios;
@ -798,7 +836,7 @@ int main (int argc, char **argv)
/* OK, we're either in runlevel 1 or single user mode */ /* OK, we're either in runlevel 1 or single user mode */
struct utsname uts; struct utsname uts;
#ifdef __linux__ #ifdef __linux__
FILE *fp; char *cmd;
#endif #endif
/* exec init-early.sh if it exists /* exec init-early.sh if it exists
@ -824,34 +862,14 @@ int main (int argc, char **argv)
rc_plugin_run (rc_hook_runlevel_start_in, newlevel); rc_plugin_run (rc_hook_runlevel_start_in, newlevel);
run_script (INITSH); run_script (INITSH);
/* If we requested a softlevel, save it now */
#ifdef __linux__ #ifdef __linux__
/* If we requested a softlevel, save it now */
set_ksoftlevel (NULL); set_ksoftlevel (NULL);
if ((cmd = proc_getent ("softlevel"))) {
if ((fp = fopen ("/proc/cmdline", "r"))) { set_ksoftlevel (cmd);
char buffer[RC_LINEBUFFER]; free (cmd);
char *soft;
memset (buffer, 0, sizeof (buffer));
if (fgets (buffer, RC_LINEBUFFER, fp) &&
(soft = strstr (buffer, "softlevel=")))
{
i = soft - buffer;
if (i == 0 || buffer[i - 1] == ' ') {
char *level;
/* Trim the trailing carriage return if present */
i = strlen (buffer) - 1;
if (buffer[i] == '\n')
buffer[i] = 0;
soft += strlen ("softlevel=");
level = strsep (&soft, " ");
set_ksoftlevel (level);
}
}
fclose (fp);
} }
#endif #endif
rc_plugin_run (rc_hook_runlevel_start_out, newlevel); rc_plugin_run (rc_hook_runlevel_start_out, newlevel);
@ -1209,6 +1227,21 @@ int main (int argc, char **argv)
start_services = deporder; start_services = deporder;
deporder = NULL; deporder = NULL;
#ifdef __linux__
/* mark any services skipped as started */
if (PREVLEVEL && strcmp (PREVLEVEL, "N") == 0) {
if ((service = proc_getent ("noinitd"))) {
char *p = service;
char *token;
while ((token = strsep (&p, ",")))
rc_mark_service (token, rc_service_started);
free (service);
}
}
#endif
STRLIST_FOREACH (start_services, service, i) { STRLIST_FOREACH (start_services, service, i) {
if (rc_service_state (service, rc_service_stopped)) { if (rc_service_state (service, rc_service_stopped)) {
pid_t pid; pid_t pid;
@ -1250,6 +1283,20 @@ interactive_option:
rc_plugin_run (rc_hook_runlevel_start_out, runlevel); rc_plugin_run (rc_hook_runlevel_start_out, runlevel);
#ifdef __linux__
/* mark any services skipped as stopped */
if (PREVLEVEL && strcmp (PREVLEVEL, "N") == 0) {
if ((service = proc_getent ("noinitd"))) {
char *p = service;
char *token;
while ((token = strsep (&p, ",")))
rc_mark_service (token, rc_service_stopped);
free (service);
}
}
#endif
/* Store our interactive status for boot */ /* Store our interactive status for boot */
if (interactive && strcmp (runlevel, bootlevel) == 0) if (interactive && strcmp (runlevel, bootlevel) == 0)
mark_interactive (); mark_interactive ();