* 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:58 +0000 (20:01 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 16 Jan 2007 20:01:58 +0000 (20:01 +0000)
citadel/setup.c

index 9e6d19c3e7e450b23ab47ba412f1180df3f8f054..dabf100c72e45721d7340423f3d3065a2259848b 100644 (file)
@@ -374,13 +374,19 @@ void delete_inittab_entry(void)
  */
 void install_init_scripts(void)
 {
+       struct stat etcinitd;
        FILE *fp;
+       char *initfile = "/etc/init.d/citadel";
 
        if (yesno("Would you like to automatically start Citadel at boot?\n", 1) == 0) {
                return;
        }
 
-       fp = fopen("/etc/init.d/citadel", "w");
+       if ((stat("/etc/init.d/",&etcinitd) == -1) && 
+           (errno == ENOENT))
+               initfile = CTDLDIR"/citadel.init";
+
+       fp = fopen(initfile, "w");
        if (fp == NULL) {
                display_error("Cannot create /etc/init.d/citadel");
                return;