From 8525da4679dab7fb6b369b05a974f6c58250f17a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 12 Aug 2003 00:39:35 +0000 Subject: [PATCH] * setup now knows about lots of other mail programs it can disable (various flavors of Cyrus and Courier, for example) * setup now ensures that it really did startup/shutdown the Citadel service, and displays an error message when that fails. * "make install" now instructs the user run "setup" * Removed an old GDBM reference from the documentation --- citadel/ChangeLog | 9 +++++ citadel/Makefile.in | 2 + citadel/docs/citadel.html | 5 +-- citadel/setup.c | 80 +++++++++++++++++++++++++++++++++++++-- 4 files changed, 89 insertions(+), 7 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 8d3f8f8cb..6c1bd5753 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,12 @@ $Log$ + Revision 608.18 2003/08/12 00:39:35 ajc + * setup now knows about lots of other mail programs it can disable (various + flavors of Cyrus and Courier, for example) + * setup now ensures that it really did startup/shutdown the Citadel service, + and displays an error message when that fails. + * "make install" now instructs the user run "setup" + * Removed an old GDBM reference from the documentation + Revision 608.17 2003/08/05 03:06:58 ajc * Added a README.txt file because some Joker kept bugging me about it * Reloaded the code that extracts embedded URL's to a place where it'll @@ -4940,3 +4948,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 01dcfed66..87f9289d5 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -168,6 +168,8 @@ msgform: msgform.o .PHONY: install-data install-doc install-exec clean cleaner distclean install: install-exec install-data install-doc + echo Installation is complete. + echo Now go to your Citadel directory and run 'setup'. install-data: @for i in help messages network/spoolin network/spoolout \ diff --git a/citadel/docs/citadel.html b/citadel/docs/citadel.html index 5af3cbb87..899042ff9 100644 --- a/citadel/docs/citadel.html +++ b/citadel/docs/citadel.html @@ -696,9 +696,8 @@ If you wish to place it in a different directory, you can instead do:

If you've got Berkeley DB installed in a non-standard location, you can help the configure script find it by doing something like this:

./configure --with-db=/usr/local/BerkeleyDB-4.1
-

The configure script prefers Berkeley DB if it is available, but -will fall -back to GDBM if it has to.

+

Keep in mind that if you're using Berkeley DB from a non-standard location, +you'll have to make sure that location is available at runtime.

File permissions are always a bother to work with. You don't want Citadel to crash because someone couldn't access a file, but you also don't want shell users peeking into the binaries to do things like diff --git a/citadel/setup.c b/citadel/setup.c index 11dfd1054..44f9c9f35 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -541,7 +541,7 @@ void disable_other_mta(char *mta) { /* Offer to replace other MTA with the vastly superior Citadel :) */ snprintf(buf, sizeof buf, - "You appear to have the '%s' mail transport agent\n" + "You appear to have the '%s' email program\n" "running on your system. Would you like to disable it,\n" "allowing Citadel to handle your system's Internet mail\n" "instead?\n", @@ -559,6 +559,49 @@ void disable_other_mta(char *mta) { +/* + * Check to see if our server really works. Returns 0 on success. + */ +int test_server(void) { + char cmd[256]; + char cookie[256]; + FILE *fp; + char buf[4096]; + int found_it = 0; + + /* Generate a silly little cookie. We're going to write it out + * to the server and try to get it back. The cookie does not + * have to be secret ... just unique. + */ + sprintf(cookie, "%ld.%d", time(NULL), getpid()); + + sprintf(cmd, "%s/sendcommand -h%s ECHO %s 2>&1", + setup_directory, + setup_directory, + cookie); + + fp = popen(cmd, "r"); + if (fp == NULL) return(errno); + + while (fgets(buf, sizeof buf, fp) != NULL) { + if ( (buf[0]=='2') + && (strstr(buf, cookie) != NULL) ) { + ++found_it; + } + } + pclose(fp); + + if (found_it) { + return(0); + } + return(-1); +} + + + + + + void set_str_val(int msgpos, char str[]) { #ifdef HAVE_NEWT @@ -781,6 +824,15 @@ int main(int argc, char *argv[]) sleep(1); } + /* Make sure it's stopped. */ + if (test_server() == 0) { + important_message("Citadel/UX Setup", + "The Citadel service is still running.\n" + "Please stop the service manually and run " + "setup again."); + cleanup(1); + } + /* Now begin. */ switch (setup_type) { @@ -952,7 +1004,7 @@ NEW_INST: mkdir("netconfigs", 0700); /* Delete files and directories used by older Citadel versions */ - system("rm -fr ./chatpipes ./expressmsgs ./sessions 2>/dev/null"); + system("exec /bin/rm -fr ./rooms ./chatpipes ./expressmsgs ./sessions 2>/dev/null"); unlink("citadel.log"); unlink("weekly"); @@ -965,6 +1017,18 @@ NEW_INST: disable_other_mta("sendmail"); disable_other_mta("postfix"); disable_other_mta("qmail"); + disable_other_mta("cyrus"); + disable_other_mta("cyrmaster"); + disable_other_mta("saslauthd"); + disable_other_mta("mta"); + disable_other_mta("courier-imap"); + disable_other_mta("courier-imap-ssl"); + disable_other_mta("courier-authdaemon"); + disable_other_mta("courier-pop3"); + disable_other_mta("courier-pop3d"); + disable_other_mta("courier-pop"); + disable_other_mta("vmailmgrd"); + disable_other_mta("imapd"); #endif if ((pw = getpwuid(config.c_bbsuid)) == NULL) @@ -992,8 +1056,16 @@ NEW_INST: if (a == 0) start_the_service(); sleep(1); } - important_message("Setup finished", - "Setup is finished. You may now log in."); + if (test_server() == 0) { + important_message("Setup finished", + "Setup is finished. You may now log in."); + } + else { + important_message("Setup finished", + "Setup is finished, but the Citadel service " + "failed to start.\n" + "Go back and check your configuration."); + } } else { important_message("Setup finished", -- 2.39.2