When existing init scripts are detected during setup,
authorArt Cancro <ajc@citadel.org>
Sat, 7 Jul 2007 15:10:49 +0000 (15:10 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 7 Jul 2007 15:10:49 +0000 (15:10 +0000)
ask the user if he wants to leave them as-is.

citadel/setup.c
webcit/setup.c

index 1435fc34337a4b4a92db590d7980f709a7a572a9..2415e5c4bc518135f955e38991f4f5fb74aa1fb2 100644 (file)
@@ -379,10 +379,6 @@ void install_init_scripts(void)
        char *initfile = "/etc/init.d/citadel";
        char command[SIZ];
 
-       if (yesno("Would you like to automatically start Citadel at boot?\n", 1) == 0) {
-               return;
-       }
-
        if ((stat("/etc/init.d/", &etcinitd) == -1) && 
            (errno == ENOENT))
        {
@@ -393,6 +389,20 @@ void install_init_scripts(void)
                        initfile = "/etc/rc.d/init.d/citadel";
        }
 
+       fp = fopen(initfile, "r");
+       if (fp != NULL) {
+               if (yesno("Citadel already appears to be configured to start at boot.\n"
+                  "Would you like to keep your boot configuration as is?\n", 1) == 1) {
+                       return;
+               }
+               fclose(fp);
+               
+       }
+
+       if (yesno("Would you like to automatically start Citadel at boot?\n", 1) == 0) {
+               return;
+       }
+
        fp = fopen(initfile, "w");
        if (fp == NULL) {
                display_error("Cannot create /etc/init.d/citadel");
index ca99f4ec4cecdb83be5d73c4f0fd18ef72230b0f..5bb7fec168df40825a905386c9bcadfaef46ea9a 100644 (file)
@@ -339,6 +339,16 @@ void install_init_scripts(void)
        FILE *fp;
        char *initfile = "/etc/init.d/webcit";
 
+       fp = fopen(initfile, "r");
+       if (fp != NULL) {
+               if (yesno("WebCit already appears to be configured to start at boot.\n"
+                  "Would you like to keep your boot configuration as is?\n", 1) == 1) {
+                       return;
+               }
+               fclose(fp);
+               
+       }
+
        /* Otherwise, prompt the user to create an entry. */
        snprintf(question, sizeof question,
                "Would you like to automatically start WebCit at boot?"