]> code.citadel.org Git - citadel.git/blobdiff - citadel/setup.c
When existing init scripts are detected during setup,
[citadel.git] / citadel / 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");