control: tag -1 + patch Hi Michael,
Michael Biebl <bi...@debian.org> writes: >>> Atm systemctl enable|disable does only operate on native .service files. >>> Michael Stapelberg has prepared patches to forward such enable requests >>> to update-rc.d for SysV services (and vice versa). Attached the patch to have it all in one place. -- Best regards, Michael
diff --git i/src/systemctl/systemctl.c w/src/systemctl/systemctl.c index fd9f580..7bab4e4 100644 --- i/src/systemctl/systemctl.c +++ w/src/systemctl/systemctl.c @@ -3645,7 +3645,6 @@ static int set_environment(DBusConnection *bus, char **args) { static int enable_sysv_units(char **args) { int r = 0; -#if defined(HAVE_SYSV_COMPAT) && defined(HAVE_CHKCONFIG) const char *verb = args[0]; unsigned f = 1, t = 1; LookupPaths paths = {}; @@ -3654,8 +3653,9 @@ static int enable_sysv_units(char **args) { return 0; if (!streq(verb, "enable") && - !streq(verb, "disable") && - !streq(verb, "is-enabled")) + !streq(verb, "disable")) + // update-rc.d currently does not provide is-enabled + //!streq(verb, "is-enabled")) return 0; /* Processes all SysV units, and reshuffles the array so that @@ -3671,7 +3671,7 @@ static int enable_sysv_units(char **args) { char *p; bool found_native = false, found_sysv; unsigned c = 1; - const char *argv[6] = { "/sbin/chkconfig", NULL, NULL, NULL, NULL }; + const char *argv[6] = { "/usr/sbin/update-rc.d", NULL, NULL, NULL, NULL }; char **k, *l, *q = NULL; int j; pid_t pid; @@ -3705,9 +3705,6 @@ static int enable_sysv_units(char **args) { break; } - if (found_native) - continue; - p = NULL; if (!isempty(arg_root)) asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name); @@ -3729,15 +3726,10 @@ static int enable_sysv_units(char **args) { /* Mark this entry, so that we don't try enabling it as native unit */ args[f] = (char*) ""; - log_info("%s is not a native service, redirecting to /sbin/chkconfig.", name); - - if (!isempty(arg_root)) - argv[c++] = q = strappend("--root=", arg_root); + log_info("%s is not a native service, redirecting to /usr/sbin/update-rc.d.", name); argv[c++] = path_get_file_name(p); - argv[c++] = - streq(verb, "enable") ? "on" : - streq(verb, "disable") ? "off" : "--level=5"; + argv[c++] = streq(verb, "enable") ? "defaults" : "remove"; argv[c] = NULL; l = strv_join((char**)argv, " "); @@ -3810,7 +3802,6 @@ finish: args[t] = NULL; -#endif return r; }