finish migrating old code to work with gdbus-codegen types, cleaned up config IO...
[systembsd.git] / src / main.c
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
14 gboolean systemd_utils_init() {
15 #ifdef INSTALL
16 if(!config_init()) {
17 g_printf("%s\n", "FAILED to install configs in /etc/!");
18 return FALSE;
19 }
20 #endif
21 return TRUE;
22 }
23
24 int main() {
25
26 GMainLoop *mloop;
27
28 if(!systemd_utils_init()) {
29 g_printf("failed to init, are you root?\n");
30 return 1; //TODO errno properly. grep for all "return 1;"s, not TODO'ing each one
31 }
32
33 hostnamed_init();
34
35 mloop = g_main_loop_new(NULL, TRUE);
36
37 g_main_loop_run(mloop);
38 g_main_loop_unref(mloop);
39
40 return 0;
41 }