chiark / gitweb /
core: --user -- add basic.target an sort against it like --system does
authorKay Sievers <kay@vrfy.org>
Mon, 6 Jan 2014 03:52:17 +0000 (07:52 +0400)
committerKay Sievers <kay@vrfy.org>
Mon, 6 Jan 2014 17:35:25 +0000 (01:35 +0800)
Makefile.am
src/core/service.c
units/user/basic.target [new file with mode: 0644]
units/user/default.target

index 069583cfd4afd69b73a10864b0404d9b3626da30..aed8c326a7041d408aba556e32524ccd329d986e 100644 (file)
@@ -460,6 +460,7 @@ nodist_systemunit_DATA = \
        units/systemd-nspawn@.service
 
 dist_userunit_DATA = \
+       units/user/basic.target \
        units/user/default.target \
        units/user/exit.target
 
index 6fbde2b8f235606dd823f4ca1fb8cefc1c261baf..23810b39a9edce1b7a16e1768ede9e5680ab1867 100644 (file)
@@ -1138,28 +1138,10 @@ static int service_add_default_dependencies(Service *s) {
          * majority of services. */
 
         /* First, pull in base system */
-        if (UNIT(s)->manager->running_as == SYSTEMD_SYSTEM) {
-                r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
-                                                      SPECIAL_BASIC_TARGET, NULL, true);
-                if (r < 0)
-                        return r;
-
-        } else if (UNIT(s)->manager->running_as == SYSTEMD_USER) {
-                r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
-                                                      SPECIAL_SOCKETS_TARGET, NULL, true);
-                if (r < 0)
-                        return r;
-
-                r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
-                                                      SPECIAL_TIMERS_TARGET, NULL, true);
-                if (r < 0)
-                        return r;
-
-                r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
-                                                      SPECIAL_PATHS_TARGET, NULL, true);
-                if (r < 0)
-                        return r;
-        }
+        r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
+                                              SPECIAL_BASIC_TARGET, NULL, true);
+        if (r < 0)
+                return r;
 
         /* Second, activate normal shutdown */
         r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS,
diff --git a/units/user/basic.target b/units/user/basic.target
new file mode 100644 (file)
index 0000000..b74d13c
--- /dev/null
@@ -0,0 +1,13 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Basic System
+Documentation=man:systemd.special(7)
+Wants=sockets.target timers.target paths.target
+After=sockets.target timers.target paths.target
+RefuseManualStart=yes
index 71eed51b09a085326033a767396fc6233dcbf090..9853c33b408bb6fc61a3f2fe646cb7607b4f26be 100644 (file)
@@ -8,4 +8,6 @@
 [Unit]
 Description=Default
 Documentation=man:systemd.special(7)
+Requires=basic.target
+After=basic.target
 AllowIsolate=yes