chiark / gitweb /
Remove SysV compat
authorAndy Wingo <wingo@pobox.com>
Wed, 8 Apr 2015 06:45:34 +0000 (08:45 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 08:58:27 +0000 (09:58 +0100)
src/shared/path-lookup.c
src/shared/path-lookup.h

index f6a127174ca61a408c572738825d4878fde58db0..83abf53faa9256d0bf5a05cfd7b537f50d84df6c 100644 (file)
@@ -218,8 +218,8 @@ static char** user_dirs(
         return tmp;
 }
 
-char **generator_paths(ManagerRunningAs running_as) {
-        if (running_as == MANAGER_USER)
+char **generator_paths(SystemdRunningAs running_as) {
+        if (running_as == SYSTEMD_USER)
                 return strv_new("/run/systemd/user-generators",
                                 "/etc/systemd/user-generators",
                                 "/usr/local/lib/systemd/user-generators",
@@ -235,7 +235,7 @@ char **generator_paths(ManagerRunningAs running_as) {
 
 int lookup_paths_init(
                 LookupPaths *p,
-                ManagerRunningAs running_as,
+                SystemdRunningAs running_as,
                 bool personal,
                 const char *root_dir,
                 const char *generator,
@@ -277,7 +277,7 @@ int lookup_paths_init(
                  * we include /lib in the search path for the system
                  * stuff but avoid it for user stuff. */
 
-                if (running_as == MANAGER_USER) {
+                if (running_as == SYSTEMD_USER) {
                         if (personal)
                                 unit_path = user_dirs(generator, generator_early, generator_late);
                         else
@@ -337,78 +337,8 @@ int lookup_paths_init(
                 p->unit_path = NULL;
         }
 
-        if (running_as == MANAGER_SYSTEM) {
-#ifdef HAVE_SYSV_COMPAT
-                /* /etc/init.d/ compatibility does not matter to users */
-
-                e = getenv("SYSTEMD_SYSVINIT_PATH");
-                if (e) {
-                        p->sysvinit_path = path_split_and_make_absolute(e);
-                        if (!p->sysvinit_path)
-                                return -ENOMEM;
-                } else
-                        p->sysvinit_path = NULL;
-
-                if (strv_isempty(p->sysvinit_path)) {
-                        strv_free(p->sysvinit_path);
-
-                        p->sysvinit_path = strv_new(
-                                        SYSTEM_SYSVINIT_PATH,     /* /etc/init.d/ */
-                                        NULL);
-                        if (!p->sysvinit_path)
-                                return -ENOMEM;
-                }
-
-                e = getenv("SYSTEMD_SYSVRCND_PATH");
-                if (e) {
-                        p->sysvrcnd_path = path_split_and_make_absolute(e);
-                        if (!p->sysvrcnd_path)
-                                return -ENOMEM;
-                } else
-                        p->sysvrcnd_path = NULL;
-
-                if (strv_isempty(p->sysvrcnd_path)) {
-                        strv_free(p->sysvrcnd_path);
-
-                        p->sysvrcnd_path = strv_new(
-                                        SYSTEM_SYSVRCND_PATH,     /* /etc/rcN.d/ */
-                                        NULL);
-                        if (!p->sysvrcnd_path)
-                                return -ENOMEM;
-                }
-
-                if (!path_strv_resolve_uniq(p->sysvinit_path, root_dir))
-                        return -ENOMEM;
-
-                if (!path_strv_resolve_uniq(p->sysvrcnd_path, root_dir))
-                        return -ENOMEM;
-
-                if (!strv_isempty(p->sysvinit_path)) {
-                        _cleanup_free_ char *t = strv_join(p->sysvinit_path, "\n\t");
-                        if (!t)
-                                return -ENOMEM;
-                        log_debug("Looking for SysV init scripts in:\n\t%s", t);
-                } else {
-                        log_debug("Ignoring SysV init scripts.");
-                        strv_free(p->sysvinit_path);
-                        p->sysvinit_path = NULL;
-                }
-
-                if (!strv_isempty(p->sysvrcnd_path)) {
-                        _cleanup_free_ char *t =
-                                strv_join(p->sysvrcnd_path, "\n\t");
-                        if (!t)
-                                return -ENOMEM;
-
-                        log_debug("Looking for SysV rcN.d links in:\n\t%s", t);
-                } else {
-                        log_debug("Ignoring SysV rcN.d links.");
-                        strv_free(p->sysvrcnd_path);
-                        p->sysvrcnd_path = NULL;
-                }
-#else
+        if (running_as == SYSTEMD_SYSTEM) {
                 log_debug("SysV init scripts and rcN.d links support disabled");
-#endif
         }
 
         return 0;
@@ -419,12 +349,6 @@ void lookup_paths_free(LookupPaths *p) {
 
         strv_free(p->unit_path);
         p->unit_path = NULL;
-
-#ifdef HAVE_SYSV_COMPAT
-        strv_free(p->sysvinit_path);
-        strv_free(p->sysvrcnd_path);
-        p->sysvinit_path = p->sysvrcnd_path = NULL;
-#endif
 }
 
 int lookup_paths_init_from_scope(LookupPaths *paths,
@@ -437,7 +361,7 @@ int lookup_paths_init_from_scope(LookupPaths *paths,
         zero(*paths);
 
         return lookup_paths_init(paths,
-                                 scope == UNIT_FILE_SYSTEM ? MANAGER_SYSTEM : MANAGER_USER,
+                                 scope == UNIT_FILE_SYSTEM ? SYSTEMD_SYSTEM : SYSTEMD_USER,
                                  scope == UNIT_FILE_USER,
                                  root_dir,
                                  NULL, NULL, NULL);
index e35c8d3c046a83dd892a977afa1a286fe5a12bdc..f4f9895bb4256ea787ac99643afba1f95a54e259 100644 (file)
 
 typedef struct LookupPaths {
         char **unit_path;
-#ifdef HAVE_SYSV_COMPAT
-        char **sysvinit_path;
-        char **sysvrcnd_path;
-#endif
 } LookupPaths;
 
 typedef enum ManagerRunningAs {