int setup_type;
char setup_directory[SIZ];
char init_entry[SIZ];
+int using_web_installer = 0;
/*
char looking_for[SIZ];
char question[SIZ];
char entryname[5];
- char listenport[128];
+ char http_port[128];
+ char https_port[128];
char hostname[128];
char portname[128];
"requests?\n\nYou can use the standard port (80) if you are "
"not running another\nweb server (such as Apache), otherwise "
"select another port.");
- sprintf(listenport, "2000");
- set_value(question, listenport);
+ sprintf(http_port, "2000");
+ set_value(question, http_port);
- /* Find out where Citadel is. */
+#ifdef HAVE_OPENSSL
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);
+ "On which port do you want WebCit to listen for HTTPS "
+ "requests?\n\nYou can use the standard port (443) if you are "
+ "not running another\nweb server (such as Apache), otherwise "
+ "select another port.");
+ sprintf(https_port, "443");
+ set_value(question, https_port);
+#endif
+
+ /* Find out where Citadel is. */
+ 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 */
+ /* Generate unique entry names for /etc/inittab */
snprintf(entryname, sizeof entryname, "c0");
do {
++entryname[1];
snprintf(buf, sizeof buf,
"grep %s: /etc/inittab >/dev/null 2>&1", entryname);
} while (system(buf) == 0);
+
/* Now write it out to /etc/inittab */
infp = fopen("/etc/inittab", "a");
display_error(strerror(errno));
} else {
fprintf(infp, "# Start the WebCit server...\n");
- fprintf(infp, "%s:2345:respawn:%s -p%s %s %s\n",
+ fprintf(infp, "h%s:2345:respawn:%s -p%s %s %s\n",
+ entryname, looking_for,
+ http_port, hostname, portname);
+#ifdef HAVE_OPENSSL
+ fprintf(infp, "s%s:2345:respawn:%s -p%s -s %s %s\n",
entryname, looking_for,
- listenport, hostname, portname);
+ https_port, hostname, portname);
+#endif
fclose(infp);
strcpy(init_entry, entryname);
}
/* 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)) {
/* 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.");