From 0c22608c7a137c37417e189eeea9c46bf33a792d Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 1 Oct 2022 17:35:46 -0700 Subject: [PATCH] Remove support for ancient caldera-only daemons_dir feature --- init/backup_config.pl | 4 ---- init/edit_action.cgi | 11 ----------- init/index.cgi | 6 ------ init/init-lib.pl | 35 +---------------------------------- init/save_action.cgi | 17 ----------------- 5 files changed, 1 insertion(+), 72 deletions(-) diff --git a/init/backup_config.pl b/init/backup_config.pl index e48b46490..5f6461674 100755 --- a/init/backup_config.pl +++ b/init/backup_config.pl @@ -12,10 +12,6 @@ if ($config{'init_base'}) { local @ac = split(/\s+/, $a); push(@rv, $ac[0] =~ /^\// ? $ac[0] : "$config{'init_dir'}/$ac[0]"); - if ($config{'daemons_dir'} && - -r "$config{'daemons_dir'}/$ac[0]") { - push(@rv, "$config{'daemons_dir'}/$ac[0]"); - } local $ufile = "/etc/init/$ac[0]"; if (-r $ufile) { push(@rv, $ufile); diff --git a/init/edit_action.cgi b/init/edit_action.cgi index bc62eee2e..51fe47640 100755 --- a/init/edit_action.cgi +++ b/init/edit_action.cgi @@ -104,10 +104,6 @@ elsif (!$config{'expert'} || $access{'bootup'} == 2) { local ($l, $p) = split(/\s+/, $s); $boot = 1 if (&indexof($l, @boot) >= 0); } - if ($boot && $config{'daemons_dir'} && - &read_env_file("$config{'daemons_dir'}/$ac", \%daemon)) { - $boot = lc($daemon{'ONBOOT'}) eq 'yes' ? 1 : 0; - } print &ui_hidden("oldboot", $boot); } if ($access{'bootup'} == 1) { @@ -136,13 +132,6 @@ elsif (!$config{'expert'} || $access{'bootup'} == 2) { print &ui_table_end(); } else { - if ($config{'daemons_dir'} && $ac && - &read_env_file("$config{'daemons_dir'}/$ac", \%daemon)) { - # Display onboot flag from daemons file - $boot = lc($daemon{'ONBOOT'}) eq 'yes'; - print &ui_table_row($text{'edit_boot'}, - &ui_yesno_radio("boot", $boot ? 1 : 0)); - } print &ui_table_end(); # Display which runlevels the action is started/stopped in diff --git a/init/index.cgi b/init/index.cgi index 83b79297a..2276772ec 100755 --- a/init/index.cgi +++ b/init/index.cgi @@ -66,12 +66,6 @@ elsif ($init_mode eq "init" && $access{'bootup'}) { foreach $s (&action_levels('S', $acts[$i])) { local ($l, $p) = split(/\s+/, $s); local ($lvl) = (&indexof($l, @boot) >= 0); - local %daemon; - if ($lvl && $config{'daemons_dir'} && - &read_env_file("$config{'daemons_dir'}/$acts[$i]", - \%daemon)) { - $lvl = lc($daemon{'ONBOOT'}) eq 'yes' ? 1 : 0; - } push(@{$actsb[$i]}, [ $l, $p, $lvl ]); } @{$actsb[$i]} = sort { $b->[2] <=> $a->[2] } @{$actsb[$i]}; diff --git a/init/init-lib.pl b/init/init-lib.pl index c15ecdc5c..b6cc42cf1 100755 --- a/init/init-lib.pl +++ b/init/init-lib.pl @@ -438,15 +438,6 @@ if ($_[1]) { } my $desc; -if ($config{'daemons_dir'}) { - # First try the daemons file - my %daemon; - if ($_[0] =~ /\/([^\/]+)$/ && - &read_env_file("$config{'daemons_dir'}/$1", \%daemon) && - $daemon{'DESCRIPTIVE'}) { - return $daemon{'DESCRIPTIVE'}; - } - } if ($config{'chkconfig'}) { # Find the redhat-style description: section foreach (@lines) { @@ -575,10 +566,6 @@ if ($init_mode eq "init" || $init_mode eq "upstart" || } } } - if ($starting && $config{'daemons_dir'} && - &read_env_file("$config{'daemons_dir'}/$name", \%daemon)) { - $starting = lc($daemon{'ONBOOT'}) eq 'yes' ? 1 : 0; - } return !$exists ? 0 : $starting ? 2 : 1; } elsif ($init_mode eq "local") { @@ -715,10 +702,6 @@ if ($init_mode eq "systemd" && (!-r "$config{'init_dir'}/$action" || if ($init_mode eq "init" || $init_mode eq "local" || $init_mode eq "upstart" || $init_mode eq "systemd") { # In these modes, we create a script to run - if ($config{'daemons_dir'} && - &read_env_file("$config{'daemons_dir'}/$action", \%daemon)) { - $daemon++; - } my $fn; if ($init_mode eq "init" || $init_mode eq "upstart" || $init_mode eq "systemd") { @@ -740,14 +723,7 @@ if ($init_mode eq "init" || $init_mode eq "local" || $init_mode eq "upstart" || } my $need_links = 0; - if ($st == 1 && $daemon) { - # Just update daemons file - $daemon{'ONBOOT'} = 'yes'; - &lock_file("$config{'daemons_dir'}/$action"); - &write_env_file("$config{'daemons_dir'}/$action", \%daemon); - &unlock_file("$config{'daemons_dir'}/$action"); - } - elsif ($st == 1) { + if ($st == 1) { # Just need to create links (later) $need_links++; } @@ -1106,19 +1082,10 @@ elsif ($init_mode eq "systemd") { if ($init_mode eq "init" || $init_mode eq "upstart" || $init_mode eq "systemd") { # Unlink or disable init script - my ($daemon, %daemon); my $file = &action_filename($_[0]); my @chk = &chkconfig_info($file); my $data = &read_file_contents($file); - if ($config{'daemons_dir'} && - &read_env_file("$config{'daemons_dir'}/$_[0]", \%daemon)) { - # Update daemons file - $daemon{'ONBOOT'} = 'no'; - &lock_file("$config{'daemons_dir'}/$_[0]"); - &write_env_file("$config{'daemons_dir'}/$_[0]", \%daemon); - &unlock_file("$config{'daemons_dir'}/$_[0]"); - } elsif (&has_command("chkconfig") && !$config{'no_chkconfig'} && @chk) { # Call chkconfig to remove the links &system_logged("chkconfig ".quotemeta($_[0])." off"); diff --git a/init/save_action.cgi b/init/save_action.cgi index 38c53f379..28070b54a 100755 --- a/init/save_action.cgi +++ b/init/save_action.cgi @@ -55,7 +55,6 @@ foreach $rl (&list_runlevels()) { if ($in{'old'} && $in{'type'} == 0) { # Changing a 'sane' action - local $dd = $config{'daemons_dir'}; $in{data} =~ s/\r//g; if ($in{old} ne $in{name}) { # Need to rename the action.. @@ -63,15 +62,6 @@ if ($in{'old'} && $in{'type'} == 0) { &error(&text('save_ealready', $in{name})); } &rename_action($in{old}, $in{name}); - if ($dd) { - # Need to rename the caldera daemons file too - &rename_logged("$dd/$in{old}", "$dd/$in{name}"); - &lock_file("$dd/$in{'name'}"); - &read_env_file("$dd/$in{name}", \%daemon); - $daemon{'IDENT'} = $in{'name'} - if ($daemon{'IDENT'} eq $in{'old'}); - &write_env_file("$dd/$in{name}", \%daemon); - } } &lock_file("$dd/$in{'name'}") if ($dd); $file = &action_filename($in{name}); @@ -110,13 +100,6 @@ if ($in{'old'} && $in{'type'} == 0) { 'K',$in{"pri_K$rl"}); } } - - if (defined($in{'boot'}) && $dd) { - # Update onboot flag in daemons file - &read_env_file("$dd/$in{'name'}", \%daemon); - $daemon{'ONBOOT'} = $in{'boot'} ? 'yes' : 'no'; - &write_env_file("$dd/$in{'name'}", \%daemon); - } } else { # Just change whether it gets started or not