From b2f71f2d2d572d93a5416db67e4966b14a163c16 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Tue, 16 Jan 2007 20:01:30 +0000 Subject: [PATCH] * if /etc/init.d/ is not there, create the init script in our build prefix. This is for example for freebsd. --- webcit/setup.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/webcit/setup.c b/webcit/setup.c index da9a1b973..27176e961 100644 --- a/webcit/setup.c +++ b/webcit/setup.c @@ -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) { -- 2.39.2