gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7207 - in GNUnet/src: include setup setup/gtk setup/lib se


From: gnunet
Subject: [GNUnet-SVN] r7207 - in GNUnet/src: include setup setup/gtk setup/lib setup/qt util/os util/win
Date: Sat, 14 Jun 2008 08:10:10 -0600 (MDT)

Author: durner
Date: 2008-06-14 08:10:10 -0600 (Sat, 14 Jun 2008)
New Revision: 7207

Modified:
   GNUnet/src/include/gnunet_util_os.h
   GNUnet/src/setup/gnunet-win-tool.c
   GNUnet/src/setup/gtk/wizard_gtk.c
   GNUnet/src/setup/lib/wizard_util.c
   GNUnet/src/setup/lib/wizard_util.h
   GNUnet/src/setup/qt/gnunet-setup.ui
   GNUnet/src/setup/qt/setupWizard.cc
   GNUnet/src/util/os/osconfig.c
   GNUnet/src/util/win/win.cc
Log:
add autostart option for gnunet-quto-share to wizard-qt

Modified: GNUnet/src/include/gnunet_util_os.h
===================================================================
--- GNUnet/src/include/gnunet_util_os.h 2008-06-14 13:52:57 UTC (rev 7206)
+++ GNUnet/src/include/gnunet_util_os.h 2008-06-14 14:10:10 UTC (rev 7207)
@@ -199,6 +199,8 @@
  *           enabled
  * @param doAutoStart GNUNET_YES to enable autostart of the
  *        application, GNUNET_NO to disable it
+ * @param servicename name of the service as displayed by the OS
+ * @param application path to service binary
  * @param username name of the user account to use
  * @param groupname name of the group to use
  * @returns GNUNET_YES on success, GNUNET_NO if unsupported, GNUNET_SYSERR on 
failure or one of
@@ -212,11 +214,13 @@
  *  Unix
  *    2 startup script could not be opened
  */
-int GNUNET_configure_autostart (struct GNUNET_GE_Context *ectx,
-                                int testCapability,
-                                int doAutoStart,
-                                const char *application,
-                                const char *username, const char *groupname);
+int
+GNUNET_configure_autostart (struct GNUNET_GE_Context *ectx,
+                            int testCapability,
+                            int doAutoStart,
+                            const char *servicename,
+                            const char *application,
+                            const char *username, const char *groupname);
 
 /**
  * @brief Add or remove a service account for GNUnet

Modified: GNUnet/src/setup/gnunet-win-tool.c
===================================================================
--- GNUnet/src/setup/gnunet-win-tool.c  2008-06-14 13:52:57 UTC (rev 7206)
+++ GNUnet/src/setup/gnunet-win-tool.c  2008-06-14 14:10:10 UTC (rev 7207)
@@ -119,7 +119,7 @@
 void
 Install ()
 {
-  switch (InstallAsService (NULL))
+  switch (InstallAsService ("GNUnet"))
     {
     case 0:
       printf (_("GNUnet service installed successfully.\n"));
@@ -147,7 +147,7 @@
 void
 Uninstall ()
 {
-  switch (UninstallService ())
+  switch (UninstallService ("GNUnet"))
     {
     case 0:
       printf (_("Service deleted.\n"));

Modified: GNUnet/src/setup/gtk/wizard_gtk.c
===================================================================
--- GNUnet/src/setup/gtk/wizard_gtk.c   2008-06-14 13:52:57 UTC (rev 7206)
+++ GNUnet/src/setup/gtk/wizard_gtk.c   2008-06-14 14:10:10 UTC (rev 7207)
@@ -472,8 +472,8 @@
         return;
       }
 
-  if (GNUNET_GNS_wiz_autostart_service (doAutoStart, user_name, group_name) !=
-      GNUNET_OK)
+  if (GNUNET_GNS_wiz_autostart_service (err_ctx, GNUNET_SERVICE_TYPE_GNUNETD,
+      doAutoStart, user_name, group_name) != GNUNET_OK)
     {
 #ifndef MINGW
       showErr (_("Unable to change startup process:"), STRERROR (errno));

Modified: GNUnet/src/setup/lib/wizard_util.c
===================================================================
--- GNUnet/src/setup/lib/wizard_util.c  2008-06-14 13:52:57 UTC (rev 7206)
+++ GNUnet/src/setup/lib/wizard_util.c  2008-06-14 14:10:10 UTC (rev 7207)
@@ -26,6 +26,7 @@
 
 #include "platform.h"
 #include "gnunet_util.h"
+#include "wizard_util.h"
 
 
 /**
@@ -76,30 +77,42 @@
 
 /**
  * @brief Make GNUnet start automatically
+ * @param serviceType GNUNET_SERVICE_TYPE_xxx
  * @param doAutoStart true to enable autostart, false to disable it
  * @param username name of the user account to use
  * @param groupname name of the group to use
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 int
-GNUNET_GNS_wiz_autostart_service (int doAutoStart, char *username,
-                                  char *groupname)
+GNUNET_GNS_wiz_autostart_service (struct GNUNET_GE_Context *ectx, int 
serviceType,
+                                  int doAutoStart, char *username, char 
*groupname)
 {
   int ret;
   char *exe;
+  char *name;
 
   exe = GNUNET_get_installation_path (GNUNET_IPK_BINDIR);
-  exe = (char *) GNUNET_realloc (exe, strlen (exe) + 12);       /* 11 = 
"gnunetd.exe" */
-  strcat (exe,
-#ifndef WINDOWS
-          "gnunetd");
-#else
-          "gnunetd.exe");
+  exe = (char *) GNUNET_realloc (exe, strlen (exe) + 22);       /* 11 = 
"gnunet-auto-share.exe" */
+  if (serviceType == GNUNET_SERVICE_TYPE_GNUNETD)
+    {
+      strcat(exe, "gnunetd");
+      name = "GNUnet";
+    }
+  else if (serviceType == GNUNET_SERVICE_TYPE_AUTOSHARE)
+    {
+      strcat(exe, "gnunet-auto-share");
+      name = "GNUnet Auto Share";
+    }
+  else
+    return GNUNET_SYSERR;
+    
+#ifdef WINDOWS
+  strcat (exe, ".exe");
 #endif
 
   ret =
-    GNUNET_configure_autostart (NULL /* FIXME 0.7.1 NILS */ , 0, doAutoStart,
-                                exe, username, groupname);
+    GNUNET_configure_autostart (ectx , 0, doAutoStart,
+                                name, exe, username, groupname);
   GNUNET_free (exe);
   if (ret != GNUNET_YES)
     {

Modified: GNUnet/src/setup/lib/wizard_util.h
===================================================================
--- GNUnet/src/setup/lib/wizard_util.h  2008-06-14 13:52:57 UTC (rev 7206)
+++ GNUnet/src/setup/lib/wizard_util.h  2008-06-14 14:10:10 UTC (rev 7207)
@@ -27,10 +27,13 @@
 #ifndef WIZARD_UTIL_H_
 #define WIZARD_UTIL_H_
 
+#define GNUNET_SERVICE_TYPE_GNUNETD 1
+#define GNUNET_SERVICE_TYPE_AUTOSHARE 2
+
 int GNUNET_GNS_wiz_is_nic_default (struct GNUNET_GC_Configuration *cfg,
                                    const char *name, int suggestion);
-int GNUNET_GNS_wiz_autostart_service (int doAutoStart, char *username,
-                                      char *groupname);
+int GNUNET_GNS_wiz_autostart_service (struct GNUNET_GE_Context *ectx, int 
serviceType,
+                                  int doAutoStart, char *username, char 
*groupname);
 int GNUNET_GNS_wiz_create_group_user (char *group_name, char *user_name);
 
 

Modified: GNUnet/src/setup/qt/gnunet-setup.ui
===================================================================
--- GNUnet/src/setup/qt/gnunet-setup.ui 2008-06-14 13:52:57 UTC (rev 7206)
+++ GNUnet/src/setup/qt/gnunet-setup.ui 2008-06-14 14:10:10 UTC (rev 7207)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>640</width>
-    <height>480</height>
+    <height>483</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -16,21 +16,12 @@
    <iconset resource="pixmaps/pixmaps.qrc" 
>:/pixmaps/gnunet-logo-small.png</iconset>
   </property>
   <layout class="QVBoxLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
    <property name="spacing" >
     <number>6</number>
    </property>
-   <property name="leftMargin" >
-    <number>9</number>
-   </property>
-   <property name="topMargin" >
-    <number>9</number>
-   </property>
-   <property name="rightMargin" >
-    <number>9</number>
-   </property>
-   <property name="bottomMargin" >
-    <number>9</number>
-   </property>
    <item>
     <widget class="QStackedWidget" name="stackedWidget" >
      <property name="currentIndex" >
@@ -38,21 +29,12 @@
      </property>
      <widget class="QWidget" name="page" >
       <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>9</number>
+       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
-       <property name="leftMargin" >
-        <number>9</number>
-       </property>
-       <property name="topMargin" >
-        <number>9</number>
-       </property>
-       <property name="rightMargin" >
-        <number>9</number>
-       </property>
-       <property name="bottomMargin" >
-        <number>9</number>
-       </property>
        <item>
         <widget class="QTextBrowser" name="htmlWelcome" />
        </item>
@@ -60,42 +42,24 @@
      </widget>
      <widget class="QWidget" name="page_2" >
       <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>9</number>
+       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
-       <property name="leftMargin" >
-        <number>9</number>
-       </property>
-       <property name="topMargin" >
-        <number>9</number>
-       </property>
-       <property name="rightMargin" >
-        <number>9</number>
-       </property>
-       <property name="bottomMargin" >
-        <number>9</number>
-       </property>
        <item>
         <widget class="QGroupBox" name="groupBox" >
          <property name="title" >
           <string>Network connection - enter information about your network 
connection here</string>
          </property>
          <layout class="QVBoxLayout" >
+          <property name="margin" >
+           <number>9</number>
+          </property>
           <property name="spacing" >
            <number>6</number>
           </property>
-          <property name="leftMargin" >
-           <number>9</number>
-          </property>
-          <property name="topMargin" >
-           <number>9</number>
-          </property>
-          <property name="rightMargin" >
-           <number>9</number>
-          </property>
-          <property name="bottomMargin" >
-           <number>9</number>
-          </property>
           <item>
            <widget class="QLabel" name="label" >
             <property name="frameShape" >
@@ -111,21 +75,12 @@
           </item>
           <item>
            <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>0</number>
-            </property>
-            <property name="topMargin" >
-             <number>0</number>
-            </property>
-            <property name="rightMargin" >
-             <number>0</number>
-            </property>
-            <property name="bottomMargin" >
-             <number>0</number>
-            </property>
             <item>
              <widget class="QLabel" name="label_2" >
               <property name="font" >
@@ -191,7 +146,7 @@
           <item>
            <widget class="QLabel" name="label_3" >
             <property name="text" >
-             <string>If your provider always assigns the same IP-Address to 
you (a "static" IP-Address), enter it into this field. If your IP-Address 
changes every now and then ("dynamic" IP-Address) but there's a hostname that 
always points to your actual IP-Address ("Dynamic DNS"), you can also enter it 
here.&#xd;
+             <string>If your provider always assigns the same IP-Address to 
you (a "static" IP-Address), enter it into this field. If your IP-Address 
changes every now and then ("dynamic" IP-Address) but there's a hostname that 
always points to your actual IP-Address ("Dynamic DNS"), you can also enter it 
here.
 If in doubt, leave the field empty. GNUnet will then try to determine your 
IP-Address.</string>
             </property>
             <property name="wordWrap" >
@@ -201,21 +156,12 @@
           </item>
           <item>
            <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>0</number>
-            </property>
-            <property name="topMargin" >
-             <number>0</number>
-            </property>
-            <property name="rightMargin" >
-             <number>0</number>
-            </property>
-            <property name="bottomMargin" >
-             <number>0</number>
-            </property>
             <item>
              <widget class="QLabel" name="label_4" >
               <property name="font" >
@@ -290,21 +236,12 @@
           </item>
           <item>
            <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>6</number>
-            </property>
-            <property name="topMargin" >
-             <number>6</number>
-            </property>
-            <property name="rightMargin" >
-             <number>6</number>
-            </property>
-            <property name="bottomMargin" >
-             <number>6</number>
-            </property>
             <item>
              <widget class="QCheckBox" name="cbSNAT" >
               <property name="font" >
@@ -345,42 +282,24 @@
      </widget>
      <widget class="QWidget" name="page_3" >
       <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>9</number>
+       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
-       <property name="leftMargin" >
-        <number>9</number>
-       </property>
-       <property name="topMargin" >
-        <number>9</number>
-       </property>
-       <property name="rightMargin" >
-        <number>9</number>
-       </property>
-       <property name="bottomMargin" >
-        <number>9</number>
-       </property>
        <item>
         <widget class="QGroupBox" name="groupBox_2" >
          <property name="title" >
           <string>Load limitation - limit GNUnet's ressource usage 
here</string>
          </property>
          <layout class="QVBoxLayout" >
+          <property name="margin" >
+           <number>9</number>
+          </property>
           <property name="spacing" >
            <number>6</number>
           </property>
-          <property name="leftMargin" >
-           <number>9</number>
-          </property>
-          <property name="topMargin" >
-           <number>9</number>
-          </property>
-          <property name="rightMargin" >
-           <number>9</number>
-          </property>
-          <property name="bottomMargin" >
-           <number>9</number>
-          </property>
           <item>
            <widget class="QLabel" name="label_6" >
             <property name="text" >
@@ -393,21 +312,12 @@
           </item>
           <item>
            <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>0</number>
-            </property>
-            <property name="topMargin" >
-             <number>0</number>
-            </property>
-            <property name="rightMargin" >
-             <number>0</number>
-            </property>
-            <property name="bottomMargin" >
-             <number>0</number>
-            </property>
             <item>
              <widget class="QLabel" name="label_7" >
               <property name="font" >
@@ -453,21 +363,12 @@
           </item>
           <item>
            <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>0</number>
-            </property>
-            <property name="topMargin" >
-             <number>0</number>
-            </property>
-            <property name="rightMargin" >
-             <number>0</number>
-            </property>
-            <property name="bottomMargin" >
-             <number>0</number>
-            </property>
             <item>
              <widget class="QLabel" name="label_8" >
               <property name="font" >
@@ -594,21 +495,12 @@
           </item>
           <item>
            <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>0</number>
-            </property>
-            <property name="topMargin" >
-             <number>0</number>
-            </property>
-            <property name="rightMargin" >
-             <number>0</number>
-            </property>
-            <property name="bottomMargin" >
-             <number>0</number>
-            </property>
             <item>
              <widget class="QLabel" name="label_10" >
               <property name="font" >
@@ -678,49 +570,31 @@
      </widget>
      <widget class="QWidget" name="page_4" >
       <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>9</number>
+       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
-       <property name="leftMargin" >
-        <number>9</number>
-       </property>
-       <property name="topMargin" >
-        <number>9</number>
-       </property>
-       <property name="rightMargin" >
-        <number>9</number>
-       </property>
-       <property name="bottomMargin" >
-        <number>9</number>
-       </property>
        <item>
         <widget class="QGroupBox" name="groupBox_3" >
          <property name="title" >
           <string>Security settings - specify the user and the group owning 
the GNUnet service here</string>
          </property>
          <layout class="QVBoxLayout" >
+          <property name="margin" >
+           <number>9</number>
+          </property>
           <property name="spacing" >
            <number>6</number>
           </property>
-          <property name="leftMargin" >
-           <number>9</number>
-          </property>
-          <property name="topMargin" >
-           <number>9</number>
-          </property>
-          <property name="rightMargin" >
-           <number>9</number>
-          </property>
-          <property name="bottomMargin" >
-           <number>9</number>
-          </property>
           <item>
            <widget class="QLabel" name="label_11" >
             <property name="text" >
-             <string>For security reasons, it is a good idea to let this setup 
create a new user account and a new group under which the GNUnet service is 
started at system startup.&#xd;
-&#xd;
-However, GNUnet may not be able to access files other than its own. This 
includes files you want to publish in GNUnet. You will have to grant read 
permissions to the user specified below.&#xd;
-&#xd;
+             <string>For security reasons, it is a good idea to let this setup 
create a new user account and a new group under which the GNUnet service is 
started at system startup.
+
+However, GNUnet may not be able to access files other than its own. This 
includes files you want to publish in GNUnet. You will have to grant read 
permissions to the user specified below.
+
 Leave the fields empty to run GNUnet with system privileges.</string>
             </property>
             <property name="wordWrap" >
@@ -730,21 +604,12 @@
           </item>
           <item>
            <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>0</number>
-            </property>
-            <property name="topMargin" >
-             <number>0</number>
-            </property>
-            <property name="rightMargin" >
-             <number>0</number>
-            </property>
-            <property name="bottomMargin" >
-             <number>0</number>
-            </property>
             <item>
              <widget class="QLabel" name="label_12" >
               <property name="font" >
@@ -790,21 +655,12 @@
           </item>
           <item>
            <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>0</number>
-            </property>
-            <property name="topMargin" >
-             <number>0</number>
-            </property>
-            <property name="rightMargin" >
-             <number>0</number>
-            </property>
-            <property name="bottomMargin" >
-             <number>0</number>
-            </property>
             <item>
              <widget class="QLabel" name="label_13" >
               <property name="font" >
@@ -868,46 +724,28 @@
      </widget>
      <widget class="QWidget" name="page_5" >
       <layout class="QVBoxLayout" >
+       <property name="margin" >
+        <number>9</number>
+       </property>
        <property name="spacing" >
         <number>6</number>
        </property>
-       <property name="leftMargin" >
-        <number>9</number>
-       </property>
-       <property name="topMargin" >
-        <number>9</number>
-       </property>
-       <property name="rightMargin" >
-        <number>9</number>
-       </property>
-       <property name="bottomMargin" >
-        <number>9</number>
-       </property>
        <item>
         <widget class="QGroupBox" name="groupBox_4" >
          <property name="title" >
           <string>Other settings</string>
          </property>
          <layout class="QVBoxLayout" >
+          <property name="margin" >
+           <number>9</number>
+          </property>
           <property name="spacing" >
            <number>6</number>
           </property>
-          <property name="leftMargin" >
-           <number>9</number>
-          </property>
-          <property name="topMargin" >
-           <number>9</number>
-          </property>
-          <property name="rightMargin" >
-           <number>9</number>
-          </property>
-          <property name="bottomMargin" >
-           <number>9</number>
-          </property>
           <item>
            <widget class="QLabel" name="label_14" >
             <property name="text" >
-             <string>GNUnet is able to store data from other peers in your 
datastore. This is useful if an adversary has access to your inserted content 
and you need to deny that the content is yours. With "content migration" on, 
the content could have "migrated" over the internet to your node without your 
knowledge.&#xd;
+             <string>GNUnet is able to store data from other peers in your 
datastore. This is useful if an adversary has access to your inserted content 
and you need to deny that the content is yours. With "content migration" on, 
the content could have "migrated" over the internet to your node without your 
knowledge.
 It also helps to spread popular content over different peers to enhance 
availability.</string>
             </property>
             <property name="wordWrap" >
@@ -961,21 +799,12 @@
           </item>
           <item>
            <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
             <property name="spacing" >
              <number>6</number>
             </property>
-            <property name="leftMargin" >
-             <number>0</number>
-            </property>
-            <property name="topMargin" >
-             <number>0</number>
-            </property>
-            <property name="rightMargin" >
-             <number>0</number>
-            </property>
-            <property name="bottomMargin" >
-             <number>0</number>
-            </property>
             <item>
              <widget class="QLabel" name="label_16" >
               <property name="font" >
@@ -1056,15 +885,47 @@
             <property name="orientation" >
              <enum>Qt::Vertical</enum>
             </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Fixed</enum>
+            </property>
             <property name="sizeHint" >
              <size>
               <width>20</width>
-              <height>40</height>
+              <height>20</height>
              </size>
             </property>
            </spacer>
           </item>
           <item>
+           <widget class="QCheckBox" name="cbAutoshare" >
+            <property name="font" >
+             <font>
+              <weight>75</weight>
+              <bold>true</bold>
+             </font>
+            </property>
+            <property name="text" >
+             <string>Start republication process on computer startup</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <spacer>
+            <property name="orientation" >
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeType" >
+             <enum>QSizePolicy::Fixed</enum>
+            </property>
+            <property name="sizeHint" >
+             <size>
+              <width>20</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item>
            <widget class="QLabel" name="label_17" >
             <property name="text" >
              <string>If you are an experienced user, you may want to tweak 
your GNUnet installation using the enhanced configurator.</string>
@@ -1164,21 +1025,12 @@
    </item>
    <item>
     <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
      <property name="spacing" >
       <number>6</number>
      </property>
-     <property name="leftMargin" >
-      <number>0</number>
-     </property>
-     <property name="topMargin" >
-      <number>0</number>
-     </property>
-     <property name="rightMargin" >
-      <number>0</number>
-     </property>
-     <property name="bottomMargin" >
-      <number>0</number>
-     </property>
      <item>
       <spacer>
        <property name="orientation" >

Modified: GNUnet/src/setup/qt/setupWizard.cc
===================================================================
--- GNUnet/src/setup/qt/setupWizard.cc  2008-06-14 13:52:57 UTC (rev 7206)
+++ GNUnet/src/setup/qt/setupWizard.cc  2008-06-14 14:10:10 UTC (rev 7207)
@@ -224,7 +224,7 @@
     editUser->setText(user_name);
   if (group_name != NULL)
     editGroup->setText(group_name);
-  cap = GNUNET_configure_autostart (ectx, 1, 1, NULL, NULL, NULL);
+  cap = GNUNET_configure_autostart (ectx, 1, 1, NULL, NULL, NULL, NULL);
   cbAutostart->setEnabled(cap);
   cap = GNUNET_configure_user_account(1, 1, NULL, NULL);
   if (!cap) {
@@ -357,8 +357,8 @@
           return;
         }
   
-    if (GNUNET_GNS_wiz_autostart_service (cbAutostart->isChecked(), user_name, 
group_name) !=
-        GNUNET_OK)
+    if (GNUNET_GNS_wiz_autostart_service (ectx, GNUNET_SERVICE_TYPE_GNUNETD,
+        cbAutostart->isChecked(), user_name, group_name) != GNUNET_OK)
       {
 #ifndef Q_OS_WIN32
           QMessageBox::critical(this, tr("Error"), QString("Unable to change 
startup process: ") +
@@ -366,6 +366,15 @@
 #endif
       }
 
+    if (GNUNET_GNS_wiz_autostart_service (ectx, GNUNET_SERVICE_TYPE_AUTOSHARE,
+        cbAutoshare->isChecked(), user_name, group_name) != GNUNET_OK)
+      {
+#ifndef Q_OS_WIN32
+          QMessageBox::critical(this, tr("Error"), QString("Unable to change 
startup process for auto-share: ") +
+            STRERROR(errno));
+#endif
+      }    
+    
     GNUNET_free(user_name);
     GNUNET_free(group_name);
   

Modified: GNUnet/src/util/os/osconfig.c
===================================================================
--- GNUnet/src/util/os/osconfig.c       2008-06-14 13:52:57 UTC (rev 7206)
+++ GNUnet/src/util/os/osconfig.c       2008-06-14 14:10:10 UTC (rev 7207)
@@ -178,6 +178,8 @@
  *           enabled
  * @param doAutoStart GNUNET_YES to enable autostart of the
  *        application, GNUNET_NO to disable it
+ * @param servicename name of the service as displayed by the OS
+ * @param application path to service binary
  * @param username name of the user account to use
  * @param groupname name of the group to use
  * @returns GNUNET_YES on success, GNUNET_NO if unsupported, GNUNET_SYSERR on 
failure or one of
@@ -195,6 +197,7 @@
 GNUNET_configure_autostart (struct GNUNET_GE_Context *ectx,
                             int testCapability,
                             int doAutoStart,
+                            const char *servicename,
                             const char *application,
                             const char *username, const char *groupname)
 {
@@ -216,7 +219,7 @@
             username = NULL;
 
           /* Install service */
-          switch (InstallAsService (username))
+          switch (InstallAsService (servicename, application, username))
             {
             case 0:
               break;
@@ -255,7 +258,7 @@
                             0, KEY_EXECUTE, &hKey) == ERROR_SUCCESS)
             {
               if (RegSetValueEx (hKey,
-                                 "GNUnet",
+                                 servicename,
                                  0, REG_SZ, szPath,
                                  strlen (szPath)) != ERROR_SUCCESS)
                 return 5;
@@ -270,7 +273,7 @@
     {
       if (IsWinNT ())
         {
-          switch (UninstallService ())
+          switch (UninstallService (servicename))
             {
             case 0:
               break;
@@ -294,7 +297,7 @@
                             
"Software\\Microsoft\\Windows\\CurrentVersion\\Run",
                             0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS)
             {
-              RegDeleteValue (hKey, "GNUnet");
+              RegDeleteValue (hKey, servicename);
               RegCloseKey (hKey);
             }
           else
@@ -306,7 +309,12 @@
 #else
   struct stat buf;
   int ret;
+  char *initscipt;
 
+  initscript = (char *) MALLOC(strlen(servicename) + 13);
+  strcpy(initscript, "/etc/init.d/");
+  strcat(initscript, servicename);  
+  
   /* Unix */
   if ((ACCESS ("/usr/sbin/update-rc.d", X_OK) != 0))
     {
@@ -316,6 +324,7 @@
                                        GNUNET_GE_ERROR | GNUNET_GE_USER |
                                        GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE,
                                        "access", "/usr/sbin/update-rc.d");
+          FREE(initscript);
           return GNUNET_SYSERR;
         }
     }
@@ -323,7 +332,6 @@
   /* Debian */
   if (doAutoStart)
     {
-
       if (ACCESS (application, X_OK) != 0)
         {
           GNUNET_GE_LOG_STRERROR_FILE (ectx,
@@ -331,10 +339,11 @@
                                        GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE,
                                        "access", application);
         }
-      if (STAT ("/etc/init.d/gnunetd", &buf) == -1)
+      
+      if (STAT (initscript, &buf) == -1)
         {
           /* create init file */
-          FILE *f = FOPEN ("/etc/init.d/gnunetd", "w");
+          FILE *f = FOPEN (initscript, "w");
           if (f == NULL)
             {
               GNUNET_GE_LOG_STRERROR_FILE (ectx,
@@ -342,6 +351,7 @@
                                            GNUNET_GE_ADMIN |
                                            GNUNET_GE_IMMEDIATE, "fopen",
                                            "/etc/init.d/gnunetd");
+              FREE(initscript);
               return 2;
             }
 
@@ -351,45 +361,47 @@
                    "# Automatically created by %s\n"
                    "#\n"
                    "\n"
-                   "PIDFILE=/var/run/gnunetd/gnunetd.pid\n"
+                   "PIDFILE=/var/run/gnunetd/%s.pid\n"
                    "\n"
                    "case \"$1\" in\n"
                    "  start)\n"
-                   "   echo -n \"Starting GNUnet: \"\n"
+                   "   echo -n \"Starting %s: \"\n"
                    "   %s\n && echo ok || echo failed\n"
                    "   ;;\n"
                    "  stop)\n"
-                   "   echo -n \"Stopping GNUnet: \"\n"
+                   "   echo -n \"Stopping %s: \"\n"
                    "   kill `cat $PIDFILE`\n && echo ok || echo failed\n"
                    "   ;;\n"
                    "  reload)\n"
-                   "   echo -n \"Reloading GNUnet: \"\n"
+                   "   echo -n \"Reloading %s: \"\n"
                    "   kill -HUP `cat $PIDFILE`\n && echo ok || echo failed\n"
                    "   ;;\n"
                    "  restart|force-reload)\n"
-                   "   echo \"Restarting GNUnet: gnunetd...\"\n"
+                   "   echo \"Restarting %s...\"\n"
                    "   $0 stop\n"
                    "   sleep 1\n"
                    "   $0 start\n"
                    "   ;;\n"
                    "  *)\n"
-                   "   echo \"Usage: /etc/init.d/gnunetd 
{start|stop|reload|restart|force-reload}\" >&2\n"
+                   "   echo \"Usage: %s 
{start|stop|reload|restart|force-reload}\" >&2\n"
                    "   exit 1\n"
                    "   ;;\n"
-                   "\n" "esac\n" "exit 0\n", "gnunet-setup", application);
+                   "\n" "esac\n" "exit 0\n", "gnunet-setup", servicename, 
servicename, application,
+                     servicename, servicename, initscript);
           fclose (f);
-          if (0 != CHMOD ("/etc/init.d/gnunetd",
+          if (0 != CHMOD (initscript,
                           S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH))
             {
               GNUNET_GE_LOG_STRERROR_FILE (ectx,
                                            GNUNET_GE_WARNING | GNUNET_GE_USER
                                            | GNUNET_GE_ADMIN |
                                            GNUNET_GE_IMMEDIATE, "chmod",
-                                           "/etc/init.d/gnunetd");
+                                           initscript);
+              FREE(initscript);
               return GNUNET_SYSERR;
             }
         }
-      if (STAT ("/etc/init.d/gnunetd", &buf) != -1)
+      if (STAT (initscript, &buf) != -1)
         {
           errno = 0;
           if (ACCESS ("/usr/sbin/update-rc.d", W_OK) == 0)
@@ -417,6 +429,7 @@
                                      "/usr/sbin/update-rc.d gnunetd defaults",
                                      WEXITSTATUS (ret));
                     }
+                  FREE(initscript);
                   return GNUNET_SYSERR;
                 }
             }
@@ -445,20 +458,23 @@
                                      "/sbin/rc-update add gnunetd default",
                                      WEXITSTATUS (ret));
                     }
+                  FREE(initscript);
                   return GNUNET_SYSERR;
                 }
             }
         }
+      FREE(initscript);
       return GNUNET_YES;
     }
   else
     {                           /* REMOVE autostart */
-      if ((UNLINK ("/etc/init.d/gnunetd") == -1) && (errno != ENOENT))
+      if ((UNLINK (initscript) == -1) && (errno != ENOENT))
         {
           GNUNET_GE_LOG_STRERROR_FILE (ectx,
                                        GNUNET_GE_WARNING | GNUNET_GE_USER |
                                        GNUNET_GE_ADMIN | GNUNET_GE_IMMEDIATE,
-                                       "unlink", "/etc/init.d/gnunetd");
+                                       "unlink", initscript);
+          FREE(initscript);
           return GNUNET_SYSERR;
         }
       errno = 0;
@@ -471,6 +487,7 @@
                                            | GNUNET_GE_ADMIN |
                                            GNUNET_GE_IMMEDIATE, "system",
                                            "/usr/sbin/update-rc.d");
+              FREE(initscript);
               return GNUNET_SYSERR;
             }
         }
@@ -483,12 +500,15 @@
                                            | GNUNET_GE_ADMIN |
                                            GNUNET_GE_IMMEDIATE, "system",
                                            "/sbin/rc-update");
+              FREE(initscript);
               return GNUNET_SYSERR;
             }
         }
+      FREE(initscript);
       return GNUNET_YES;
     }
 #endif
+  FREE(initscript);
   return GNUNET_SYSERR;
 }
 

Modified: GNUnet/src/util/win/win.cc
===================================================================
--- GNUnet/src/util/win/win.cc  2008-06-14 13:52:57 UTC (rev 7206)
+++ GNUnet/src/util/win/win.cc  2008-06-14 14:10:10 UTC (rev 7207)
@@ -212,13 +212,15 @@
 
 /**
  * @brief Installs the Windows service
+ * @param servicename name of the service as diplayed by the SCM
+ * @param application path to the application binary
  * @param username the name of the service's user account
  * @returns 0 on success
  *          1 if the Windows version doesn't support services
  *          2 if the SCM could not be opened
  *          3 if the service could not be created
  */
-int InstallAsService(char *username)
+int InstallAsService(char *servicename, char *application, char *username)
 {
   SC_HANDLE hManager, hService;
   char szEXE[_MAX_PATH + 17] = "\"";
@@ -227,7 +229,7 @@
   if (! GNOpenSCManager)
     return 1;
 
-  plibc_conv_to_win_path("/bin/gnunetd.exe", szEXE + 1);
+  plibc_conv_to_win_path(application, szEXE + 1);
   strcat(szEXE, "\" --win-service");
   hManager = GNOpenSCManager(NULL, NULL, SC_MANAGER_CREATE_SERVICE);
   if (! hManager)
@@ -239,7 +241,7 @@
        sprintf(user, ".\\%s", username);
   }
 
-  hService = GNCreateService(hManager, (LPCTSTR) "GNUnet", (LPCTSTR) "GNUnet", 
0,
+  hService = GNCreateService(hManager, (LPCTSTR) servicename, (LPCTSTR) 
servicename, 0,
     SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, 
(LPCTSTR) szEXE,
     NULL, NULL, NULL, (LPCTSTR) user, (LPCTSTR) username);
   
@@ -256,13 +258,14 @@
 
 /**
  * @brief Uninstall Windows service
+ * @param servicename name of the service to delete
  * @returns 0 on success
  *          1 if the Windows version doesn't support services
  *          2 if the SCM could not be openend
  *          3 if the service cannot be accessed
  *          4 if the service cannot be deleted
  */
-int UninstallService()
+int UninstallService(char *servicename)
 {
   SC_HANDLE hManager, hService;
   
@@ -273,7 +276,7 @@
   if (! hManager)
     return 2;
 
-  if (! (hService = GNOpenService(hManager, (LPCTSTR) "GNUnet", DELETE)))
+  if (! (hService = GNOpenService(hManager, (LPCTSTR) servicename, DELETE)))
     if (GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST)
       return 3;
      else





reply via email to

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