rc-status now orders services in start order, #195630

This commit is contained in:
Roy Marples 2007-10-15 11:17:57 +00:00
parent 8ec450eff7
commit f95e75f0e9
2 changed files with 20 additions and 1 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
15 Oct 2007; Roy Marples <uberlord@gentoo.org>:
rc-status now orders services in start order, #195630
* baselayout-2.0.0_rc5 (11 Oct 2007) * baselayout-2.0.0_rc5 (11 Oct 2007)
11 Oct 2007; Roy Marples <uberlord@gentoo.org>: 11 Oct 2007; Roy Marples <uberlord@gentoo.org>:

View File

@ -19,6 +19,8 @@
#define APPLET "rc-status" #define APPLET "rc-status"
static char const *types[] = { "ineed", "iuse", "iafter", NULL };
static void print_level (char *level) static void print_level (char *level)
{ {
printf ("Runlevel: %s%s%s\n", printf ("Runlevel: %s%s%s\n",
@ -81,8 +83,10 @@ static const char * const longopts_help[] = {
int rc_status (int argc, char **argv) int rc_status (int argc, char **argv)
{ {
rc_depinfo_t *deptree = NULL;
char **levels = NULL; char **levels = NULL;
char **services = NULL; char **services = NULL;
char **ordered = NULL;
char *level; char *level;
char *service; char *service;
int opt; int opt;
@ -135,15 +139,26 @@ int rc_status (int argc, char **argv)
free (level); free (level);
} }
/* Output the services in the order in which they would start */
deptree = rc_deptree_load ();
STRLIST_FOREACH (levels, level, i) { STRLIST_FOREACH (levels, level, i) {
print_level (level); print_level (level);
services = rc_services_in_runlevel (level); services = rc_services_in_runlevel (level);
if (deptree) {
ordered = rc_deptree_depends (deptree, (char **) types, services,
level, RC_DEP_STRICT | RC_DEP_START);
rc_strlist_free (services);
services = ordered;
ordered = NULL;
}
STRLIST_FOREACH (services, service, j) STRLIST_FOREACH (services, service, j)
print_service (service); if (rc_service_in_runlevel (service, level))
print_service (service);
rc_strlist_free (services); rc_strlist_free (services);
} }
rc_strlist_free (levels); rc_strlist_free (levels);
rc_deptree_free (deptree);
return (EXIT_SUCCESS); return (EXIT_SUCCESS);
} }