finish migrating old code to work with gdbus-codegen types, cleaned up config IO...
[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()) {
a35a69c5 17 g_printf("%s\n", "FAILED to install configs in /etc/!");
39df6847 18 return FALSE;
a35a69c5 19 }
20 #endif
39df6847 21 return TRUE;
22}
929eb2a9 23
39df6847 24int main() {
929eb2a9 25
39df6847 26 GMainLoop *mloop;
387173cb 27
39df6847 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
1cd91c9c 33 hostnamed_init();
39df6847 34
35 mloop = g_main_loop_new(NULL, TRUE);
36
1cd91c9c 37 g_main_loop_run(mloop);
39df6847 38 g_main_loop_unref(mloop);
1cd91c9c 39
496f5d66 40 return 0;
ea207ed3 41}