summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-04-08 08:45:34 +0200
committerAndy Wingo <wingo@pobox.com>2015-04-08 08:45:34 +0200
commita3b23257872fe2f8cf99aa2da008f55ada583bb3 (patch)
tree5e567add541f736045ca70199089cc423764d321 /src
parent31ad69aaf459ac5f4d52c604ec2df7cb0793708e (diff)
Remove SysV compat
Diffstat (limited to 'src')
-rw-r--r--src/core/load-fragment.c37
-rw-r--r--src/core/main.c12
-rw-r--r--src/fsck/fsck.c23
-rw-r--r--src/quotacheck/quotacheck.c14
-rw-r--r--src/shared/build.h6
-rw-r--r--src/shared/path-lookup.c76
-rw-r--r--src/shared/path-lookup.h4
-rw-r--r--src/systemctl/systemctl.c120
8 files changed, 0 insertions, 292 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 07384d3668..1553f8cdae 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1107,38 +1107,6 @@ int config_parse_limit(const char *unit,
return 0;
}
-#ifdef HAVE_SYSV_COMPAT
-int config_parse_sysv_priority(const char *unit,
- const char *filename,
- unsigned line,
- const char *section,
- unsigned section_line,
- const char *lvalue,
- int ltype,
- const char *rvalue,
- void *data,
- void *userdata) {
-
- int *priority = data;
- int i, r;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
- assert(data);
-
- r = safe_atoi(rvalue, &i);
- if (r < 0 || i < 0) {
- log_syntax(unit, LOG_ERR, filename, line, -r,
- "Failed to parse SysV start priority, ignoring: %s", rvalue);
- return 0;
- }
-
- *priority = (int) i;
- return 0;
-}
-#endif
-
DEFINE_CONFIG_PARSE_ENUM(config_parse_kill_mode, kill_mode, KillMode, "Failed to parse kill mode");
int config_parse_kill_signal(const char *unit,
@@ -3684,9 +3652,7 @@ void unit_dump_config_items(FILE *f) {
const ConfigParserCallback callback;
const char *rvalue;
} table[] = {
-#if !defined(HAVE_SYSV_COMPAT) || !defined(HAVE_SECCOMP) || !defined(HAVE_PAM) || !defined(HAVE_SELINUX) || !defined(HAVE_SMACK) || !defined(HAVE_APPARMOR)
{ config_parse_warn_compat, "NOTSUPPORTED" },
-#endif
{ config_parse_int, "INTEGER" },
{ config_parse_unsigned, "UNSIGNED" },
{ config_parse_iec_size, "SIZE" },
@@ -3718,9 +3684,6 @@ void unit_dump_config_items(FILE *f) {
{ config_parse_exec, "PATH [ARGUMENT [...]]" },
{ config_parse_service_type, "SERVICETYPE" },
{ config_parse_service_restart, "SERVICERESTART" },
-#ifdef HAVE_SYSV_COMPAT
- { config_parse_sysv_priority, "SYSVPRIORITY" },
-#endif
{ config_parse_kill_mode, "KILLMODE" },
{ config_parse_kill_signal, "SIGNAL" },
{ config_parse_socket_listen, "SOCKET [...]" },
diff --git a/src/core/main.c b/src/core/main.c
index dd8b65083b..4fe0b7380b 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1226,18 +1226,6 @@ int main(int argc, char *argv[]) {
struct rlimit saved_rlimit_nofile = RLIMIT_MAKE_CONST(0);
const char *error_message = NULL;
-#ifdef HAVE_SYSV_COMPAT
- if (getpid() != 1 && strstr(program_invocation_short_name, "init")) {
- /* This is compatibility support for SysV, where
- * calling init as a user is identical to telinit. */
-
- errno = -ENOENT;
- execv(SYSTEMCTL_BINARY_PATH, argv);
- log_error_errno(errno, "Failed to exec " SYSTEMCTL_BINARY_PATH ": %m");
- return 1;
- }
-#endif
-
dual_timestamp_from_monotonic(&kernel_timestamp, 0);
dual_timestamp_get(&userspace_timestamp);
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 7eaf902e75..d0316b3afd 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -100,34 +100,11 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
log_warning("Invalid fsck.repair= parameter '%s'. Ignoring.", value);
}
-#ifdef HAVE_SYSV_COMPAT
- else if (streq(key, "fastboot") && !value) {
- log_warning("Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line.");
- arg_skip = true;
-
- } else if (streq(key, "forcefsck") && !value) {
- log_warning("Please pass 'fsck.mode=force' rather than 'forcefsck' on the kernel command line.");
- arg_force = true;
- }
-#endif
-
return 0;
}
static void test_files(void) {
-#ifdef HAVE_SYSV_COMPAT
- if (access("/fastboot", F_OK) >= 0) {
- log_error("Please pass 'fsck.mode=skip' on the kernel command line rather than creating /fastboot on the root file system.");
- arg_skip = true;
- }
-
- if (access("/forcefsck", F_OK) >= 0) {
- log_error("Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system.");
- arg_force = true;
- }
-#endif
-
}
static int process_progress(int fd, pid_t fsck_pid, dev_t device_num) {
diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c
index 819706a72f..a7e47dd32f 100644
--- a/src/quotacheck/quotacheck.c
+++ b/src/quotacheck/quotacheck.c
@@ -43,24 +43,10 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
log_warning("Invalid quotacheck.mode= parameter '%s'. Ignoring.", value);
}
-#ifdef HAVE_SYSV_COMPAT
- else if (streq(key, "forcequotacheck") && !value) {
- log_warning("Please use 'quotacheck.mode=force' rather than 'forcequotacheck' on the kernel command line.");
- arg_force = true;
- }
-#endif
-
return 0;
}
static void test_files(void) {
-
-#ifdef HAVE_SYSV_COMPAT
- if (access("/forcequotacheck", F_OK) >= 0) {
- log_error("Please pass 'quotacheck.mode=force' on the kernel command line rather than creating /forcequotacheck on the root file system.");
- arg_force = true;
- }
-#endif
}
int main(int argc, char *argv[]) {
diff --git a/src/shared/build.h b/src/shared/build.h
index 8b82ede290..b0a5a72467 100644
--- a/src/shared/build.h
+++ b/src/shared/build.h
@@ -57,12 +57,6 @@
#define _SMACK_FEATURE_ "-SMACK"
#endif
-#ifdef HAVE_SYSV_COMPAT
-#define _SYSVINIT_FEATURE_ "+SYSVINIT"
-#else
-#define _SYSVINIT_FEATURE_ "-SYSVINIT"
-#endif
-
#ifdef HAVE_LIBCRYPTSETUP
#define _LIBCRYPTSETUP_FEATURE_ "+LIBCRYPTSETUP"
#else
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index fb2c2c233a..83abf53faa 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -338,77 +338,7 @@ int lookup_paths_init(
}
if (running_as == SYSTEMD_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
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,
diff --git a/src/shared/path-lookup.h b/src/shared/path-lookup.h
index f1925eef69..2e0d3f7bda 100644
--- a/src/shared/path-lookup.h
+++ b/src/shared/path-lookup.h
@@ -27,10 +27,6 @@ typedef enum UnitFileScope UnitFileScope;
typedef struct LookupPaths {
char **unit_path;
-#ifdef HAVE_SYSV_COMPAT
- char **sysvinit_path;
- char **sysvrcnd_path;
-#endif
} LookupPaths;
typedef enum SystemdRunningAs {
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3158a38001..30dffecd38 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5038,126 +5038,6 @@ static int import_environment(sd_bus *bus, char **args) {
static int enable_sysv_units(const char *verb, char **args) {
int r = 0;
-#if defined(HAVE_SYSV_COMPAT) && defined(HAVE_CHKCONFIG)
- unsigned f = 0;
- _cleanup_lookup_paths_free_ LookupPaths paths = {};
-
- if (arg_scope != UNIT_FILE_SYSTEM)
- return 0;
-
- if (!streq(verb, "enable") &&
- !streq(verb, "disable") &&
- !streq(verb, "is-enabled"))
- return 0;
-
- /* Processes all SysV units, and reshuffles the array so that
- * afterwards only the native units remain */
-
- r = lookup_paths_init(&paths, SYSTEMD_SYSTEM, false, arg_root, NULL, NULL, NULL);
- if (r < 0)
- return r;
-
- r = 0;
- while (args[f]) {
- const char *name;
- _cleanup_free_ char *p = NULL, *q = NULL, *l = NULL;
- bool found_native = false, found_sysv;
- unsigned c = 1;
- const char *argv[6] = { "/sbin/chkconfig", NULL, NULL, NULL, NULL };
- char **k;
- int j;
- pid_t pid;
- siginfo_t status;
-
- name = args[f++];
-
- if (!endswith(name, ".service"))
- continue;
-
- if (path_is_absolute(name))
- continue;
-
- STRV_FOREACH(k, paths.unit_path) {
- _cleanup_free_ char *path = NULL;
-
- path = path_join(arg_root, *k, name);
- if (!path)
- return log_oom();
-
- found_native = access(path, F_OK) >= 0;
- if (found_native)
- break;
- }
-
- if (found_native)
- continue;
-
- p = path_join(arg_root, SYSTEM_SYSVINIT_PATH, name);
- if (!p)
- return log_oom();
-
- p[strlen(p) - strlen(".service")] = 0;
- found_sysv = access(p, F_OK) >= 0;
- if (!found_sysv)
- continue;
-
- log_info("%s is not a native service, redirecting to /sbin/chkconfig.", name);
-
- if (!isempty(arg_root))
- argv[c++] = q = strappend("--root=", arg_root);
-
- argv[c++] = basename(p);
- argv[c++] =
- streq(verb, "enable") ? "on" :
- streq(verb, "disable") ? "off" : "--level=5";
- argv[c] = NULL;
-
- l = strv_join((char**)argv, " ");
- if (!l)
- return log_oom();
-
- log_info("Executing %s", l);
-
- pid = fork();
- if (pid < 0)
- return log_error_errno(errno, "Failed to fork: %m");
- else if (pid == 0) {
- /* Child */
-
- execv(argv[0], (char**) argv);
- _exit(EXIT_FAILURE);
- }
-
- j = wait_for_terminate(pid, &status);
- if (j < 0) {
- log_error_errno(r, "Failed to wait for child: %m");
- return j;
- }
-
- if (status.si_code == CLD_EXITED) {
- if (streq(verb, "is-enabled")) {
- if (status.si_status == 0) {
- if (!arg_quiet)
- puts("enabled");
- r = 1;
- } else {
- if (!arg_quiet)
- puts("disabled");
- }
-
- } else if (status.si_status != 0)
- return -EINVAL;
- } else
- return -EPROTO;
-
- /* Remove this entry, so that we don't try enabling it as native unit */
- assert(f > 0);
- f--;
- assert(args[f] == name);
- strv_remove(args, name);
- }
-
-#endif
return r;
}