summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch b/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch
new file mode 100644
index 0000000000..df100e587d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-core-evaluate-presets-after-generators-have-run-6526.patch
@@ -0,0 +1,69 @@
1From 28dd66ecfce743b1ea9046c7bb501e0fcaeff724 Mon Sep 17 00:00:00 2001
2From: Luca Bruno <luca.bruno@coreos.com>
3Date: Sun, 6 Aug 2017 13:24:24 +0000
4Subject: [PATCH] core: evaluate presets after generators have run (#6526)
5
6This commit moves the first-boot system preset-settings evaluation out
7of main and into the manager startup logic itself. Notably, it reverses
8the order between generators and presets evaluation, so that any changes
9performed by first-boot generators are taken into the account by presets
10logic.
11
12After this change, units created by a generator can be enabled as part
13of a preset.
14
15Upstream-Status: Backport
16
17Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
18---
19 src/core/main.c | 12 ++----------
20 src/core/manager.c | 8 ++++++++
21 2 files changed, 10 insertions(+), 10 deletions(-)
22
23diff --git a/src/core/main.c b/src/core/main.c
24index dfedc3d..11ac9cf 100644
25--- a/src/core/main.c
26+++ b/src/core/main.c
27@@ -1809,18 +1809,10 @@ int main(int argc, char *argv[]) {
28 if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0)
29 log_warning_errno(errno, "Failed to make us a subreaper: %m");
30
31- if (arg_system) {
32+ if (arg_system)
33+ /* Bump up RLIMIT_NOFILE for systemd itself */
34 (void) bump_rlimit_nofile(&saved_rlimit_nofile);
35
36- if (empty_etc) {
37- r = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_ENABLE_ONLY, NULL, 0);
38- if (r < 0)
39- log_full_errno(r == -EEXIST ? LOG_NOTICE : LOG_WARNING, r, "Failed to populate /etc with preset unit settings, ignoring: %m");
40- else
41- log_info("Populated /etc with preset unit settings.");
42- }
43- }
44-
45 r = manager_new(arg_system ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, arg_action == ACTION_TEST, &m);
46 if (r < 0) {
47 log_emergency_errno(r, "Failed to allocate manager object: %m");
48diff --git a/src/core/manager.c b/src/core/manager.c
49index 1aadb70..fb5e2b5 100644
50--- a/src/core/manager.c
51+++ b/src/core/manager.c
52@@ -1328,6 +1328,14 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
53 if (r < 0)
54 return r;
55
56+ if (m->first_boot && m->unit_file_scope == UNIT_FILE_SYSTEM) {
57+ q = unit_file_preset_all(UNIT_FILE_SYSTEM, 0, NULL, UNIT_FILE_PRESET_ENABLE_ONLY, NULL, 0);
58+ if (q < 0)
59+ log_full_errno(q == -EEXIST ? LOG_NOTICE : LOG_WARNING, q, "Failed to populate /etc with preset unit settings, ignoring: %m");
60+ else
61+ log_info("Populated /etc with preset unit settings.");
62+ }
63+
64 lookup_paths_reduce(&m->lookup_paths);
65 manager_build_unit_path_cache(m);
66
67--
682.10.2
69