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