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