Mailing list header changes (fuck you Google)
[citadel.git] / webcit / setup.c
1 /*
2  * WebCit setup utility
3  * 
4  * (This is basically just an install wizard.  It's not required.)
5  */
6
7 #include "sysdep.h"
8 #include "webcit.h"
9 #include "webserver.h"
10
11
12 #define UI_TEXT         0       /* Default setup type -- text only */
13 #define UI_DIALOG       2       /* Use the 'dialog' program */
14 #define UI_SILENT       3       /* Silent running, for use in scripts */
15
16 int setup_type;
17 char setup_directory[SIZ];
18 int using_web_installer = 0;
19 char suggested_url[SIZ];
20
21 /* some copies... 
22 int syslog(int loglevel, const char *format, ...){return 0;} */
23 void wc_printf(const char *format,...){}
24
25 void RegisterNS(const char *NSName, long len, 
26                 int nMinArgs, 
27                 int nMaxArgs, 
28                 WCHandlerFunc HandlerFunc,
29                 WCPreevalFunc PreEvalFunc,
30                 int ContextRequired){}
31 void StrBufAppendTemplateStr(StrBuf *Target, 
32                              WCTemplputParams *TP,
33                              const char *Source, 
34                              int FormatTypeIndex){}
35 void RegisterHeaderHandler(const char *Name, long Len, Header_Evaluator F){}
36 pthread_key_t MyConKey;
37
38 #ifdef ENABLE_NLS
39
40 #ifdef HAVE_USELOCALE 
41 int localeoffset = 1;
42 #else
43 int localeoffset = 0;
44 #endif
45
46 #endif
47 /*
48  * Delete an entry from /etc/inittab
49  */
50 void delete_init_entry(char *which_entry)
51 {
52         char *inittab = NULL;
53         FILE *fp;
54         char buf[SIZ];
55         char entry[SIZ];
56         char levels[SIZ];
57         char state[SIZ];
58         char prog[SIZ];
59
60         inittab = strdup("");
61         if (inittab == NULL) return;
62
63         fp = fopen("/etc/inittab", "r");
64         if (fp == NULL) return;
65
66         while(fgets(buf, sizeof buf, fp) != NULL) {
67
68                 if (num_tokens(buf, ':') == 4) {
69                         extract_token(entry, buf, 0, ':', sizeof entry);
70                         extract_token(levels, buf, 1, ':', sizeof levels);
71                         extract_token(state, buf, 2, ':', sizeof state);
72                         extract_token(prog, buf, 3, ':', sizeof prog); /* includes 0x0a LF */
73
74                         if (!strcmp(entry, which_entry)) {
75                                 strcpy(state, "off");   /* disable it */
76                         }
77                 }
78
79                 inittab = realloc(inittab, strlen(inittab) + strlen(buf) + 2);
80                 if (inittab == NULL) {
81                         fclose(fp);
82                         return;
83                 }
84                 
85                 strcat(inittab, buf);
86         }
87         fclose(fp);
88         fp = fopen("/etc/inittab", "w");
89         if (fp != NULL) {
90                 fwrite(inittab, strlen(inittab), 1, fp);
91                 fclose(fp);
92                 kill(1, SIGHUP);        /* Tell init to re-read /etc/inittab */
93         }
94         free(inittab);
95 }
96
97
98
99
100 /* 
101  * Remove any /etc/inittab entries for webcit, because we don't
102  * start it that way anymore.
103  */
104 void delete_the_old_way(void) {
105         FILE *infp;
106         char buf[1024];
107         char looking_for[1024];
108         int have_entry = 0;
109         char entry[1024];
110         char prog[1024];
111         char init_entry[1024];
112
113
114         strcpy(init_entry, "");
115
116         /* Determine the fully qualified path name of webcit */
117         snprintf(looking_for, sizeof looking_for, "%s/webcit ", setup_directory);
118
119         /* Pound through /etc/inittab line by line.  Set have_entry to 1 if
120          * an entry is found which we believe starts webcit.
121          */
122         infp = fopen("/etc/inittab", "r");
123         if (infp == NULL) {
124                 return;
125         } else {
126                 while (fgets(buf, sizeof buf, infp) != NULL) {
127                         buf[strlen(buf) - 1] = 0;
128                         extract_token(entry, buf, 0, ':', sizeof entry);
129                         extract_token(prog, buf, 3, ':', sizeof prog);
130                         if (!strncasecmp(prog, looking_for,
131                            strlen(looking_for))) {
132                                 ++have_entry;
133                                 strcpy(init_entry, entry);
134                         }
135                 }
136                 fclose(infp);
137         }
138
139         /* Bail out if there's nothing to do. */
140         if (!have_entry) return;
141
142         delete_init_entry(init_entry);
143 }
144
145
146
147 void cleanup(int exitcode)
148 {
149         exit(exitcode);
150 }
151
152
153
154 void title(char *text)
155 {
156         if (setup_type == UI_TEXT) {
157                 printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<%s>\n", text);
158         }
159 }
160
161
162
163
164 int yesno(char *question, int default_value)
165 {
166         int i = 0;
167         int answer = 0;
168         char buf[SIZ] = "";
169
170         switch (setup_type) {
171
172         case UI_TEXT:
173                 do {
174                         printf("%s\nYes/No [%s] --> ",
175                                 question,
176                                 ( default_value ? "Yes" : "No" )
177                         );
178                         if (fgets(buf, sizeof buf, stdin))
179                         {
180                                 answer = tolower(buf[0]);
181                                 if ((buf[0]==0) || (buf[0]==13) || (buf[0]==10))
182                                         answer = default_value;
183                                 else if (answer == 'y')
184                                         answer = 1;
185                                 else if (answer == 'n')
186                                         answer = 0;
187                         }
188
189                 } while ((answer < 0) || (answer > 1));
190                 break;
191
192         case UI_DIALOG:
193                 sprintf(buf, "exec %s %s --yesno '%s' 15 75",
194                         getenv("CTDL_DIALOG"),
195                         ( default_value ? "" : "--defaultno" ),
196                         question);
197                 i = system(buf);
198                 if (i == 0) {
199                         answer = 1;
200                 }
201                 else {
202                         answer = 0;
203                 }
204                 break;
205
206         }
207         return (answer);
208 }
209
210
211
212
213 void set_value(char *prompt, char str[])
214 {
215         char buf[SIZ] = "";
216         char dialog_result[PATH_MAX];
217         char setupmsg[SIZ];
218         FILE *fp;
219
220         strcpy(setupmsg, "");
221
222         switch (setup_type) {
223         case UI_TEXT:
224                 title("WebCit setup");
225                 printf("\n%s\n", prompt);
226                 printf("This is currently set to:\n%s\n", str);
227                 printf("Enter new value or press return to leave unchanged:\n");
228                 if (fgets(buf, sizeof buf, stdin)) {
229                         buf[strlen(buf) - 1] = 0;
230                 }
231                 if (strlen(buf) != 0)
232                         strcpy(str, buf);
233                 break;
234         case UI_DIALOG:
235                 CtdlMakeTempFileName(dialog_result, sizeof dialog_result);
236                 sprintf(buf, "exec %s --inputbox '%s' 19 72 '%s' 2>%s",
237                         getenv("CTDL_DIALOG"),
238                         prompt,
239                         str,
240                         dialog_result);
241                 system(buf);
242                 fp = fopen(dialog_result, "r");
243                 if (fp != NULL) {
244                         if (fgets(str, sizeof buf, fp)){
245                                 if (str[strlen(str)-1] == 10) {
246                                         str[strlen(str)-1] = 0;
247                                 }
248                         }
249                         fclose(fp);
250                         unlink(dialog_result);
251                 }
252                 break;
253
254         }
255 }
256
257
258 extern const char *AvailLang[];
259 int GetLocalePrefs(void)
260 {
261         int nLocales;
262         StrBuf *Buf;
263         char buf[SIZ];
264         char dialog_result[PATH_MAX];
265         FILE *fp;
266         int i = 0;
267         int offs = 0;
268
269         nLocales = 0; 
270         while (!IsEmptyStr(AvailLang[nLocales]))
271                 nLocales++;
272
273         Buf = NewStrBuf();
274
275         StrBufAppendBufPlain(Buf, HKEY("Select the locale webcit should use : \n"), 0);
276 #ifdef HAVE_USELOCALE 
277         StrBufAppendBufPlain(Buf, HKEY(" 0 Let the user select it at the login prompt (default)\n"), 0);
278         offs ++;
279 #endif
280         for (i = 0; i < nLocales; i++) {
281                 StrBufAppendPrintf(Buf, " %ld: %s\n", i + offs, AvailLang[i]);
282
283         }
284
285         switch (setup_type) {
286         case UI_TEXT:
287                 title("WebCit setup");
288                 printf("\n%s\n", ChrPtr(Buf));
289                 printf("This is currently set to:\n%ld\n", 0L);
290                 printf("Enter new value or press return to leave unchanged:\n");
291                 if (fgets(buf, sizeof buf, stdin))
292                         return atoi(buf);
293                 break;
294
295         case UI_DIALOG:
296                 CtdlMakeTempFileName(dialog_result, sizeof dialog_result);
297                 sprintf(buf, "exec %s --inputbox '%s' 19 72 '%ld' 2>%s",
298                         getenv("CTDL_DIALOG"),
299                         ChrPtr(Buf),
300                         0L,
301                         dialog_result);
302                 system(buf);
303                 fp = fopen(dialog_result, "r");
304                 if (fp != NULL) {
305                         char *str = &buf[0];
306                         if (fgets(str, sizeof buf, fp)){
307                                 if (str[strlen(str)-1] == 10) {
308                                         str[strlen(str)-1] = 0;
309                                 }
310                         }
311                         fclose(fp);
312                         unlink(dialog_result);
313                         return atoi(buf);
314                 }
315                 break;
316
317         }
318         return 0;
319 }
320
321 void important_message(char *title, char *msgtext)
322 {
323         char buf[SIZ];
324
325         switch (setup_type) {
326
327         case UI_TEXT:
328                 printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
329                 printf("       %s \n\n%s\n\n", title, msgtext);
330                 printf("Press return to continue...");
331                 if (fgets(buf, sizeof buf, stdin));
332                 break;
333
334         case UI_DIALOG:
335                 sprintf(buf, "exec %s --msgbox '%s' 19 72",
336                         getenv("CTDL_DIALOG"),
337                         msgtext);
338                 system(buf);
339                 break;
340         }
341 }
342
343
344 void display_error(char *error_message)
345 {
346         important_message("Error", error_message);
347 }
348
349 void progress(char *text, long int curr, long int cmax)
350 {
351         static long dots_printed = 0L;
352         long a = 0;
353         char buf[SIZ];
354         static FILE *fp = NULL;
355
356         switch (setup_type) {
357
358         case UI_TEXT:
359                 if (curr == 0) {
360                         printf("%s\n", text);
361                         printf("..........................");
362                         printf("..........................");
363                         printf("..........................\r");
364                         fflush(stdout);
365                         dots_printed = 0;
366                 } else if (curr == cmax) {
367                         printf("\r%79s\n", "");
368                 } else {
369                         a = (curr * 100) / cmax;
370                         a = a * 78;
371                         a = a / 100;
372                         while (dots_printed < a) {
373                                 printf("*");
374                                 ++dots_printed;
375                                 fflush(stdout);
376                         }
377                 }
378                 break;
379
380         case UI_DIALOG:
381                 if (curr == 0) {
382                         sprintf(buf, "exec %s --gauge '%s' 7 72 0",
383                                 getenv("CTDL_DIALOG"),
384                                 text);
385                         fp = popen(buf, "w");
386                         if (fp != NULL) {
387                                 fprintf(fp, "0\n");
388                                 fflush(fp);
389                         }
390                 } 
391                 else if (curr == cmax) {
392                         if (fp != NULL) {
393                                 fprintf(fp, "100\n");
394                                 pclose(fp);
395                                 fp = NULL;
396                         }
397                 }
398                 else {
399                         a = (curr * 100) / cmax;
400                         if (fp != NULL) {
401                                 fprintf(fp, "%ld\n", a);
402                                 fflush(fp);
403                         }
404                 }
405                 break;
406         }
407 }
408
409
410
411
412 /*
413  * install_init_scripts()  -- Create and deploy SysV init scripts.
414  *
415  */
416 void install_init_scripts(void)
417 {
418 #ifdef ENABLE_NLS
419         int localechoice;
420 #endif
421         char question[1024];
422         char buf[256];
423         char http_port[128];
424 #ifdef HAVE_OPENSSL
425         char https_port[128];
426 #endif
427         char hostname[128];
428         char portname[128];
429         char command[SIZ];
430         struct utsname my_utsname;
431         struct stat etcinitd;
432         FILE *fp;
433         char *initfile = "/etc/init.d/webcit";
434
435         fp = fopen(initfile, "r");
436         if (fp != NULL) {
437                 if (yesno("WebCit already appears to be configured to start at boot.\n"
438                           "Would you like to keep your boot configuration as is?\n", 1) == 1) {
439                         return;
440                 }
441                 fclose(fp);
442                 
443         }
444
445         /* Otherwise, prompt the user to create an entry. */
446         snprintf(question, sizeof question,
447                  "Would you like to automatically start WebCit at boot?"
448                 );
449         if (yesno(question, 1) == 0)
450                 return;
451
452
453 #ifdef ENABLE_NLS
454
455         localechoice = GetLocalePrefs();
456
457 #endif
458         /* Defaults */
459         sprintf(http_port, "2000");
460 #ifdef HAVE_OPENSSL
461         sprintf(https_port, "443");
462 #endif
463         sprintf(hostname, "uds");
464         sprintf(portname, "/usr/local/citadel");
465
466         /* This is a very hackish way of learning the port numbers used
467          * in a previous install, if we are upgrading: read them out of
468          * the existing init script.
469          */
470         if ((stat("/etc/init.d/", &etcinitd) == -1) && 
471             (errno == ENOENT))
472         {
473                 if ((stat("/etc/rc.d/init.d/", &etcinitd) == -1) &&
474                     (errno == ENOENT))
475                         initfile = WEBCITDIR"/webcit.init";
476                 else
477                         initfile = "/etc/rc.d/init.d/webcit";
478         }
479
480         fp = fopen(initfile, "r");
481         if (fp != NULL) {
482                 while (fgets(buf, sizeof buf, fp) != NULL) {
483                         if (strlen(buf) > 0) {
484                                 buf[strlen(buf)-1] = 0; /* strip trailing cr */
485                         }
486                         if (!strncasecmp(buf, "HTTP_PORT=", 10)) {
487                                 safestrncpy(http_port, &buf[10], sizeof http_port);
488                         }
489 #ifdef HAVE_OPENSSL
490                         if (!strncasecmp(buf, "HTTPS_PORT=", 11)) {
491                                 safestrncpy(https_port, &buf[11], sizeof https_port);
492                         }
493 #endif
494                         if (!strncasecmp(buf, "CTDL_HOSTNAME=", 14)) {
495                                 safestrncpy(hostname, &buf[14], sizeof hostname);
496                         }
497                         if (!strncasecmp(buf, "CTDL_PORTNAME=", 14)) {
498                                 safestrncpy(portname, &buf[14], sizeof portname);
499                         }
500                 }
501                 fclose(fp);
502         }
503
504         /* Now ask for the port numbers */
505         snprintf(question, sizeof question,
506                  "On which port do you want WebCit to listen for HTTP "
507                  "requests?\n\nYou can use the standard port (80) if you are "
508                  "not running another\nweb server (such as Apache), otherwise "
509                  "select another port.");
510         set_value(question, http_port);
511         uname(&my_utsname);
512         sprintf(suggested_url, "http://%s:%s/", my_utsname.nodename, http_port);
513
514 #ifdef HAVE_OPENSSL
515         snprintf(question, sizeof question,
516                  "On which port do you want WebCit to listen for HTTPS "
517                  "requests?\n\nYou can use the standard port (443) if you are "
518                  "not running another\nweb server (such as Apache), otherwise "
519                  "select another port.");
520         set_value(question, https_port);
521 #endif
522
523         /* Find out where Citadel is. */
524         if ( (using_web_installer) && (getenv("CITADEL") != NULL) ) {
525                 strcpy(hostname, "uds");
526                 strcpy(portname, getenv("CITADEL"));
527         }
528         else {
529                 snprintf(question, sizeof question,
530                          "Is the Citadel service running on the same host as WebCit?");
531                 if (yesno(question, ((!strcasecmp(hostname, "uds")) ? 1 : 0))) {
532                         strcpy(hostname, "uds");
533                         if (atoi(portname) != 0) strcpy(portname, "/usr/local/citadel");
534                         set_value("In what directory is Citadel installed?", portname);
535                 }
536                 else {
537                         if (!strcasecmp(hostname, "uds")) strcpy(hostname, "127.0.0.1");
538                         if (atoi(portname) == 0) strcpy(portname, "504");
539                         set_value("Enter the host name or IP address of your "
540                                   "Citadel server.", hostname);
541                         set_value("Enter the port number on which Citadel is "
542                                   "running (usually 504)", portname);
543                 }
544         }
545
546
547         fp = fopen(initfile, "w");
548
549         fprintf(fp,     "#!/bin/sh\n"
550                 "\n"
551                 "# uncomment this to create coredumps as described in\n"
552                 "# http://www.citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files\n"
553                 "# ulimit -c unlimited\n"
554                         "WEBCIT_DIR=%s\n", setup_directory);
555         fprintf(fp,     "HTTP_PORT=%s\n", http_port);
556 #ifdef HAVE_OPENSSL
557         fprintf(fp,     "HTTPS_PORT=%s\n", https_port);
558 #endif
559         fprintf(fp,     "CTDL_HOSTNAME=%s\n", hostname);
560         fprintf(fp,     "CTDL_PORTNAME=%s\n", portname);
561
562 #ifdef ENABLE_NLS
563         
564         if (localechoice == 0) {
565 #ifdef HAVE_USELOCALE 
566                 fprintf(fp, "unset LANG\n");
567 #else
568                 fprintf(fp, "export WEBCIT_LANG=c\n");
569 #endif
570         }
571         else {
572                 fprintf(fp, "export WEBCIT_LANG=%s\n", AvailLang[localechoice - localeoffset]);
573
574         }
575 #else
576         fprintf(fp,     "# your system doesn't support locales\n");
577 #endif
578         fprintf(fp,     "\n"
579                         "\n"
580                         "case \"$1\" in\n"
581                         "\n"
582                         "start)         echo -n \"Starting WebCit... \"\n"
583                         "               if   $WEBCIT_DIR/webcit "
584                                                         "-D/var/run/webcit.pid "
585                                                         "-p$HTTP_PORT $CTDL_HOSTNAME $CTDL_PORTNAME\n"
586                         "               then\n"
587                         "                       echo \"ok\"\n"
588                         "               else\n"
589                         "                       echo \"failed\"\n"
590                         "               fi\n");
591 #ifdef HAVE_OPENSSL
592         fprintf(fp,     "               echo -n \"Starting WebCit SSL... \"\n"
593                         "               if  $WEBCIT_DIR/webcit "
594                                                         "-D/var/run/webcit-ssl.pid "
595                                                         "-s -p$HTTPS_PORT $CTDL_HOSTNAME $CTDL_PORTNAME\n"
596                         "               then\n"
597                         "                       echo \"ok\"\n"
598                         "               else\n"
599                         "                       echo \"failed\"\n"
600                         "               fi\n");
601 #endif
602         fprintf(fp,     "               ;;\n"
603                         "stop)          echo -n \"Stopping WebCit... \"\n"
604                         "               if kill `cat /var/run/webcit.pid 2>/dev/null` 2>/dev/null\n"
605                         "               then\n"
606                         "                       echo \"ok\"\n"
607                         "               else\n"
608                         "                       echo \"failed\"\n"
609                         "               fi\n"
610                         "               rm -f /var/run/webcit.pid 2>/dev/null\n");
611 #ifdef HAVE_OPENSSL
612         fprintf(fp,     "               echo -n \"Stopping WebCit SSL... \"\n"
613                         "               if kill `cat /var/run/webcit-ssl.pid 2>/dev/null` 2>/dev/null\n"
614                         "               then\n"
615                         "                       echo \"ok\"\n"
616                         "               else\n"
617                         "                       echo \"failed\"\n"
618                         "               fi\n"
619                         "               rm -f /var/run/webcit-ssl.pid 2>/dev/null\n");
620 #endif
621         fprintf(fp,     "               ;;\n"
622                         "restart)       $0 stop\n"
623                         "               $0 start\n"
624                         "               ;;\n"
625                         "*)             echo \"Usage: $0 {start|stop|restart}\"\n"
626                         "               exit 1\n"
627                         "               ;;\n"
628                         "esac\n"
629         );
630
631         fclose(fp);
632         chmod(initfile, 0755);
633
634         /* Set up the run levels. */
635         system("/bin/rm -f /etc/rc?.d/[SK]??webcit 2>/dev/null");
636         snprintf(command, sizeof(command), "for x in 2 3 4 5 ; do [ -d /etc/rc$x.d ] && ln -s %s /etc/rc$x.d/S84webcit ; done 2>/dev/null", initfile);
637         system(command);
638         snprintf(command, sizeof(command), "for x in 0 6 S; do [ -d /etc/rc$x.d ] && ln -s %s /etc/rc$x.d/K15webcit ; done 2>/dev/null", initfile);
639         system(command);
640
641 }
642
643
644
645
646 /*
647  * Figure out what type of user interface we're going to use
648  */
649 int discover_ui(void)
650 {
651
652         /* Use "dialog" if we have it */
653         if (getenv("CTDL_DIALOG") != NULL) {
654                 return UI_DIALOG;
655         }
656                 
657         return UI_TEXT;
658 }
659
660
661
662
663
664 int main(int argc, char *argv[])
665 {
666         int a;
667         char aaa[256];
668         int info_only = 0;
669
670         strcpy(suggested_url, "http://<your_host_name>:<port>/");
671
672         /* set an invalid setup type */
673         setup_type = (-1);
674
675         /* Check to see if we're running the web installer */
676         if (getenv("CITADEL_INSTALLER") != NULL) {
677                 using_web_installer = 1;
678         }
679
680         /* parse command line args */
681         for (a = 0; a < argc; ++a) {
682                 if (!strncmp(argv[a], "-u", 2)) {
683                         strcpy(aaa, argv[a]);
684                         strcpy(aaa, &aaa[2]);
685                         setup_type = atoi(aaa);
686                 }
687                 if (!strcmp(argv[a], "-i")) {
688                         info_only = 1;
689                 }
690                 if (!strcmp(argv[a], "-q")) {
691                         setup_type = UI_SILENT;
692                 }
693         }
694
695
696         /* If a setup type was not specified, try to determine automatically
697          * the best one to use out of all available types.
698          */
699         if (setup_type < 0) {
700                 setup_type = discover_ui();
701         }
702         if (info_only == 1) {
703                 important_message("WebCit Setup", "Welcome to WebCit setup");
704                 cleanup(0);
705         }
706
707         /* Get started in a valid setup directory. */
708         strcpy(setup_directory, WEBCITDIR);
709         if ( (using_web_installer) && (getenv("WEBCIT") != NULL) ) {
710                 strcpy(setup_directory, getenv("WEBCIT"));
711         }
712         else {
713                 set_value("In what directory is WebCit installed?",
714                         setup_directory);
715         }
716         if (chdir(setup_directory) != 0) {
717                 important_message("WebCit Setup",
718                           "The directory you specified does not exist.");
719                 cleanup(errno);
720         }
721
722         /*
723          * We used to start WebCit by putting it directly into /etc/inittab.
724          * Since some systems are moving away from init, we can't do this anymore.
725          */
726         progress("Removing obsolete /etc/inittab entries...", 0, 1);
727         delete_the_old_way();
728         progress("Removing obsolete /etc/inittab entries...", 1, 1);
729
730         /* Now begin. */
731         switch (setup_type) {
732
733         case UI_TEXT:
734                 printf("\n\n\n"
735                         "               *** WebCit setup program ***\n\n");
736                 break;
737
738         }
739
740         /* 
741          * If we're running on SysV, install init scripts.
742          */
743         if (!access("/var/run", W_OK)) {
744                 install_init_scripts();
745
746                 if (!access("/etc/init.d/webcit", X_OK)) {
747                         system("/etc/init.d/webcit stop");
748                         system("/etc/init.d/webcit start");
749                 }
750
751                 sprintf(aaa,
752                         "Setup is finished.  You may now log in.\n"
753                         "Point your web browser at %s\n", suggested_url
754                 );
755                 important_message("Setup finished", aaa);
756         }
757
758         else {
759                 important_message("Setup finished",
760                         "Setup is finished.  You may now start the server.");
761         }
762
763         cleanup(0);
764         return 0;
765 }