Hi, See http://bugs.debian.org/719695 for context.
This patch is not complete yet; at least masking/unmasking does not work yet. Maybe I missed other verbs, too :). Any feedback appreciated. -- Best regards, Michael
diff --git i/src/shared/install.c w/src/shared/install.c index f57b94d..8f9596b 100644 --- i/src/shared/install.c +++ w/src/shared/install.c @@ -1023,6 +1023,8 @@ static int unit_file_load( (int) strv_length(info->required_by); } +#define FOLLOW_MAX 8 + static int unit_file_search( InstallContext *c, InstallInfo *info, @@ -1053,11 +1055,44 @@ static int unit_file_search( if (!path) return -ENOMEM; + int cnt = 0; + for (;;) { + if (cnt++ >= FOLLOW_MAX) + return -ELOOP; + + r = unit_file_load(c, info, path, allow_symlink); + + /* symlinks are always allowed for units in {/usr,}/lib/systemd so that + * one can alias units without using Alias= (the downside of Alias= is + * that the alias only exists when the unit is enabled). */ + if (r >= 0) + break; + + if (r != -ELOOP) + break; + + if (allow_symlink) + break; + + if (!path_startswith(path, "/lib/systemd") && + !path_startswith(path, "/usr/lib/systemd")) + break; + + char *target; + r = readlink_and_make_absolute(path, &target); + if (r < 0) + return r; + free(path); + path = target; + } + r = unit_file_load(c, info, path, allow_symlink); - if (r >= 0) + if (r >= 0) { info->path = path; - else { + free(info->name); + info->name = strdup(path_get_file_name(path)); + } else { if (r == -ENOENT && unit_name_is_instance(info->name)) { /* Unit file doesn't exist, however instance enablement was requested. * We will check if it is possible to load template unit file. */
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel