]> code.citadel.org Git - citadel.git/blobdiff - citadel/utils/setup.c
Remove preprocessor tests for OpenSSL. It's a requirement.
[citadel.git] / citadel / utils / setup.c
index 28f44798ed14fbfe62cd68766ddaf4ec0df97d36..a2839ca72d7a237dfa79d4d8f972d14d7a9ff941 100644 (file)
@@ -1,6 +1,6 @@
 // Citadel setup utility
 //
-// Copyright (c) 1987-2023 by the citadel.org team
+// Copyright (c) 1987-2024 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or disclosure
 // is subject to the terms of the GNU General Public License, version 3.
@@ -62,8 +62,8 @@ typedef enum _SetupStep {
        eMaxQuestions = 12
 } eSetupStep;
 
-///"CREATE_XINETD_ENTRY";
-/* Environment variables, don't translate! */
+// "CREATE_XINETD_ENTRY";
+// Environment variables, don't translate!
 const char *EnvNames [eMaxQuestions] = {
         "HOME_DIRECTORY",
        "SYSADMIN_NAME",
@@ -654,8 +654,9 @@ void unused_messages(void) {
                _("Setup is finished, but the Citadel server failed to start.\n"
                "Go back and check your configuration.\n")
        );
-       display_error(_("Restarting Citadel server to apply changes"));
-       display_error(_("Setup failed to restart Citadel server.  Please restart it manually."));
+       important_message(_("Setup finished"),
+               _("Setup is finished.  You may now start the server.")
+       );
 }
 
 
@@ -812,9 +813,52 @@ int main(int argc, char *argv[]) {
 
        check_xinetd_entry();   // Check /etc/xinetd.d/telnet
 
-       important_message(_("Setup finished"),
-               _("Setup is finished.  You may now start the server.")
-       );
+       // Restart citserver
+       activity = _("Restarting Citadel server to apply changes");
+       progress(activity, 0, 51);
+
+       serv_puts("TIME");
+       serv_gets(buf);
+       long original_start_time = extract_long(&buf[4], 3);
+
+       progress(activity, 1, 51);
+       serv_puts("DOWN");
+       progress(activity, 2, 51);
+       serv_gets(buf);
+       if (buf[0] != '2') {
+               display_error("%s\n", buf);
+               exit(6);
+       }
+
+       close(serv_sock);
+       serv_sock = (-1);
+
+       for (i=3; i<=6; ++i) {                                  // wait for server to shut down
+               progress(activity, i, 51);
+               sleep(1);
+       }
+
+       for (i=7; ((i<=48) && (serv_sock < 0)) ; ++i) {         // wait for server to start up
+               progress(activity, i, 51);
+               serv_sock = uds_connectsock(file_citadel_admin_socket);
+               sleep(1);
+       }
+
+       progress(activity, 49, 51);
+       serv_gets(buf);
+
+       progress(activity, 50, 51);
+       serv_puts("TIME");
+       serv_gets(buf);
+       long new_start_time = extract_long(&buf[4], 3);
+
+       close(serv_sock);
+       progress(activity, 51, 51);
+
+       if ((original_start_time == new_start_time) || (new_start_time <= 0)) {
+               display_error("%s\n", _("Setup failed to restart Citadel server.  Please restart it manually."));
+               exit(7);
+       }
 
        exit(0);
        return 0;