return 0;
}
-/* Parse one main config file located in /etc/systemd and its drop-ins, which is what all systemd daemons
+/* Parse one main config file located in /etc/$pkgdir and its drop-ins, which is what all systemd daemons
* do. */
-int config_parse_config_file(
+int config_parse_config_file_full(
const char *conf_file,
+ const char *pkgdir,
const char *sections,
ConfigItemLookup lookup,
const void *table,
int r;
assert(conf_file);
+ assert(pkgdir);
/* build the dropin dir list */
dropin_dirs = new0(char*, strv_length(conf_paths) + 1);
STRV_FOREACH(p, conf_paths) {
char *d;
- d = strjoin(*p, "systemd/", conf_file, ".d");
+ d = strjoin(*p, pkgdir, "/", conf_file, ".d");
if (!d) {
if (flags & CONFIG_PARSE_WARN)
return log_oom();
if (r < 0)
return r;
- const char *sysconf_file = strjoina(PKGSYSCONFDIR, "/", conf_file);
+ const char *sysconf_file = strjoina(SYSCONF_DIR, "/", pkgdir, "/", conf_file);
return config_parse_many_files(STRV_MAKE_CONST(sysconf_file), dropins,
sections, lookup, table, flags, userdata, NULL);
void *userdata,
struct stat *ret_stat); /* possibly NULL */
-int config_parse_config_file(
+int config_parse_config_file_full(
const char *conf_file,
+ const char *pkgdir,
const char *sections, /* nulstr */
ConfigItemLookup lookup,
const void *table,
ConfigParseFlags flags,
void *userdata);
+static inline int config_parse_config_file(
+ const char *conf_file,
+ const char *sections, /* nulstr */
+ ConfigItemLookup lookup,
+ const void *table,
+ ConfigParseFlags flags,
+ void *userdata) {
+ return config_parse_config_file_full(conf_file, "systemd", sections, lookup, table, flags, userdata);
+}
+
int config_parse_many(
const char* const* conf_files, /* possibly empty */
const char* const* conf_file_dirs,