We should treat ./some.service and $PWD/some.service as equivalent. But we'd
try to send the relative paths over dbus, which can't work well:
$ sudo systemctl enable ./test2.service
Failed to look up unit file state: Invalid argument
$ sudo systemctl enable $PWD/test2.service
Created symlink /etc/systemd/system/multi-user.target.wants/test2.service → /home/zbyszek/src/systemd/test2.service.
Created symlink /etc/systemd/system/test2.service → /home/zbyszek/src/systemd/test2.service.
Now both are equivalent.
/* When enabling units qualified path names are OK, too, hence allow them explicitly. */
- if (is_path(*name)) {
- *i = strdup(*name);
- if (!*i)
- return log_oom();
- } else {
+ if (is_path(*name))
+ r = path_make_absolute_cwd(*name, i);
+ else
r = unit_name_mangle_with_suffix(*name, operation,
arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN,
".service", i);
- if (r < 0) {
- *i = NULL;
- return log_error_errno(r, "Failed to mangle unit name: %m");
- }
+ if (r < 0) {
+ *i = NULL;
+ return log_error_errno(r, "Failed to mangle unit name or path '%s': %m", *name);
}
i++;