* Allow setup to run seamlessly from within the Citadel/UX Ridiculously
authorArt Cancro <ajc@citadel.org>
Tue, 20 Apr 2004 02:32:44 +0000 (02:32 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 20 Apr 2004 02:32:44 +0000 (02:32 +0000)
  Easy Installer by observing the values of environment variables
  CITADEL_INSTALLER, CITADEL, and WEBCIT.

webcit/ChangeLog
webcit/setup.c

index 69f2ab94628230d63d5eddfadbe01b947b704040..7fdfb112ff51ec59c6c70c2d65fafa9067a001a8 100644 (file)
@@ -1,4 +1,9 @@
 $Log$
+Revision 506.7  2004/04/20 02:32:44  ajc
+* Allow setup to run seamlessly from within the Citadel/UX Ridiculously
+  Easy Installer by observing the values of environment variables
+  CITADEL_INSTALLER, CITADEL, and WEBCIT.
+
 Revision 506.6  2004/04/20 02:02:50  ajc
 * "make install"
 
@@ -1776,3 +1781,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index 2bb76df2b1f2754b8b7ae07a42d40b1378d55ec5..5d08633b66b21cd9ecd23db0c8fa7f50b7b43258 100644 (file)
@@ -37,6 +37,7 @@
 int setup_type;
 char setup_directory[SIZ];
 char init_entry[SIZ];
+int using_web_installer = 0;
 
 
 /*
@@ -414,20 +415,26 @@ void check_inittab_entry(void)
        set_value(question, listenport);
 
        /* Find out where Citadel is. */
-       snprintf(question, sizeof question,
-               "Is the Citadel service running on the same host as WebCit?");
-       if (yesno(question)) {
-               sprintf(hostname, "uds");
-               sprintf(portname, "/usr/local/citadel");
-               set_value("In what directory is Citadel installed?", portname);
+       if ( (using_web_installer) && (getenv("CITADEL") != NULL) ) {
+               strcpy(hostname, "uds");
+               strcpy(portname, getenv("CITADEL"));
        }
        else {
-               sprintf(hostname, "127.0.0.1");
-               sprintf(portname, "504");
-               set_value("Enter the host name or IP address of your "
-                       "Citadel server.", hostname);
-               set_value("Enter the port number on which Citadel is "
-                       "running (usually 504)", portname);
+               snprintf(question, sizeof question,
+                       "Is the Citadel service running on the same host as WebCit?");
+               if (yesno(question)) {
+                       sprintf(hostname, "uds");
+                       sprintf(portname, "/usr/local/citadel");
+                       set_value("In what directory is Citadel installed?", portname);
+               }
+               else {
+                       sprintf(hostname, "127.0.0.1");
+                       sprintf(portname, "504");
+                       set_value("Enter the host name or IP address of your "
+                               "Citadel server.", hostname);
+                       set_value("Enter the port number on which Citadel is "
+                               "running (usually 504)", portname);
+               }
        }
 
        /* Generate a unique entry name for /etc/inittab */
@@ -492,6 +499,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)) {
@@ -521,8 +533,13 @@ int main(int argc, char *argv[])
 
        /* Get started in a valid setup directory. */
        strcpy(setup_directory, WEBCITDIR);
-       set_value("In what directory is WebCit installed?",
-               setup_directory);
+       if ( (using_web_installer) && (getenv("WEBCIT") != NULL) ) {
+               strcpy(setup_directory, getenv("WEBCIT"));
+       }
+       else {
+               set_value("In what directory is WebCit installed?",
+                       setup_directory);
+       }
        if (chdir(setup_directory) != 0) {
                important_message("WebCit Setup",
                          "The directory you specified does not exist.");