2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2012-07-18 19:07:51 +02:00
|
|
|
#pragma once
|
2010-06-15 14:45:15 +02:00
|
|
|
|
2015-12-03 21:13:37 +01:00
|
|
|
#include <stdbool.h>
|
2016-02-24 15:31:33 +01:00
|
|
|
|
|
|
|
typedef struct LookupPaths LookupPaths;
|
|
|
|
|
|
|
|
#include "install.h"
|
2014-06-27 18:12:07 +02:00
|
|
|
#include "macro.h"
|
2015-03-15 02:46:59 +01:00
|
|
|
|
2016-04-07 18:48:01 +02:00
|
|
|
typedef enum LookupPathsFlags {
|
2018-06-07 16:03:43 +02:00
|
|
|
LOOKUP_PATHS_EXCLUDE_GENERATED = 1 << 0,
|
|
|
|
LOOKUP_PATHS_TEMPORARY_GENERATED = 1 << 1,
|
|
|
|
LOOKUP_PATHS_SPLIT_USR = 1 << 2,
|
2016-04-07 18:48:01 +02:00
|
|
|
} LookupPathsFlags;
|
|
|
|
|
2016-02-24 15:31:33 +01:00
|
|
|
struct LookupPaths {
|
2016-04-06 21:02:36 +02:00
|
|
|
/* Where we look for unit files. This includes the individual special paths below, but also any vendor
|
|
|
|
* supplied, static unit file paths. */
|
2016-02-24 15:31:33 +01:00
|
|
|
char **search_path;
|
2016-02-24 17:18:42 +01:00
|
|
|
|
2016-04-06 21:02:36 +02:00
|
|
|
/* Where we shall create or remove our installation symlinks, aka "configuration", and where the user/admin
|
|
|
|
* shall place his own unit files. */
|
2016-02-24 17:18:42 +01:00
|
|
|
char *persistent_config;
|
|
|
|
char *runtime_config;
|
|
|
|
|
2018-10-08 17:22:06 +02:00
|
|
|
/* Where units from a portable service image shall be placed. */
|
|
|
|
char *persistent_attached;
|
|
|
|
char *runtime_attached;
|
|
|
|
|
2016-04-06 21:02:36 +02:00
|
|
|
/* Where to place generated unit files (i.e. those a "generator" tool generated). Note the special semantics of
|
|
|
|
* this directory: the generators are flushed each time a "systemctl daemon-reload" is issued. The user should
|
|
|
|
* not alter these directories directly. */
|
2016-02-24 15:31:33 +01:00
|
|
|
char *generator;
|
|
|
|
char *generator_early;
|
|
|
|
char *generator_late;
|
2016-02-25 00:16:51 +01:00
|
|
|
|
2016-04-06 21:02:36 +02:00
|
|
|
/* Where to place transient unit files (i.e. those created dynamically via the bus API). Note the special
|
|
|
|
* semantics of this directory: all units created transiently have their unit files removed as the transient
|
|
|
|
* unit is unloaded. The user should not alter this directory directly. */
|
2016-02-25 01:13:57 +01:00
|
|
|
char *transient;
|
|
|
|
|
2016-04-06 21:02:36 +02:00
|
|
|
/* Where the snippets created by "systemctl set-property" are placed. Note that for transient units, the
|
|
|
|
* snippets are placed in the transient directory though (see above). The user should not alter this directory
|
|
|
|
* directly. */
|
|
|
|
char *persistent_control;
|
|
|
|
char *runtime_control;
|
|
|
|
|
2016-02-25 00:16:51 +01:00
|
|
|
/* The root directory prepended to all items above, or NULL */
|
|
|
|
char *root_dir;
|
2017-09-14 19:26:29 +02:00
|
|
|
|
|
|
|
/* A temporary directory when running in test mode, to be nuked */
|
|
|
|
char *temporary_dir;
|
2016-02-24 15:31:33 +01:00
|
|
|
};
|
2010-06-15 14:45:15 +02:00
|
|
|
|
2016-04-07 18:48:01 +02:00
|
|
|
int lookup_paths_init(LookupPaths *p, UnitFileScope scope, LookupPathsFlags flags, const char *root_dir);
|
2018-10-08 17:22:06 +02:00
|
|
|
|
2017-11-23 11:41:28 +01:00
|
|
|
int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs);
|
|
|
|
int xdg_user_runtime_dir(char **ret, const char *suffix);
|
|
|
|
int xdg_user_config_dir(char **ret, const char *suffix);
|
|
|
|
int xdg_user_data_dir(char **ret, const char *suffix);
|
2018-10-08 17:22:06 +02:00
|
|
|
|
2017-09-22 14:46:09 +02:00
|
|
|
bool path_is_user_data_dir(const char *path);
|
|
|
|
bool path_is_user_config_dir(const char *path);
|
2014-08-21 19:08:30 +02:00
|
|
|
|
2016-02-25 02:32:19 +01:00
|
|
|
int lookup_paths_reduce(LookupPaths *p);
|
|
|
|
|
2016-02-25 01:44:30 +01:00
|
|
|
int lookup_paths_mkdir_generator(LookupPaths *p);
|
|
|
|
void lookup_paths_trim_generator(LookupPaths *p);
|
2016-04-06 20:47:44 +02:00
|
|
|
void lookup_paths_flush_generator(LookupPaths *p);
|
2016-02-25 01:44:30 +01:00
|
|
|
|
2015-05-11 22:53:54 +02:00
|
|
|
void lookup_paths_free(LookupPaths *p);
|
2016-04-07 17:51:26 +02:00
|
|
|
|
|
|
|
char **generator_binary_paths(UnitFileScope scope);
|