2012-07-18 19:07:51 +02:00
|
|
|
#pragma once
|
2010-06-15 14:45:15 +02:00
|
|
|
|
|
|
|
/***
|
|
|
|
This file is part of systemd.
|
|
|
|
|
|
|
|
Copyright 2010 Lennart Poettering
|
|
|
|
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
2012-04-12 00:20:58 +02:00
|
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
2010-06-15 14:45:15 +02:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
systemd is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2012-04-12 00:20:58 +02:00
|
|
|
Lesser General Public License for more details.
|
2010-06-15 14:45:15 +02:00
|
|
|
|
2012-04-12 00:20:58 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2010-06-15 14:45:15 +02:00
|
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
|
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 {
|
|
|
|
LOOKUP_PATHS_EXCLUDE_GENERATED = 1,
|
2017-09-14 19:26:29 +02:00
|
|
|
LOOKUP_PATHS_TEMPORARY_GENERATED,
|
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;
|
|
|
|
|
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);
|
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);
|
2014-08-21 19:08:30 +02:00
|
|
|
#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
|
2016-04-07 17:51:26 +02:00
|
|
|
|
|
|
|
char **generator_binary_paths(UnitFileScope scope);
|