|
|
a52f674 |
From aadac335f8f9ab693fb671f2ad9490ceb33c820a Mon Sep 17 00:00:00 2001
|
|
|
b12ff75 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
b12ff75 |
Date: Thu, 5 Dec 2013 00:41:12 -0500
|
|
|
b12ff75 |
Subject: [PATCH] systemd: add a start job for all units specified with
|
|
|
b12ff75 |
SYSTEMD_WANTS=
|
|
|
b12ff75 |
|
|
|
b12ff75 |
---
|
|
|
b12ff75 |
src/core/device.c | 14 +++++++++++---
|
|
|
b12ff75 |
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
|
b12ff75 |
|
|
|
b12ff75 |
diff --git a/src/core/device.c b/src/core/device.c
|
|
|
b12ff75 |
index 5397bd6..610fe88 100644
|
|
|
b12ff75 |
--- a/src/core/device.c
|
|
|
b12ff75 |
+++ b/src/core/device.c
|
|
|
b12ff75 |
@@ -281,7 +281,8 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
|
|
|
b12ff75 |
size_t l;
|
|
|
b12ff75 |
|
|
|
b12ff75 |
FOREACH_WORD_QUOTED(w, l, wants, state) {
|
|
|
b12ff75 |
- char *e, *n;
|
|
|
b12ff75 |
+ _cleanup_free_ char *e, *n = NULL;
|
|
|
b12ff75 |
+ Unit *other;
|
|
|
b12ff75 |
|
|
|
b12ff75 |
e = strndup(w, l);
|
|
|
b12ff75 |
if (!e) {
|
|
|
b12ff75 |
@@ -293,12 +294,19 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
|
|
|
b12ff75 |
r = -ENOMEM;
|
|
|
b12ff75 |
goto fail;
|
|
|
b12ff75 |
}
|
|
|
b12ff75 |
- free(e);
|
|
|
b12ff75 |
|
|
|
b12ff75 |
r = unit_add_dependency_by_name(u, UNIT_WANTS, n, NULL, true);
|
|
|
b12ff75 |
- free(n);
|
|
|
b12ff75 |
if (r < 0)
|
|
|
b12ff75 |
goto fail;
|
|
|
b12ff75 |
+
|
|
|
b12ff75 |
+ other = manager_get_unit(u->manager, n);
|
|
|
b12ff75 |
+ if (!other || !unit_can_start(other))
|
|
|
b12ff75 |
+ continue;
|
|
|
b12ff75 |
+
|
|
|
b12ff75 |
+ r = manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
|
|
|
b12ff75 |
+ if (r < 0)
|
|
|
b12ff75 |
+ log_warning("Failed to add job %s/%s, ignoring: %s.",
|
|
|
b12ff75 |
+ other->id, job_type_to_string(JOB_START), strerror(-r));
|
|
|
b12ff75 |
}
|
|
|
b12ff75 |
}
|
|
|
b12ff75 |
}
|