summaryrefslogtreecommitdiff
path: root/src/shared/path-lookup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-04-16 12:36:07 +0200
committerLennart Poettering <lennart@poettering.net>2018-05-24 17:01:57 +0200
commit799b210267ed6209cd8ba1d693bd49509fab18d8 (patch)
tree600ef0f283625098d743d2f4099cb1e40e6f7bdb /src/shared/path-lookup.c
parentd6d9827687412a3f1559704839362b8651a07536 (diff)
downloadsystemd-799b210267ed6209cd8ba1d693bd49509fab18d8.tar.gz
path-lookup: add flag to optionally force checking split-usr unit dirs
When we look into a portable service image it might contain the unit files in split-usr directories rather than merged-usr directories as on the host. Hence, let#s add a flag that checking all dirs can be forced.
Diffstat (limited to 'src/shared/path-lookup.c')
-rw-r--r--src/shared/path-lookup.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 9919b2f2c2..e71af2f7cb 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -263,10 +263,8 @@ static int acquire_generator_dirs(
if (tempdir)
prefix = tempdir;
-
else if (scope == UNIT_FILE_SYSTEM)
prefix = "/run/systemd";
-
else if (scope == UNIT_FILE_USER) {
const char *e;
@@ -484,6 +482,10 @@ int lookup_paths_init(
assert(scope >= 0);
assert(scope < _UNIT_FILE_SCOPE_MAX);
+#if HAVE_SPLIT_USR
+ flags |= LOOKUP_PATHS_SPLIT_USR;
+#endif
+
if (!empty_or_root(root_dir)) {
if (scope == UNIT_FILE_USER)
return -EINVAL;
@@ -582,9 +584,7 @@ int lookup_paths_init(
"/usr/local/lib/systemd/system",
SYSTEM_DATA_UNIT_PATH,
"/usr/lib/systemd/system",
-#if HAVE_SPLIT_USR
- "/lib/systemd/system",
-#endif
+ STRV_IFNOTNULL(flags & LOOKUP_PATHS_SPLIT_USR ? "/lib/systemd/system" : NULL),
STRV_IFNOTNULL(generator_late),
NULL);
break;