goodnight
[systembsd.git] / src / main.c
CommitLineData
08e17ea2 1/* debugging */
1c38000a 2#define INSTALL 1
11475670 3//#define NO_BUILTIN_XML 1
08e17ea2 4/* end debugging */
5
387173cb 6#include <gio/gio.h>
c3b84b0a 7#include <glib.h>
8#include <glib/gprintf.h>
9#include <glib/gstdio.h>
1c38000a 10#include "config.c"
b7f8df44 11#include "interfaces/hostnamed/hostnamed.c"
c3b84b0a 12//#include "main/h"
496f5d66 13
c3b84b0a 14gboolean systemd_utils_init() {
71e3eef1 15 #ifdef INSTALL
1c38000a 16 if(!config_init()) {
4241079f 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;
71e3eef1 29 }
30 #endif
c3b84b0a 31 return TRUE;
32}
08e17ea2 33
c3b84b0a 34int main() {
08e17ea2 35
c3b84b0a 36 GMainLoop *mloop;
387173cb 37
c3b84b0a 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
e8c57a5d 43 hostnamed_init();
c3b84b0a 44
45 mloop = g_main_loop_new(NULL, TRUE);
46
e8c57a5d 47 g_main_loop_run(mloop);
c3b84b0a 48 g_main_loop_unref(mloop);
e8c57a5d 49
496f5d66 50 return 0;
ea207ed3 51}