]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
unit: save description/slice of transient units to /run
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Jul 2013 19:13:56 +0000 (21:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 10 Jul 2013 21:41:03 +0000 (23:41 +0200)
This is necessary so that these properties survive a daemon reload.

src/core/dbus-unit.c
src/core/load-fragment-gperf.gperf.m4

index 4605b2fe07de723e06cbc8a389ac946da6527c2a..e07a28e32d6bf07b243eb678e3f6ee8a441c881f 100644 (file)
@@ -794,6 +794,7 @@ static int bus_unit_set_transient_property(
                         return -EINVAL;
 
                 if (mode != UNIT_CHECK) {
+                        _cleanup_free_ char *contents = NULL;
                         const char *description;
 
                         dbus_message_iter_get_basic(i, &description);
@@ -801,6 +802,12 @@ static int bus_unit_set_transient_property(
                         r = unit_set_description(u, description);
                         if (r < 0)
                                 return r;
+
+                        contents = strjoin("[Unit]\nDescription=", description, "\n", NULL);
+                        if (!contents)
+                                return -ENOMEM;
+
+                        unit_write_drop_in(u, mode, "Description", contents);
                 }
 
                 return 1;
@@ -818,6 +825,8 @@ static int bus_unit_set_transient_property(
                         if (mode != UNIT_CHECK)
                                 unit_ref_unset(&u->slice);
                 } else {
+                        _cleanup_free_ char *contents = NULL;
+
                         r = manager_load_unit(u->manager, s, NULL, error, &slice);
                         if (r < 0)
                                 return r;
@@ -827,6 +836,12 @@ static int bus_unit_set_transient_property(
 
                         if (mode != UNIT_CHECK)
                                 unit_ref_set(&u->slice, slice);
+
+                        contents = strjoin("[", UNIT_VTABLE(u)->private_section, "]\nSlice=", s, NULL);
+                        if (!contents)
+                                return -ENOMEM;
+
+                        unit_write_drop_in(u, mode, "Slice", contents);
                 }
                 return 1;
         }
index 2325d6aa9a2f1e8f26d865b41526cef73d569b7d..76fc9c48acf0c8554ac0d0b9ad245337b93aadf9 100644 (file)
@@ -259,6 +259,8 @@ Path.MakeDirectory,              config_parse_bool,                  0,
 Path.DirectoryMode,              config_parse_mode,                  0,                             offsetof(Path, directory_mode)
 m4_dnl
 CGROUP_CONTEXT_CONFIG_ITEMS(Slice)m4_dnl
+m4_dnl
+CGROUP_CONTEXT_CONFIG_ITEMS(Scope)m4_dnl
 m4_dnl The [Install] section is ignored here.
 Install.Alias,                   NULL,                               0,                             0
 Install.WantedBy,                NULL,                               0,                             0