From: Wilfried Göesgens Date: Tue, 16 Jan 2007 20:01:58 +0000 (+0000) Subject: * if /etc/init.d/ is not there, create the init script in our build prefix. This... X-Git-Tag: v7.86~3668 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=3cc8a4d20354f4a7eb42af3864d794bad0582d0e;p=citadel.git * if /etc/init.d/ is not there, create the init script in our build prefix. This is for example for freebsd. --- diff --git a/citadel/setup.c b/citadel/setup.c index 9e6d19c3e..dabf100c7 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -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;