X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Finstall.c;h=a3b75243d5dce6e382b4f4edc196b64f42a80e29;hb=49f43d5f91a99b23f745726aa351d8f159774357;hp=d6644e580fbf16cc904bfe92ec4837a7a347d389;hpb=78d54bd42b87818f5d0ef862d247f9db4844fadd;p=elogind.git diff --git a/src/shared/install.c b/src/shared/install.c index d6644e580..a3b75243d 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -60,7 +60,8 @@ static int lookup_paths_init_from_scope(LookupPaths *paths, UnitFileScope scope) return lookup_paths_init(paths, scope == UNIT_FILE_SYSTEM ? MANAGER_SYSTEM : MANAGER_USER, - scope == UNIT_FILE_USER); + scope == UNIT_FILE_USER, + NULL, NULL, NULL); } static int get_config_path(UnitFileScope scope, bool runtime, const char *root_dir, char **ret) { @@ -607,7 +608,7 @@ int unit_file_mask( STRV_FOREACH(i, files) { char *path; - if (!unit_name_is_valid_no_type(*i, true)) { + if (!unit_name_is_valid(*i, true)) { if (r == 0) r = -EINVAL; continue; @@ -683,7 +684,7 @@ int unit_file_unmask( STRV_FOREACH(i, files) { char *path; - if (!unit_name_is_valid_no_type(*i, true)) { + if (!unit_name_is_valid(*i, true)) { if (r == 0) r = -EINVAL; continue; @@ -759,7 +760,7 @@ int unit_file_link( fn = path_get_file_name(*i); if (!path_is_absolute(*i) || - !unit_name_is_valid_no_type(fn, true)) { + !unit_name_is_valid(fn, true)) { if (r == 0) r = -EINVAL; continue; @@ -922,7 +923,7 @@ static int install_info_add( if (!name) name = path_get_file_name(path); - if (!unit_name_is_valid_no_type(name, true)) + if (!unit_name_is_valid(name, true)) return -EINVAL; if (hashmap_get(c->have_installed, name) || @@ -1150,7 +1151,7 @@ static int create_symlink( assert(old_path); assert(new_path); - mkdir_parents(new_path, 0755); + mkdir_parents_label(new_path, 0755); if (symlink(old_path, new_path) >= 0) { add_file_change(changes, n_changes, UNIT_FILE_SYMLINK, new_path, old_path); @@ -1232,7 +1233,7 @@ static int install_info_symlink_wants( STRV_FOREACH(s, i->wanted_by) { char *path; - if (!unit_name_is_valid_no_type(*s, true)) { + if (!unit_name_is_valid(*s, true)) { r = -EINVAL; continue; } @@ -1266,7 +1267,7 @@ static int install_info_symlink_requires( STRV_FOREACH(s, i->required_by) { char *path; - if (!unit_name_is_valid_no_type(*s, true)) { + if (!unit_name_is_valid(*s, true)) { r = -EINVAL; continue; } @@ -1597,7 +1598,7 @@ UnitFileState unit_file_get_state( if (root_dir && scope != UNIT_FILE_SYSTEM) return -EINVAL; - if (!unit_name_is_valid_no_type(name, true)) + if (!unit_name_is_valid(name, true)) return -EINVAL; r = lookup_paths_init_from_scope(&paths, scope); @@ -1682,16 +1683,18 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) { if (scope == UNIT_FILE_SYSTEM) r = conf_files_list(&files, ".preset", - "/etc/systemd/system.preset", - "/usr/local/lib/systemd/system.preset", - "/usr/lib/systemd/system.preset", - "/lib/systemd/system.preset", + "/etc/systemd/system-preset", + "/usr/local/lib/systemd/system-preset", + "/usr/lib/systemd/system-preset", +#ifdef HAVE_SPLIT_USR + "/lib/systemd/system-preset", +#endif NULL); else if (scope == UNIT_FILE_GLOBAL) r = conf_files_list(&files, ".preset", - "/etc/systemd/user.preset", - "/usr/local/lib/systemd/user.preset", - "/usr/lib/systemd/user.preset", + "/etc/systemd/user-preset", + "/usr/local/lib/systemd/user-preset", + "/usr/lib/systemd/user-preset", NULL); else return 1; @@ -1790,7 +1793,7 @@ int unit_file_preset( STRV_FOREACH(i, files) { - if (!unit_name_is_valid_no_type(*i, true)) { + if (!unit_name_is_valid(*i, true)) { r = -EINVAL; goto finish; } @@ -1895,7 +1898,7 @@ int unit_file_get_list( if (ignore_file(de->d_name)) continue; - if (!unit_name_is_valid_no_type(de->d_name, true)) + if (!unit_name_is_valid(de->d_name, true)) continue; if (hashmap_get(h, de->d_name))