Skip to content

Commit fccd44e

Browse files
committed
core: --user -- add basic.target an sort against it like --system does
1 parent fcc81ea commit fccd44e

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ nodist_systemunit_DATA = \
460460
units/systemd-nspawn@.service
461461

462462
dist_userunit_DATA = \
463+
units/user/basic.target \
463464
units/user/default.target \
464465
units/user/exit.target
465466

src/core/service.c

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,28 +1138,10 @@ static int service_add_default_dependencies(Service *s) {
11381138
* majority of services. */
11391139

11401140
/* First, pull in base system */
1141-
if (UNIT(s)->manager->running_as == SYSTEMD_SYSTEM) {
1142-
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
1143-
SPECIAL_BASIC_TARGET, NULL, true);
1144-
if (r < 0)
1145-
return r;
1146-
1147-
} else if (UNIT(s)->manager->running_as == SYSTEMD_USER) {
1148-
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
1149-
SPECIAL_SOCKETS_TARGET, NULL, true);
1150-
if (r < 0)
1151-
return r;
1152-
1153-
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
1154-
SPECIAL_TIMERS_TARGET, NULL, true);
1155-
if (r < 0)
1156-
return r;
1157-
1158-
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
1159-
SPECIAL_PATHS_TARGET, NULL, true);
1160-
if (r < 0)
1161-
return r;
1162-
}
1141+
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
1142+
SPECIAL_BASIC_TARGET, NULL, true);
1143+
if (r < 0)
1144+
return r;
11631145

11641146
/* Second, activate normal shutdown */
11651147
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS,

units/user/basic.target

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file is part of systemd.
2+
#
3+
# systemd is free software; you can redistribute it and/or modify it
4+
# under the terms of the GNU Lesser General Public License as published by
5+
# the Free Software Foundation; either version 2.1 of the License, or
6+
# (at your option) any later version.
7+
8+
[Unit]
9+
Description=Basic System
10+
Documentation=man:systemd.special(7)
11+
Wants=sockets.target timers.target paths.target
12+
After=sockets.target timers.target paths.target
13+
RefuseManualStart=yes

units/user/default.target

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
[Unit]
99
Description=Default
1010
Documentation=man:systemd.special(7)
11+
Requires=basic.target
12+
After=basic.target
1113
AllowIsolate=yes

0 commit comments

Comments
 (0)