X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fservice.c;h=a4e419b7953f7db3bbe7bcc49675df222db17e80;hb=425c608d5319cae993d786a3915064bbb580c17b;hp=3d2be96f5bd4df7dbaec6f6de04e5bf22d67b9c2;hpb=0979f2855c81d144d4c7d814678a5b5b2d34155b;p=elogind.git diff --git a/src/core/service.c b/src/core/service.c index 3d2be96f5..a4e419b79 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -321,16 +321,12 @@ static char *sysv_translate_name(const char *name) { if (!(r = new(char, strlen(name) + sizeof(".service")))) return NULL; -#if defined(TARGET_DEBIAN) || defined(TARGET_ANGSTROM) if (endswith(name, ".sh")) /* Drop Debian-style .sh suffix */ strcpy(stpcpy(r, name) - 3, ".service"); -#endif -#ifdef TARGET_FRUGALWARE if (startswith(name, "rc.")) /* Drop Frugalware-style rc. prefix */ strcpy(stpcpy(r, name + 3), ".service"); -#endif else /* Normal init scripts */ strcpy(stpcpy(r, name), ".service"); @@ -349,14 +345,11 @@ static int sysv_translate_facility(const char *name, const char *filename, char static const char * const table[] = { /* LSB defined facilities */ "local_fs", SPECIAL_LOCAL_FS_TARGET, -#if defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA) -#else /* Due to unfortunate name selection in Mandriva, * $network is provided by network-up which is ordered * after network which actually starts interfaces. * To break the loop, just ignore it */ "network", SPECIAL_NETWORK_TARGET, -#endif "named", SPECIAL_NSS_LOOKUP_TARGET, "portmap", SPECIAL_RPCBIND_TARGET, "remote_fs", SPECIAL_REMOTE_FS_TARGET, @@ -367,14 +360,8 @@ static int sysv_translate_facility(const char *name, const char *filename, char "mail-transfer-agent", SPECIAL_MAIL_TRANSFER_AGENT_TARGET, "x-display-manager", SPECIAL_DISPLAY_MANAGER_SERVICE, "null", NULL, - -#if defined(TARGET_DEBIAN) || defined(TARGET_ANGSTROM) "mail-transport-agent", SPECIAL_MAIL_TRANSFER_AGENT_TARGET, -#endif - -#ifdef TARGET_SUSE "smtp", SPECIAL_MAIL_TRANSFER_AGENT_TARGET, -#endif }; unsigned i; @@ -990,15 +977,9 @@ static int service_load_sysv_name(Service *s, const char *name) { /* For SysV services we strip the rc.* and *.sh * prefixes/suffixes. */ -#if defined(TARGET_DEBIAN) || defined(TARGET_ANGSTROM) if (endswith(name, ".sh.service")) return -ENOENT; -#endif - -#ifdef TARGET_FRUGALWARE if (startswith(name, "rc.")) - return -ENOENT; -#endif STRV_FOREACH(p, UNIT(s)->manager->lookup_paths.sysvinit_path) { char *path; @@ -1013,16 +994,13 @@ static int service_load_sysv_name(Service *s, const char *name) { r = service_load_sysv_path(s, path); -#if defined(TARGET_DEBIAN) || defined(TARGET_ANGSTROM) if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) { /* Try Debian style *.sh source'able init scripts */ strcat(path, ".sh"); r = service_load_sysv_path(s, path); } -#endif free(path); -#ifdef TARGET_FRUGALWARE if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) { /* Try Frugalware style rc.* init scripts */ @@ -1035,12 +1013,11 @@ static int service_load_sysv_name(Service *s, const char *name) { r = service_load_sysv_path(s, path); free(path); } -#endif if (r < 0) return r; - if ((UNIT(s)->load_state != UNIT_STUB)) + if (UNIT(s)->load_state != UNIT_STUB) break; } @@ -3342,71 +3319,6 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) { #ifdef HAVE_SYSV_COMPAT -#ifdef TARGET_SUSE -static void sysv_facility_in_insserv_conf(Manager *mgr) { - FILE *f=NULL; - int r; - - if (!(f = fopen("/etc/insserv.conf", "re"))) { - r = errno == ENOENT ? 0 : -errno; - goto finish; - } - - while (!feof(f)) { - char l[LINE_MAX], *t; - char **parsed = NULL; - - if (!fgets(l, sizeof(l), f)) { - if (feof(f)) - break; - - r = -errno; - log_error("Failed to read configuration file '/etc/insserv.conf': %s", strerror(-r)); - goto finish; - } - - t = strstrip(l); - if (*t != '$' && *t != '<') - continue; - - parsed = strv_split(t,WHITESPACE); - /* we ignore , not used, equivalent to X-Interactive */ - if (parsed && !startswith_no_case (parsed[0], "")) { - char *facility; - Unit *u; - if (sysv_translate_facility(parsed[0], NULL, &facility) < 0) - continue; - if ((u = manager_get_unit(mgr, facility)) && (u->type == UNIT_TARGET)) { - UnitDependency e; - char *dep = NULL, *name, **j; - - STRV_FOREACH (j, parsed+1) { - if (*j[0]=='+') { - e = UNIT_WANTS; - name = *j+1; - } - else { - e = UNIT_REQUIRES; - name = *j; - } - if (sysv_translate_facility(name, NULL, &dep) < 0) - continue; - - r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, e, dep, NULL, true); - free(dep); - } - } - free(facility); - } - strv_free(parsed); - } -finish: - if (f) - fclose(f); - -} -#endif - static int service_enumerate(Manager *m) { char **p; unsigned i; @@ -3552,10 +3464,6 @@ static int service_enumerate(Manager *m) { r = 0; -#ifdef TARGET_SUSE - sysv_facility_in_insserv_conf (m); -#endif - finish: free(path); free(fpath);