From 50b68cff54360eaa8e94fee99e6de5c9588c9f13 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Thu, 8 Feb 2024 14:06:00 +0100 Subject: [PATCH] systemctl: drop chain invocation of telinit This functionality relied on telinit being available in a different path then the compat symlink shipped by systemd itself. This is no longer the case for any known distro, so remove that code. Fixes: #31220 Replaces: #31249 --- meson.build | 2 -- meson_options.txt | 2 -- src/systemctl/systemctl-compat-telinit.c | 8 -------- src/systemctl/systemctl-compat-telinit.h | 1 - src/systemctl/systemctl.c | 15 ++------------- src/systemctl/systemctl.h | 1 - 6 files changed, 2 insertions(+), 27 deletions(-) diff --git a/meson.build b/meson.build index ff79efd989..b4a5ada1c8 100644 --- a/meson.build +++ b/meson.build @@ -700,8 +700,6 @@ foreach prog : progs conf.set_quoted(name, path) endforeach -conf.set_quoted('TELINIT', get_option('telinit-path')) - if run_command(ln, '--relative', '--help', check : false).returncode() != 0 error('ln does not support --relative (added in coreutils 8.16)') endif diff --git a/meson_options.txt b/meson_options.txt index 9a6abd4981..b51af01721 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -47,8 +47,6 @@ option('sysvinit-path', type : 'string', value : '/etc/init.d', description : 'the directory where the SysV init scripts are located') option('sysvrcnd-path', type : 'string', value : '/etc/rc.d', description : 'the base directory for SysV rcN.d directories') -option('telinit-path', type : 'string', value : '/lib/sysvinit/telinit', - description : 'path to telinit') option('rc-local', type : 'string', value : '/etc/rc.local') option('initrd', type : 'boolean', diff --git a/src/systemctl/systemctl-compat-telinit.c b/src/systemctl/systemctl-compat-telinit.c index 20325e5e1c..210d0a1d46 100644 --- a/src/systemctl/systemctl-compat-telinit.c +++ b/src/systemctl/systemctl-compat-telinit.c @@ -155,11 +155,3 @@ int reload_with_fallback(void) { return 0; } - -int exec_telinit(char *argv[]) { - (void) rlimit_nofile_safe(); - (void) execv(TELINIT, argv); - - return log_error_errno(SYNTHETIC_ERRNO(EIO), - "Couldn't find an alternative telinit implementation to spawn."); -} diff --git a/src/systemctl/systemctl-compat-telinit.h b/src/systemctl/systemctl-compat-telinit.h index 783c3878a0..1a2bcd4405 100644 --- a/src/systemctl/systemctl-compat-telinit.h +++ b/src/systemctl/systemctl-compat-telinit.h @@ -4,4 +4,3 @@ int telinit_parse_argv(int argc, char *argv[]); int start_with_fallback(void); int reload_with_fallback(void); -int exec_telinit(char *argv[]); diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index d278d74789..1ac7edbdd2 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -1118,15 +1118,8 @@ int systemctl_dispatch_parse_argv(int argc, char *argv[]) { * * Also see redirect_telinit() in src/core/main.c. */ - if (sd_booted() > 0) { - arg_action = _ACTION_INVALID; - return telinit_parse_argv(argc, argv); - } else { - /* Hmm, so some other init system is running, we need to forward this request to it. - */ - arg_action = ACTION_TELINIT; - return 1; - } + arg_action = _ACTION_INVALID; /* telinit_parse_argv() will figure out the actual action we'll execute */ + return telinit_parse_argv(argc, argv); } else if (invoked_as(argv, "runlevel")) { arg_action = ACTION_RUNLEVEL; @@ -1330,10 +1323,6 @@ static int run(int argc, char *argv[]) { r = runlevel_main(); break; - case ACTION_TELINIT: - r = exec_telinit(argv); - break; - case ACTION_EXIT: case ACTION_SLEEP: case ACTION_SUSPEND: diff --git a/src/systemctl/systemctl.h b/src/systemctl/systemctl.h index 17dcfb4048..cc2b8c2cc4 100644 --- a/src/systemctl/systemctl.h +++ b/src/systemctl/systemctl.h @@ -33,7 +33,6 @@ enum action { ACTION_RELOAD, ACTION_REEXEC, ACTION_RUNLEVEL, - ACTION_TELINIT, ACTION_CANCEL_SHUTDOWN, ACTION_SHOW_SHUTDOWN, _ACTION_MAX,