[systemd-commits] 2 commits - src/service.c

Kay Sievers kay at kemper.freedesktop.org
Thu Dec 16 05:34:09 PST 2010


 src/service.c |   32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

New commits:
commit e1992852c8d540f2d9ec3c04a8d9cee791fd8b10
Author: Kay Sievers <kay.sievers at vrfy.org>
Date:   Thu Dec 16 14:29:34 2010 +0100

    service: ifdef distro-specific compat logic

diff --git a/src/service.c b/src/service.c
index 620f2b3..ca0db8e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -855,9 +855,10 @@ static int service_load_sysv_name(Service *s, const char *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. */
         if (startswith(name, "boot.") ||
+            startswith(name, "rc.") ||
             endswith(name, ".sh.service"))
                 return -ENOENT;
 
@@ -873,36 +874,42 @@ static int service_load_sysv_name(Service *s, const char *name) {
 
                 r = service_load_sysv_path(s, path);
 
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU)
                 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);
                 }
-
+#endif
                 free(path);
 
+#ifdef TARGET_SUSE
                 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;
 
+                        /* Drop .service suffix */
                         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) {
-                        /* Try Frugalware style rc.xxx init scripts */
+                        /* Try Frugalware style rc.* init scripts */
 
                         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);
                 }
+#endif
 
                 if (r < 0)
                         return r;

commit 65530632c7e40bc369edcba8f014ec9136c8eb02
Author: Miklos Vajna <vmiklos at frugalware.org>
Date:   Tue Dec 7 22:51:21 2010 +0100

    service: drop rc. prefix on frugalware linux

diff --git a/src/service.c b/src/service.c
index 1f478f4..620f2b3 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");
@@ -887,6 +892,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;
 



More information about the systemd-commits mailing list