goodnight
[systembsd.git] / src / main.c
... / ...
CommitLineData
1/* debugging */
2#define INSTALL 1
3//#define NO_BUILTIN_XML 1
4/* end debugging */
5
6#include <gio/gio.h>
7#include <glib.h>
8#include <glib/gprintf.h>
9#include <glib/gstdio.h>
10#include "config.c"
11#include "interfaces/hostnamed/hostnamed.c"
12//#include "main/h"
13
14gboolean systemd_utils_init() {
15 #ifdef INSTALL
16 if(!config_init()) {
17 gchar *tmp;
18 tmp = "/etc/"; //what the hell is /etc/xdg anyway
19
20 g_printf("FAILED to install configs in %s!\n", tmp);
21 return FALSE;
22 }
23 if(!init_xml()) {
24 gchar **tmp;
25 tmp = g_get_system_data_dirs();
26
27 g_printf("FAILED to install xml configs in %s!\n", tmp[0]);
28 return FALSE;
29 }
30 #endif
31 return TRUE;
32}
33
34int main() {
35
36 GMainLoop *mloop;
37
38 if(!systemd_utils_init()) {
39 g_printf("failed to init, are you root?\n");
40 return 1; //TODO errno properly. grep for all "return 1;"s, not TODO'ing each one
41 }
42
43 hostnamed_init();
44
45 mloop = g_main_loop_new(NULL, TRUE);
46
47 g_main_loop_run(mloop);
48 g_main_loop_unref(mloop);
49
50 return 0;
51}