[systemd-devel] [PATCH] service: drop rc. prefix on frugalware linux
Miklos Vajna
vmiklos at frugalware.org
Tue Dec 7 13:51:21 PST 2010
---
Hi,
We need this change till our rc scripts are replaced by units, otherwise
for example syslog.service will be missing, as it'll be used as
rc.syslog.service.
src/service.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/service.c b/src/service.c
index 6b6ce30..dec47fd 100644
--- a/src/service.c
+++ b/src/service.c
@@ -248,6 +248,11 @@ static char *sysv_translate_name(const char *name) {
/* Drop Arch-style background prefix */
strcpy(stpcpy(r, name + 1), ".service");
#endif
+#ifdef TARGET_FRUGALWARE
+ else 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");
@@ -886,6 +891,18 @@ static int service_load_sysv_name(Service *s, const char *name) {
free(path);
}
+ if (r >= 0 && s->meta.load_state == UNIT_STUB) {
+ /* Try Frugalware style rc.xxx init scripts */
+
+ if (asprintf(&path, "%s/rc.%s", *p, name) < 0)
+ return -ENOMEM;
+
+ /* Drop .service suffix */
+ path[strlen(path)-8] = 0;
+ r = service_load_sysv_path(s, path);
+ free(path);
+ }
+
if (r < 0)
return r;
--
1.7.3.2
More information about the systemd-devel
mailing list