gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r4829 - in GNUnet/src: setup setup/text util/boot


From: gnunet
Subject: [GNUnet-SVN] r4829 - in GNUnet/src: setup setup/text util/boot
Date: Mon, 28 May 2007 12:55:47 -0600 (MDT)

Author: grothoff
Date: 2007-05-28 12:55:47 -0600 (Mon, 28 May 2007)
New Revision: 4829

Modified:
   GNUnet/src/setup/gnunet-setup.c
   GNUnet/src/setup/text/conf.c
   GNUnet/src/setup/text/conf.h
   GNUnet/src/util/boot/startup.c
Log:
fixing mantis 1084

Modified: GNUnet/src/setup/gnunet-setup.c
===================================================================
--- GNUnet/src/setup/gnunet-setup.c     2007-05-28 18:55:21 UTC (rev 4828)
+++ GNUnet/src/setup/gnunet-setup.c     2007-05-28 18:55:47 UTC (rev 4829)
@@ -130,7 +130,7 @@
 }
 
 static const char * INFO =
-  "gnunet-setup [OPTIONS] config"
+  "gnunet-setup [OPTIONS] config generate-defaults "
 #if HAVE_DIALOG
   "|menuconfig|wizard-curses"
 #endif
@@ -150,6 +150,7 @@
    "config", "setup_text", "main_" ,
    "wizard-curses", "setup_curses", "wizard_curs_main",
    "wizard-gtk", "setup_gtk", "gtk_wizard_main",
+   "generate-defaults", "setup_text", "dump_",
    NULL,
 };
 

Modified: GNUnet/src/setup/text/conf.c
===================================================================
--- GNUnet/src/setup/text/conf.c        2007-05-28 18:55:21 UTC (rev 4828)
+++ GNUnet/src/setup/text/conf.c        2007-05-28 18:55:47 UTC (rev 4829)
@@ -601,3 +601,19 @@
   ioctl(0, TCSETS, &oldT);
   return 0;
 }
+
+
+/**
+ * Generate defaults, runs without user interaction.
+ */
+int dump_setup_text(int argc,
+                   const char **argv,
+                   struct PluginHandle * self,
+                   struct GE_Context * ectx,
+                   struct GC_Configuration * cfg,
+                   struct GNS_Context * gns,
+                   const char * filename,
+                   int is_daemon) {
+  return GC_write_configuration(cfg,
+                               filename);
+}

Modified: GNUnet/src/setup/text/conf.h
===================================================================
--- GNUnet/src/setup/text/conf.h        2007-05-28 18:55:21 UTC (rev 4828)
+++ GNUnet/src/setup/text/conf.h        2007-05-28 18:55:47 UTC (rev 4829)
@@ -40,4 +40,13 @@
                    const char * filename,
                    int is_daemon);
 
+int dump_setup_text(int argc,
+                   const char ** argv,
+                   struct PluginHandle * self,
+                   struct GE_Context * ectx,
+                   struct GC_Configuration * cfg,
+                   struct GNS_Context * gns,
+                   const char * filename,
+                   int is_daemon);
+
 #endif

Modified: GNUnet/src/util/boot/startup.c
===================================================================
--- GNUnet/src/util/boot/startup.c      2007-05-28 18:55:21 UTC (rev 4828)
+++ GNUnet/src/util/boot/startup.c      2007-05-28 18:55:47 UTC (rev 4829)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2006 Christian Grothoff (and other contributing authors)
+     (C) 2006, 2007 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -144,7 +144,9 @@
                struct GE_Context ** ectx,
                struct GC_Configuration ** cfg) {
   int i;
-  char *path;
+  char * path;
+  int is_daemon;
+  int ret;
 
   os_init(NULL);
 
@@ -155,6 +157,8 @@
   FREE(path);
   textdomain("GNUnet");
 #endif
+  is_daemon = 0 == strcmp(DEFAULT_DAEMON_CONFIG_FILE, *cfgFileName);
+
   /* during startup, log all warnings and higher
      for anybody to stderr */
   *ectx = GE_create_context_stderr(YES,
@@ -173,6 +177,26 @@
                           argv);
   if (i == -1)
     return -1;
+  if ( (YES != disk_file_test(*ectx, 
+                             *cfgFileName)) &&
+       (! is_daemon) ) {
+    char * run;
+    size_t max;
+    
+    max = 128 + strlen(*cfgFileName);
+    run = MALLOC(max);
+    SNPRINTF(run,
+            max,
+            "gnunet-setup -c %s generate-defaults");
+    if (0 != system(run)) 
+      GE_LOG(*ectx,
+            GE_ERROR | GE_USER | GE_IMMEDIATE,
+            _("Failed to run %s: %s %d\n"),
+            run,
+            strerror(errno),
+            WEXITSTATUS(ret));
+    FREE(run);  
+  }
   if (0 != GC_parse_configuration(*cfg,
                                  *cfgFileName))
     return -1;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]