kmscon: drop all configs and use new /etc/kmscon/kmscon.conf

This drops all config-file support except for the new
/etc/kmscon/kmscon.conf. For backwards-compatibility, we still parse
/etc/kmscon.conf but this will be removed soon.

We want to add one kmscon-config for each seat so you can have different
configurations per seat. These will all be put into /etc/kmscon/ so we
need this directory.

We also drop ~/.kmscon.conf. This was never really useful as kmscon is a
system daemon and should not be used with user-configuration files.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-10-18 14:48:09 +02:00
parent 5cd14efb80
commit 613abadb4b
3 changed files with 10 additions and 23 deletions

View File

@ -779,23 +779,3 @@ int conf_parse_file_f(struct conf_option *opts, size_t len,
free(path);
return ret;
}
int conf_parse_standard_files(struct conf_option *opts, size_t len,
const char *fname)
{
int ret;
const char *home;
ret = conf_parse_file_f(opts, len, "/etc/%s.conf", fname);
if (ret)
return ret;
home = getenv("HOME");
if (home) {
ret = conf_parse_file_f(opts, len, "%s/.%s.conf", home, fname);
if (ret)
return ret;
}
return 0;
}

View File

@ -171,7 +171,5 @@ int conf_parse_argv(struct conf_option *opts, size_t len,
int conf_parse_file(struct conf_option *opts, size_t len, const char *path);
int conf_parse_file_f(struct conf_option *opts, size_t len,
const char *format, ...);
int conf_parse_standard_files(struct conf_option *opts, size_t len,
const char *fname);
#endif /* CONFIG_CONFIG_H */

View File

@ -30,6 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <xkbcommon/xkbcommon-keysyms.h>
#include "conf.h"
#include "kmscon_conf.h"
@ -344,10 +345,18 @@ int kmscon_load_config(int argc, char **argv)
log_print_init("kmscon");
ret = conf_parse_standard_files(options, onum, "kmscon");
ret = conf_parse_file_f(options, onum, "/etc/kmscon/kmscon.conf");
if (ret)
return ret;
/* TODO: Deprecated! Remove this! */
if (!access("/etc/kmscon.conf", F_OK)) {
log_error("/etc/kmscon.conf is deprecated, please use /etc/kmscon/kmscon.conf");
ret = conf_parse_file_f(options, onum, "/etc/kmscon.conf");
if (ret)
return ret;
}
return 0;
}