]> code.citadel.org Git - citadel.git/blobdiff - citadel/setup.c
* Replaced all "Citadel/UX" references with "Citadel"
[citadel.git] / citadel / setup.c
index b69e06334fbcf51e723d2828b3e1be00a2ed02c2..038c5c3e225cafaf70baa7baeca3574ac2005327 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *
- * Citadel/UX setup utility
+ * Citadel setup utility
  *
  */
 
@@ -32,7 +32,7 @@
 #endif
 
 
-#define MAXSETUP 3     /* How many setup questions to ask */
+#define MAXSETUP 4     /* How many setup questions to ask */
 
 #define UI_TEXT                0       /* Default setup type -- text only */
 #define UI_SILENT      3       /* Silent running, for use in scripts */
 int setup_type;
 char setup_directory[SIZ];
 char init_entry[SIZ];
+int using_web_installer = 0;
 
 char *setup_titles[] =
 {
        "Citadel Home Directory",
        "System Administrator",
        "Citadel User ID",
+       "Server IP address",
        "Server port number",
 };
 
@@ -71,13 +73,18 @@ char *setup_text[] =
 "user ID.  Please specify that user ID here.  You may specify either a\n"
 "user name or a numeric UID.\n",
 
+"Specify the IP address on which your server will run.  If you leave this\n"
+"blank, or if you specify 0.0.0.0, Citadel will listen on all addresses.\n"
+"You can usually skip this unless you're running multiple instances of\n"
+"Citadel on the same computer.\n",
+
 "Specify the TCP port number on which your server will run.  Normally, this\n"
 "will be port 504, which is the official port assigned by the IANA for\n"
 "Citadel servers.  You'll only need to specify a different port number if\n"
 "you run multiple instances of Citadel on the same computer and there's\n"
 "something else already using port 504.\n",
 
-"Setup has detected that you currently have data files from a Citadel/UX\n"
+"Setup has detected that you currently have data files from a Citadel\n"
 "version 3.2x installation.  The program 'conv_32_40' can upgrade your\n"
 "files to version 4.0x format.\n"
 " Setup will now exit.  Please either run 'conv_32_40' or delete your data\n"
@@ -460,7 +467,7 @@ void check_inittab_entry(void)
        if (infp == NULL) {
                display_error(strerror(errno));
        } else {
-               fprintf(infp, "# Start the Citadel/UX server...\n");
+               fprintf(infp, "# Start the Citadel server...\n");
                fprintf(infp, "%s:2345:respawn:%s -h%s -x3 -llocal4\n",
                        entryname, looking_for, setup_directory);
                fclose(infp);
@@ -710,6 +717,10 @@ void edit_value(int curr)
                break;
 
        case 3:
+               set_str_val(curr, &config.c_ip_addr);
+               break;
+
+       case 4:
                set_int_val(curr, &config.c_port_number);
                break;
 
@@ -750,7 +761,7 @@ int discover_ui(void)
 #ifdef HAVE_NEWT
        newtInit();
        newtCls();
-       newtDrawRootText(0, 0, "Citadel/UX Setup");
+       newtDrawRootText(0, 0, "Citadel Setup");
        return UI_NEWT;
 #endif
        return UI_TEXT;
@@ -776,6 +787,11 @@ int main(int argc, char *argv[])
        /* set an invalid setup type */
        setup_type = (-1);
 
+        /* Check to see if we're running the web installer */
+       if (getenv("CITADEL_INSTALLER") != NULL) {
+               using_web_installer = 1;
+       }
+
        /* parse command line args */
        for (a = 0; a < argc; ++a) {
                if (!strncmp(argv[a], "-u", 2)) {
@@ -799,15 +815,21 @@ int main(int argc, char *argv[])
                setup_type = discover_ui();
        }
        if (info_only == 1) {
-               important_message("Citadel/UX Setup", CITADEL);
+               important_message("Citadel Setup", CITADEL);
                cleanup(0);
        }
 
        /* Get started in a valid setup directory. */
        strcpy(setup_directory, BBSDIR);
-       set_str_val(0, setup_directory);
+       if ( (using_web_installer) && (getenv("CITADEL") != NULL) ) {
+               strcpy(setup_directory, getenv("CITADEL"));
+       }
+       else {
+               set_str_val(0, setup_directory);
+       }
+
        if (chdir(setup_directory) != 0) {
-               important_message("Citadel/UX Setup",
+               important_message("Citadel Setup",
                          "The directory you specified does not exist.");
                cleanup(errno);
        }
@@ -824,7 +846,7 @@ int main(int argc, char *argv[])
 
        /* Make sure it's stopped. */
        if (test_server() == 0) {
-               important_message("Citadel/UX Setup",
+               important_message("Citadel Setup",
                        "The Citadel service is still running.\n"
                        "Please stop the service manually and run "
                        "setup again.");
@@ -836,7 +858,7 @@ int main(int argc, char *argv[])
 
        case UI_TEXT:
                printf("\n\n\n"
-                       "               *** Citadel/UX setup program ***\n\n");
+                       "               *** Citadel setup program ***\n\n");
                break;
 
        }
@@ -957,7 +979,7 @@ int main(int argc, char *argv[])
 
        /*
           if (setuid(config.c_bbsuid) != 0) {
-          important_message("Citadel/UX Setup",
+          important_message("Citadel Setup",
           "Failed to change the user ID to your Citadel user.");
           cleanup(errno);
           }
@@ -973,8 +995,8 @@ int main(int argc, char *argv[])
        }
 
        if (old_setup_level < 555) {
-               important_message("Citadel/UX Setup",
-                                 "This Citadel/UX installation is too old "
+               important_message("Citadel Setup",
+                                 "This Citadel installation is too old "
                                  "to be upgraded.");
                cleanup(1);
        }