From: Lennart Poettering Date: Tue, 29 Mar 2011 22:43:16 +0000 (+0200) Subject: unit: never apply /etc/rcN.d/ priority to native services X-Git-Tag: v21~6 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=ea87ca5a9ee9c82b456a54747d442c715ff26bee unit: never apply /etc/rcN.d/ priority to native services --- diff --git a/TODO b/TODO index 4302eeefe..4759fcdd8 100644 --- a/TODO +++ b/TODO @@ -2,8 +2,6 @@ F15: * swap units that are activated by one name but shown in the kernel under another are semi-broken -* dep cycle basic → udev-retry → auditd → iptables → basic - * isolate multi-user.target doesn't start a getty@tty1 if we run it from graphical.target * NFS, networkmanager ordering issue (PENDING) diff --git a/src/service.c b/src/service.c index fd3a9c94e..c74e8a009 100644 --- a/src/service.c +++ b/src/service.c @@ -115,6 +115,7 @@ static void service_init(Unit *u) { s->timer_watch.type = WATCH_INVALID; #ifdef HAVE_SYSV_COMPAT s->sysv_start_priority = -1; + s->sysv_start_priority_from_rcnd = -1; #endif s->socket_fd = -1; s->guess_main_pid = true; @@ -537,7 +538,7 @@ static int service_load_sysv_path(Service *s, const char *path) { * data from the LSB header. */ if (start_priority < 0 || start_priority > 99) log_warning("[%s:%u] Start priority out of range. Ignoring.", path, line); - else if (s->sysv_start_priority < 0) + else s->sysv_start_priority = start_priority; char_array_0(runlevels); @@ -853,6 +854,12 @@ static int service_load_sysv_path(Service *s, const char *path) { u->meta.description = d; } + /* The priority that has been set in /etc/rcN.d/ hierarchies + * takes precedence over what is stored as default in the LSB + * header */ + if (s->sysv_start_priority_from_rcnd >= 0) + s->sysv_start_priority = s->sysv_start_priority_from_rcnd; + u->meta.load_state = UNIT_LOADED; r = 0; @@ -3009,8 +3016,8 @@ static int service_enumerate(Manager *m) { if (de->d_name[0] == 'S') { if (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_start_priority_from_rcnd = + MAX(a*10 + b, SERVICE(service)->sysv_start_priority_from_rcnd); SERVICE(service)->sysv_enabled = true; } diff --git a/src/service.h b/src/service.h index 627b356e2..e3cb431cf 100644 --- a/src/service.h +++ b/src/service.h @@ -138,6 +138,7 @@ struct Service { #ifdef HAVE_SYSV_COMPAT bool sysv_has_lsb:1; bool sysv_enabled:1; + int sysv_start_priority_from_rcnd; int sysv_start_priority; char *sysv_path;