chiark / gitweb /
service: hide output of sysv scripts if quiet is passed on the kernel cmdline
[elogind.git] / src / service.c
index ee1da2a7b32bcb1d746e3e36a28f0eedd69815ea..c052d7cdcbc291363c38a405424d5221e0ebe96b 100644 (file)
@@ -566,7 +566,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
 
                                         if (unit_name_to_type(m) == UNIT_SERVICE)
                                                 r = unit_add_name(u, m);
-                                        else if (s->sysv_start_priority >= 0)
+                                        else if (s->sysv_enabled)
                                                 r = unit_add_two_dependencies_by_name_inverse(u, UNIT_AFTER, UNIT_WANTS, m, NULL, true);
                                         else
                                                 r = unit_add_dependency_by_name_inverse(u, UNIT_AFTER, m, NULL, true);
@@ -708,7 +708,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
         s->type = SERVICE_FORKING;
         s->valid_no_process = true;
         s->restart = SERVICE_ONCE;
-        s->exec_context.std_output = EXEC_OUTPUT_TTY;
+        s->exec_context.std_output = s->meta.manager->sysv_console ? EXEC_OUTPUT_TTY : EXEC_OUTPUT_NULL;
         s->exec_context.kill_mode = KILL_PROCESS_GROUP;
 
         u->meta.load_state = UNIT_LOADED;
@@ -952,12 +952,14 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
                 "%sRootDirectoryStartOnly: %s\n"
                 "%sValidNoProcess: %s\n"
                 "%sType: %s\n"
+                "%sRestart: %s\n"
                 "%sNotifyAccess: %s\n",
                 prefix, service_state_to_string(s->state),
                 prefix, yes_no(s->permissions_start_only),
                 prefix, yes_no(s->root_directory_start_only),
                 prefix, yes_no(s->valid_no_process),
                 prefix, service_type_to_string(s->type),
+                prefix, service_restart_to_string(s->restart),
                 prefix, notify_access_to_string(s->notify_access));
 
         if (s->control_pid > 0)
@@ -1004,8 +1006,10 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
 
         if (s->sysv_start_priority >= 0)
                 fprintf(f,
-                        "%sSysVStartPriority: %i\n",
-                        prefix, s->sysv_start_priority);
+                        "%sSysVStartPriority: %i\n"
+                        "%sSysVEnabled: %s\n",
+                        prefix, s->sysv_start_priority,
+                        prefix, yes_no(s->sysv_enabled));
 
         if (s->sysv_runlevels)
                 fprintf(f, "%sSysVRunLevels: %s\n",
@@ -2625,9 +2629,11 @@ static int service_enumerate(Manager *m) {
                                 }
 
                                 if (de->d_name[0] == 'S' &&
-                                    (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT))
+                                    (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT)) {
                                         SERVICE(service)->sysv_start_priority =
                                                 MAX(a*10 + b, SERVICE(service)->sysv_start_priority);
+                                        SERVICE(service)->sysv_enabled = true;
+                                }
 
                                 manager_dispatch_load_queue(m);
                                 service = unit_follow_merge(service);