if ((m->epoll_fd = epoll_create1(EPOLL_CLOEXEC)) < 0)
goto fail;
- if ((r = lookup_paths_init(&m->lookup_paths, m->running_as)) < 0)
+ if ((r = lookup_paths_init(&m->lookup_paths, m->running_as, true)) < 0)
goto fail;
if ((r = manager_setup_signals(m)) < 0)
/* Find new unit paths */
lookup_paths_free(&m->lookup_paths);
- if ((q = lookup_paths_init(&m->lookup_paths, m->running_as)) < 0)
+ if ((q = lookup_paths_init(&m->lookup_paths, m->running_as, true)) < 0)
r = q;
manager_run_generators(m);
goto finish;
}
-int lookup_paths_init(LookupPaths *p, ManagerRunningAs running_as) {
+int lookup_paths_init(LookupPaths *p, ManagerRunningAs running_as, bool personal) {
const char *e;
char *t;
strv_free(p->unit_path);
if (running_as == MANAGER_USER) {
- if (!(p->unit_path = user_dirs()))
+
+ if (personal)
+ p->unit_path = user_dirs();
+ else
+ p->unit_path = strv_new(
+ /* If you modify this you also want to modify
+ * systemduserunitpath= in systemd.pc.in, and
+ * the arrays in user_dirs() above! */
+ "/run/systemd/user",
+ USER_CONFIG_UNIT_PATH,
+ "/etc/systemd/system",
+ "/usr/local/lib/systemd/user",
+ "/usr/local/share/systemd/user",
+ USER_DATA_UNIT_PATH,
+ "/usr/lib/systemd/user",
+ "/usr/share/systemd/user",
+ NULL);
+
+ if (!p->unit_path)
return -ENOMEM;
+
} else
if (!(p->unit_path = strv_new(
/* If you modify this you also want to modify
"/etc/systemd/system",
"/usr/local/lib/systemd/system",
"/usr/lib/systemd/system",
- "/lib/systemd/system",
SYSTEM_DATA_UNIT_PATH,
+ "/lib/systemd/system",
NULL)))
return -ENOMEM;
}
int user_config_home(char **config_home);
-int lookup_paths_init(LookupPaths *p, ManagerRunningAs running_as);
+int lookup_paths_init(LookupPaths *p, ManagerRunningAs running_as, bool personal);
void lookup_paths_free(LookupPaths *p);
#endif
dbus_error_init(&error);
zero(paths);
- if ((r = lookup_paths_init(&paths, arg_user ? MANAGER_USER : MANAGER_SYSTEM)) < 0) {
+ if ((r = lookup_paths_init(&paths, arg_user ? MANAGER_USER : MANAGER_SYSTEM, true)) < 0) {
log_error("Failed to determine lookup paths: %s", strerror(-r));
goto finish;
}