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