summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ccbbc0f)
This should make it easier to get rid of that compat code later and
avoids problems like stripping of rc. from /etc/init.d/rc.local on
Debian.
if (!(r = new(char, strlen(name) + sizeof(".service"))))
return NULL;
if (!(r = new(char, strlen(name) + sizeof(".service"))))
return NULL;
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU)
+ if (endswith(name, ".sh"))
+ /* Drop Debian-style .sh suffix */
+ strcpy(stpcpy(r, name) - 3, ".service");
+#endif
+#ifdef TARGET_SUSE
if (startswith(name, "boot."))
/* Drop SuSE-style boot. prefix */
strcpy(stpcpy(r, name + 5), ".service");
if (startswith(name, "boot."))
/* Drop SuSE-style boot. prefix */
strcpy(stpcpy(r, name + 5), ".service");
- else if (endswith(name, ".sh"))
- /* Drop Debian-style .sh suffix */
- strcpy(stpcpy(r, name) - 3, ".service");
- else if (startswith(name, "@"))
+ if (startswith(name, "@"))
/* Drop Arch-style background prefix */
strcpy(stpcpy(r, name + 1), ".service");
#endif
#ifdef TARGET_FRUGALWARE
/* Drop Arch-style background prefix */
strcpy(stpcpy(r, name + 1), ".service");
#endif
#ifdef TARGET_FRUGALWARE
- else if (startswith(name, "rc."))
+ if (startswith(name, "rc."))
/* Drop Frugalware-style rc. prefix */
strcpy(stpcpy(r, name + 3), ".service");
#endif
/* Drop Frugalware-style rc. prefix */
strcpy(stpcpy(r, name + 3), ".service");
#endif
/* For SysV services we strip the boot.*, rc.* and *.sh
* prefixes/suffixes. */
/* For SysV services we strip the boot.*, rc.* and *.sh
* prefixes/suffixes. */
- if (startswith(name, "boot.") ||
- startswith(name, "rc.") ||
- endswith(name, ".sh.service"))
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU)
+ if (endswith(name, ".sh.service"))
+#endif
+
+#ifdef TARGET_SUSE
+ if (startswith(name, "boot."))
+ return -ENOENT;
+#endif
+
+#ifdef TARGET_FRUGALWARE
+ if (startswith(name, "rc."))
+ return -ENOENT;
+#endif
STRV_FOREACH(p, s->meta.manager->lookup_paths.sysvinit_path) {
char *path;
STRV_FOREACH(p, s->meta.manager->lookup_paths.sysvinit_path) {
char *path;