]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/install: drop creation of alias for DefaultInstance
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 19 Dec 2019 15:55:11 +0000 (16:55 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 21 Dec 2019 11:39:06 +0000 (12:39 +0100)
It turns out that this is not necessary. When we try to resolve alias@inst, we
first check alias@inst, and if that is not found, fall back to alias@. Since we
already created a symlink for alias@, we will find that and the result will be
the same.

src/shared/install.c

index 236f9a6e59812303755930f0843390f9a785467a..df9f92bddc6685b7f24b7252ac26aaed5520bbb5 100644 (file)
@@ -1788,22 +1788,6 @@ static int install_info_symlink_alias(
                 q = create_symlink(paths, i->path, alias_path, force, changes, n_changes);
                 if (r == 0)
                         r = q;
-
-                /* if we are a template with a DefaultInstance and we target a template, also create a link from the DefaultInstance*/
-                if (unit_name_is_valid(i->name, UNIT_NAME_TEMPLATE) && unit_name_is_valid(dst, UNIT_NAME_TEMPLATE) && i->default_instance) {
-                        _cleanup_free_ char *s_copy = NULL,*final_path = NULL;
-
-                        q = unit_name_replace_instance(dst,i->default_instance,&s_copy);
-                        if (q < 0)
-                                return q;
-                        final_path = path_make_absolute(s_copy, config_path);
-                        if (!final_path)
-                                return -ENOMEM;
-                        q = create_symlink(paths, i->path, final_path, force, changes, n_changes);
-                        if (r == 0)
-                                r = q;
-                }
-
         }
 
         return r;