From: Art Cancro Date: Sat, 7 Jul 2007 15:10:49 +0000 (+0000) Subject: When existing init scripts are detected during setup, X-Git-Tag: v7.86~3248 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=7861af968fb3ca7c6749f6d7fd6fc004b0e68ee7;p=citadel.git When existing init scripts are detected during setup, ask the user if he wants to leave them as-is. --- diff --git a/citadel/setup.c b/citadel/setup.c index 1435fc343..2415e5c4b 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -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"); diff --git a/webcit/setup.c b/webcit/setup.c index ca99f4ec4..5bb7fec16 100644 --- a/webcit/setup.c +++ b/webcit/setup.c @@ -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?"