diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
index 97ef3ec..d61dcc5 100644
--- a/src/bluetoothd.8.in
+++ b/src/bluetoothd.8.in
Enable logging in foreground. Directs log output to the controlling terminal \
in addition to syslog.
.TP
+.B -f, --configfile
+Specifies an explicit config file path instead of relying on the default path \
+(@CONFIGDIR@/main.conf) for the config file.
+.TP
.B -d, --debug=<file1>:<file2>:...
Sets how much information bluetoothd sends to the log destination (usually \
syslog's "daemon" facility). If the file options are omitted, then debugging \
diff --git a/src/main.c b/src/main.c
index 805d330..08393a9 100644
--- a/src/main.c
+++ b/src/main.c
struct main_opts main_opts;
static GKeyFile *main_conf;
+static char *main_conf_file_path;
static enum {
MPS_OFF,
}
if (!found)
- warn("Unknown key %s for group %s in main.conf",
- keys[i], group);
+ warn("Unknown key %s for group %s in %s",
+ keys[i], group, main_conf_file_path);
}
g_strfreev(keys);
}
if (!match)
- warn("Unknown group %s in main.conf", keys[i]);
+ warn("Unknown group %s in %s", keys[i],
+ main_conf_file_path);
}
g_strfreev(keys);
check_config(config);
- DBG("parsing main.conf");
+ DBG("parsing %s", main_conf_file_path);
val = g_key_file_get_integer(config, "General",
"DiscoverableTimeout", &err);
static char *option_debug = NULL;
static char *option_plugin = NULL;
static char *option_noplugin = NULL;
+static char *option_configfile = NULL;
static gboolean option_compat = FALSE;
static gboolean option_detach = TRUE;
static gboolean option_version = FALSE;
g_free(option_noplugin);
option_noplugin = NULL;
+
+ g_free(option_configfile);
+ option_configfile = NULL;
}
static void disconnect_dbus(void)
"Specify plugins to load", "NAME,..," },
{ "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
"Specify plugins not to load", "NAME,..." },
+ { "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile,
+ "Specify an explicit path to the config file", "FILE"},
{ "compat", 'C', 0, G_OPTION_ARG_NONE, &option_compat,
"Provide deprecated command line interfaces" },
{ "experimental", 'E', 0, G_OPTION_ARG_NONE, &option_experimental,
sd_notify(0, "STATUS=Starting up");
- main_conf = load_config(CONFIGDIR "/main.conf");
+ if (option_configfile)
+ main_conf_file_path = option_configfile;
+ else
+ main_conf_file_path = CONFIGDIR "/main.conf";
+
+ main_conf = load_config(main_conf_file_path);
parse_config(main_conf);