From 2a77d31df976c3934e3b38a9e61c000ec9a8acc2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 29 Oct 2010 06:04:03 +0200 Subject: [PATCH] units: order units by default before appropriate targets in case they are pulled indirectly --- src/automount.c | 3 +++ src/path.c | 6 +++++- src/socket.c | 6 +++++- src/timer.c | 6 +++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/automount.c b/src/automount.c index 462f3170..b45cbcf5 100644 --- a/src/automount.c +++ b/src/automount.c @@ -154,6 +154,9 @@ static int automount_add_default_dependencies(Automount *a) { if (a->meta.manager->running_as == MANAGER_SYSTEM) { + if ((r = unit_add_dependency_by_name(UNIT(a), UNIT_BEFORE, SPECIAL_BASIC_TARGET, NULL, true)) < 0) + return r; + if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0) return r; } diff --git a/src/path.c b/src/path.c index 1d6f98cf..f62157e8 100644 --- a/src/path.c +++ b/src/path.c @@ -106,9 +106,13 @@ static int path_add_default_dependencies(Path *p) { assert(p); - if (p->meta.manager->running_as == MANAGER_SYSTEM) + if (p->meta.manager->running_as == MANAGER_SYSTEM) { + if ((r = unit_add_dependency_by_name(UNIT(p), UNIT_BEFORE, SPECIAL_BASIC_TARGET, NULL, true)) < 0) + return r; + if ((r = unit_add_two_dependencies_by_name(UNIT(p), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0) return r; + } return unit_add_two_dependencies_by_name(UNIT(p), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true); } diff --git a/src/socket.c b/src/socket.c index 6d2df958..9662066c 100644 --- a/src/socket.c +++ b/src/socket.c @@ -301,9 +301,13 @@ static int socket_add_default_dependencies(Socket *s) { int r; assert(s); - if (s->meta.manager->running_as == MANAGER_SYSTEM) + if (s->meta.manager->running_as == MANAGER_SYSTEM) { + if ((r = unit_add_dependency_by_name(UNIT(s), UNIT_BEFORE, SPECIAL_SOCKETS_TARGET, NULL, true)) < 0) + return r; + if ((r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0) return r; + } return unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true); } diff --git a/src/timer.c b/src/timer.c index 065e9c14..6f1f02dd 100644 --- a/src/timer.c +++ b/src/timer.c @@ -78,9 +78,13 @@ static int timer_add_default_dependencies(Timer *t) { assert(t); - if (t->meta.manager->running_as == MANAGER_SYSTEM) + if (t->meta.manager->running_as == MANAGER_SYSTEM) { + if ((r = unit_add_dependency_by_name(UNIT(t), UNIT_BEFORE, SPECIAL_BASIC_TARGET, NULL, true)) < 0) + return r; + if ((r = unit_add_two_dependencies_by_name(UNIT(t), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true)) < 0) return r; + } return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true); } -- 2.39.5