Ismael Luceno escribió:
> Jens Persson escribió:
>> This version doesn't not work for me. It doesn't even start. Not even if 
>> I put everything in default.runlevel. It's just saying in the beginning 
>> something about default, test  and fake. So I'm back with 0.6.8. Sorry I 
>> can't give you more help here.
> 
> The attached patch adds a new option (--fake), to activate the
> fake-mode, and removes the pid check, so it _should_ fix the problem...
> 

Well, this is the 2nd try, let me know if it works.

Index: src/initng_global.c
===================================================================
--- src/initng_global.c (revisión: 4598)
+++ src/initng_global.c (copia de trabajo)
@@ -30,6 +30,7 @@
 #include "initng_handler.h"
 #include "initng_static_service_types.h"
 #include "initng_static_event_types.h"
+#include "initng_main.h"
 
 /* HERE IS THE GLOBAL DEFINED STRUCT, WE OFTEN RELATE TO */
 s_global g;
@@ -40,7 +41,7 @@
  * This function initziates the global data struct, with some standard values.
  * This must be set before libinitng can be used in any way
  */
-void initng_global_new(int argc, char *argv[], char *env[], h_i_am i_am)
+void initng_global_new(int argc, char *argv[], char *env[])
 {
        int i;
 
@@ -56,7 +57,7 @@
        memset(&g, 0, sizeof(s_global));
 
        /* Set the i_am */
-       g.i_am = i_am;
+       g.i_am = I_AM_INIT;
 
        /* we want to keep a copy of the arguments passed to us, this will be 
overwritten by set_title() */
        g.Argc = argc;
@@ -140,6 +141,10 @@
           #endif
         */
 
+       /* when last service stopped, offer a sulogin */
+       g.when_out = THEN_SULOGIN;
+       initng_main_set_runlevel("default");
+
        /* parse all options, set in argv */
        initng_global_parse_argv(argv);
 }
@@ -181,16 +186,22 @@
                if (strcmp(opt, "verbose") == 0)
                        g.verbose = TRUE;
 #endif
-               if (strcmp(opt, "i_am_init") == 0)
-                       g.i_am = I_AM_INIT;
+
                if (strcmp(opt, "hot_reload") == 0)
                {
                        D_(" Will start after a hot reload ...\n");
                        g.hot_reload = TRUE;
                }
-               if (strcmp(opt, "i_am_not_init") == 0)
-                       g.i_am = I_AM_INIT;
 
+               if (strcmp(opt, "fake") == 0)
+               {
+                       W_("Initng is running in fake-mode, fake-default 
runlevel will be started instead.\n");
+                       g.i_am = I_AM_FAKE_INIT;
+                       /* when last service stopped, quit initng */
+                       g.when_out = THEN_QUIT;
+                       initng_main_set_runlevel("fake-default");
+               }
+
                if (strcmp(opt, "no_circular") == 0)
                        g.no_circular = TRUE;
 
Index: src/initng_global.h
===================================================================
--- src/initng_global.h (revisión: 4598)
+++ src/initng_global.h (copia de trabajo)
@@ -119,7 +119,7 @@
 extern s_global g;
 
 /* functions for initialize and free s_global g */
-void initng_global_new(int argc, char *argv[], char *env[], h_i_am i_am);
+void initng_global_new(int argc, char *argv[], char *env[]);
 void initng_global_free(void);
 
 /* fast macros to set entrys in g */
Index: src/main.c
===================================================================
--- src/main.c  (revisión: 4598)
+++ src/main.c  (copia de trabajo)
@@ -401,15 +401,8 @@
        /* get the time */
        gettimeofday(&last, NULL);
 
-       /* initialise global variables */
-       if (getpid() == 1)
-       {
-               initng_global_new(argc, argv, env, I_AM_INIT);
-       }
-       else
-       {
-               initng_global_new(argc, argv, env, I_AM_FAKE_INIT);
-       }
+       /* initialize global variables */
+       initng_global_new(argc, argv, env);
 
        if (getuid() != 0)
        {
@@ -455,11 +448,6 @@
                BOOT:
 #endif
 
-               /* when last service stopped, offer a sulogin */
-               g.when_out = THEN_SULOGIN;
-               if (!g.runlevel)
-                       initng_main_set_runlevel("default");
-
                if (!g.hot_reload)
                {
                        /* static function above, initialize the system */
@@ -467,13 +455,6 @@
                }
 
        }
-       else if (g.i_am == I_AM_FAKE_INIT)
-       {
-               /* when last service stopped, quit initng */
-               W_("Initng is running in fake-mode, fake-default runlevel will 
be started instead.\n");
-               g.when_out = THEN_QUIT;
-               initng_main_set_runlevel("fake-default");
-       }
 
        D_("MAIN_LOAD_MODULES\n");
        /* Load modules, if fails - launch sulogin and then try again */
Index: tools/itool.c
===================================================================
--- tools/itool.c       (revisión: 4598)
+++ tools/itool.c       (copia de trabajo)
@@ -99,7 +99,8 @@
           argv[1], argv[2]); */
 
        /* initialise global variables */
-       initng_global_new(argc, argv, env, I_AM_UTILITY);
+       initng_global_new(argc, argv, env);
+       g.i_am = I_AM_UTILITY;
 
        /* Load all plugins */
        if (!initng_load_module_load_all(INITNG_PLUGIN_DIR))
Index: devtool/test_parser.c
===================================================================
--- devtool/test_parser.c       (revisión: 4598)
+++ devtool/test_parser.c       (copia de trabajo)
@@ -95,7 +95,8 @@
        service_cache_h *current = NULL;
 
        /* initialise global variables */
-       initng_global_new(argc, argv, env, I_AM_UTILITY);
+       initng_global_new(argc, argv, env);
+       g.i_am = I_AM_UTILITY;
 
        if (!initng_load_module_load_all(INITNG_PLUGIN_DIR))
        {
@@ -308,7 +309,7 @@
        service = initng_common_parse_service(name);
        if (!service)
        {
-               /* unload all modules 
+               /* unload all modules
                   initng_unload_all_modules();
                   initng_free();
                   exit(2);
-- 
_______________________________________________
Initng mailing list
[email protected]
http://jw.dyndns.org/mailman/listinfo/initng

Reply via email to