chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
specifier: at minimal test
[elogind.git]
/
src
/
service.c
diff --git
a/src/service.c
b/src/service.c
index 620f2b307ab20e345c7b2db1a340442fec5a3af2..9f2ee4192fff506d099539a8b450ca4e1fa9351d 100644
(file)
--- a/
src/service.c
+++ b/
src/service.c
@@
-237,19
+237,23
@@
static char *sysv_translate_name(const char *name) {
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");
+#endif
#ifdef TARGET_ARCH
#ifdef TARGET_ARCH
-
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
@@
-855,11
+859,22
@@
static int service_load_sysv_name(Service *s, const char *name) {
assert(s);
assert(name);
assert(s);
assert(name);
- /* For SysV services we strip the boot.
or
.sh
+ /* For SysV services we strip the boot.
*, rc.* and *
.sh
* prefixes/suffixes. */
* prefixes/suffixes. */
- if (startswith(name, "boot.") ||
- endswith(name, ".sh.service"))
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU)
+ if (endswith(name, ".sh.service"))
+ return -ENOENT;
+#endif
+
+#ifdef TARGET_SUSE
+ if (startswith(name, "boot."))
return -ENOENT;
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;
@@
-873,36
+888,42
@@
static int service_load_sysv_name(Service *s, const char *name) {
r = service_load_sysv_path(s, path);
r = service_load_sysv_path(s, path);
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU)
if (r >= 0 && s->meta.load_state == UNIT_STUB) {
if (r >= 0 && s->meta.load_state == UNIT_STUB) {
- /* Try Debian style
xxx
.sh source'able init scripts */
+ /* Try Debian style
*
.sh source'able init scripts */
strcat(path, ".sh");
r = service_load_sysv_path(s, path);
}
strcat(path, ".sh");
r = service_load_sysv_path(s, path);
}
-
+#endif
free(path);
free(path);
+#ifdef TARGET_SUSE
if (r >= 0 && s->meta.load_state == UNIT_STUB) {
if (r >= 0 && s->meta.load_state == UNIT_STUB) {
- /* Try SUSE style boot.
xxx
init scripts */
+ /* Try SUSE style boot.
*
init scripts */
if (asprintf(&path, "%s/boot.%s", *p, name) < 0)
return -ENOMEM;
if (asprintf(&path, "%s/boot.%s", *p, name) < 0)
return -ENOMEM;
+ /* Drop .service suffix */
path[strlen(path)-8] = 0;
r = service_load_sysv_path(s, path);
free(path);
}
path[strlen(path)-8] = 0;
r = service_load_sysv_path(s, path);
free(path);
}
+#endif
+#ifdef TARGET_FRUGALWARE
if (r >= 0 && s->meta.load_state == UNIT_STUB) {
if (r >= 0 && s->meta.load_state == UNIT_STUB) {
- /* Try Frugalware style rc.
xxx
init scripts */
+ /* Try Frugalware style rc.
*
init scripts */
if (asprintf(&path, "%s/rc.%s", *p, name) < 0)
return -ENOMEM;
if (asprintf(&path, "%s/rc.%s", *p, name) < 0)
return -ENOMEM;
- /* Drop .service suffix */
+
/* Drop .service suffix */
path[strlen(path)-8] = 0;
r = service_load_sysv_path(s, path);
free(path);
}
path[strlen(path)-8] = 0;
r = service_load_sysv_path(s, path);
free(path);
}
+#endif
if (r < 0)
return r;
if (r < 0)
return r;