]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
c2f1db8f | 2 | #pragma once |
84e3543e LP |
3 | |
4 | /*** | |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright 2010 Lennart Poettering | |
84e3543e LP |
8 | ***/ |
9 | ||
a8fbdf54 | 10 | #include <stdbool.h> |
a3c4eb07 LP |
11 | |
12 | typedef struct LookupPaths LookupPaths; | |
a3c4eb07 LP |
13 | |
14 | #include "install.h" | |
29686440 | 15 | #include "macro.h" |
a8ffe6fb | 16 | |
4943d143 | 17 | typedef enum LookupPathsFlags { |
ef31828d LP |
18 | LOOKUP_PATHS_EXCLUDE_GENERATED = 1 << 0, |
19 | LOOKUP_PATHS_TEMPORARY_GENERATED = 1 << 1, | |
20 | LOOKUP_PATHS_SPLIT_USR = 1 << 2, | |
4943d143 LP |
21 | } LookupPathsFlags; |
22 | ||
a3c4eb07 | 23 | struct LookupPaths { |
80b1ae32 LP |
24 | /* Where we look for unit files. This includes the individual special paths below, but also any vendor |
25 | * supplied, static unit file paths. */ | |
a3c4eb07 | 26 | char **search_path; |
a0f84a10 | 27 | |
80b1ae32 LP |
28 | /* Where we shall create or remove our installation symlinks, aka "configuration", and where the user/admin |
29 | * shall place his own unit files. */ | |
a0f84a10 LP |
30 | char *persistent_config; |
31 | char *runtime_config; | |
32 | ||
80b1ae32 LP |
33 | /* Where to place generated unit files (i.e. those a "generator" tool generated). Note the special semantics of |
34 | * this directory: the generators are flushed each time a "systemctl daemon-reload" is issued. The user should | |
35 | * not alter these directories directly. */ | |
a3c4eb07 LP |
36 | char *generator; |
37 | char *generator_early; | |
38 | char *generator_late; | |
e4bb56c7 | 39 | |
80b1ae32 LP |
40 | /* Where to place transient unit files (i.e. those created dynamically via the bus API). Note the special |
41 | * semantics of this directory: all units created transiently have their unit files removed as the transient | |
42 | * unit is unloaded. The user should not alter this directory directly. */ | |
39591351 LP |
43 | char *transient; |
44 | ||
80b1ae32 LP |
45 | /* Where the snippets created by "systemctl set-property" are placed. Note that for transient units, the |
46 | * snippets are placed in the transient directory though (see above). The user should not alter this directory | |
47 | * directly. */ | |
48 | char *persistent_control; | |
49 | char *runtime_control; | |
50 | ||
e4bb56c7 LP |
51 | /* The root directory prepended to all items above, or NULL */ |
52 | char *root_dir; | |
a1f31f47 ZJS |
53 | |
54 | /* A temporary directory when running in test mode, to be nuked */ | |
55 | char *temporary_dir; | |
a3c4eb07 | 56 | }; |
84e3543e | 57 | |
4943d143 | 58 | int lookup_paths_init(LookupPaths *p, UnitFileScope scope, LookupPathsFlags flags, const char *root_dir); |
ca4adeb7 ZJS |
59 | int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs); |
60 | int xdg_user_runtime_dir(char **ret, const char *suffix); | |
61 | int xdg_user_config_dir(char **ret, const char *suffix); | |
62 | int xdg_user_data_dir(char **ret, const char *suffix); | |
d2561cfd ZJS |
63 | bool path_is_user_data_dir(const char *path); |
64 | bool path_is_user_config_dir(const char *path); | |
59ccf93d | 65 | |
a1453343 LP |
66 | int lookup_paths_reduce(LookupPaths *p); |
67 | ||
cd64fd56 LP |
68 | int lookup_paths_mkdir_generator(LookupPaths *p); |
69 | void lookup_paths_trim_generator(LookupPaths *p); | |
07a78643 | 70 | void lookup_paths_flush_generator(LookupPaths *p); |
cd64fd56 | 71 | |
cab6235f | 72 | void lookup_paths_free(LookupPaths *p); |
a69b4fb0 LP |
73 | |
74 | char **generator_binary_paths(UnitFileScope scope); |