* if /etc/init.d/ is not there, create the init script in our build prefix. This...
authorWilfried Göesgens <willi@citadel.org>
Tue, 16 Jan 2007 20:01:30 +0000 (20:01 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 16 Jan 2007 20:01:30 +0000 (20:01 +0000)
webcit/setup.c

index da9a1b973948f5ecc2ff80b8149656a0e14c9302..27176e961d47d67c92fd8954709afaf1b3ad66cb 100644 (file)
@@ -334,8 +334,9 @@ void install_init_scripts(void)
        char hostname[128];
        char portname[128];
        struct utsname my_utsname;
-
+       struct stat etcinitd;
        FILE *fp;
+       char *initfile = "/etc/init.d/webcit";
 
        /* Otherwise, prompt the user to create an entry. */
        snprintf(question, sizeof question,
@@ -356,7 +357,12 @@ void install_init_scripts(void)
         * in a previous install, if we are upgrading: read them out of
         * the existing init script.
         */
-       fp = fopen("/etc/init.d/webcit", "r");
+
+       if ((stat("/etc/init.d/",&etcinitd) == -1) && 
+           (errno == ENOENT))
+               initfile = PREFIX"/webcit.init";
+
+       fp = fopen(initfile, "r");
        if (fp != NULL) {
                while (fgets(buf, sizeof buf, fp) != NULL) {
                        if (strlen(buf) > 0) {