mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-23 07:29:28 +01:00
main: Add support for CONFIGURATION_DIRECTORY environment variable
This commit is contained in:
parent
8a0c148368
commit
4c841edfb5
27
src/main.c
27
src/main.c
@ -53,7 +53,6 @@ static const char *interfaces;
|
|||||||
static const char *nointerfaces;
|
static const char *nointerfaces;
|
||||||
static const char *phys;
|
static const char *phys;
|
||||||
static const char *nophys;
|
static const char *nophys;
|
||||||
static const char *config_dir;
|
|
||||||
static const char *plugins;
|
static const char *plugins;
|
||||||
static const char *noplugins;
|
static const char *noplugins;
|
||||||
static const char *debugopt;
|
static const char *debugopt;
|
||||||
@ -348,8 +347,10 @@ int main(int argc, char *argv[])
|
|||||||
bool enable_dbus_debug = false;
|
bool enable_dbus_debug = false;
|
||||||
int exit_status;
|
int exit_status;
|
||||||
struct l_dbus *dbus;
|
struct l_dbus *dbus;
|
||||||
char *config_path;
|
const char *config_dir = NULL;
|
||||||
|
char **config_dirs;
|
||||||
uint32_t eap_mtu;
|
uint32_t eap_mtu;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int opt;
|
int opt;
|
||||||
@ -425,16 +426,30 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
l_info("Wireless daemon version %s", VERSION);
|
l_info("Wireless daemon version %s", VERSION);
|
||||||
|
|
||||||
|
if (!config_dir) {
|
||||||
|
config_dir = getenv("CONFIGURATION_DIRECTORY");
|
||||||
if (!config_dir)
|
if (!config_dir)
|
||||||
config_dir = DAEMON_CONFIGDIR;
|
config_dir = DAEMON_CONFIGDIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
l_debug("Using configuration directory %s", config_dir);
|
||||||
|
|
||||||
config_path = l_strdup_printf("%s/%s", config_dir, "main.conf");
|
|
||||||
iwd_config = l_settings_new();
|
iwd_config = l_settings_new();
|
||||||
|
|
||||||
if (!l_settings_load_from_file(iwd_config, config_path))
|
config_dirs = l_strsplit(config_dir, ':');
|
||||||
l_warn("Skipping optional configuration file %s", config_path);
|
for (i = 0; config_dirs[i]; i++) {
|
||||||
|
char *path = l_strdup_printf("%s/%s", config_dirs[i],
|
||||||
|
"main.conf");
|
||||||
|
bool result = l_settings_load_from_file(iwd_config, path);
|
||||||
|
l_free(path);
|
||||||
|
|
||||||
l_free(config_path);
|
if (result) {
|
||||||
|
l_info("Loaded configuration from %s/main.conf",
|
||||||
|
config_dirs[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l_strv_free(config_dirs);
|
||||||
|
|
||||||
__eapol_set_config(iwd_config);
|
__eapol_set_config(iwd_config);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user