Revert "Add support for chronyc command for CentOS 8"

This reverts commit 3548bd3573.
This commit is contained in:
Jamie Cameron
2020-07-03 15:08:19 -07:00
parent 8a5eb8b1d5
commit 44a51efb1b
3 changed files with 14 additions and 35 deletions

View File

@@ -52,17 +52,9 @@ if ($in{'action'} eq $text{'action_sync'}) {
} elsif ($in{'action'} eq $text{'index_sync'} || $in{'mode'} eq 'ntp') {
# Sync with a time server
$access{'ntp'} || &error($text{'acl_nontp'});
if (!$time_is_chrony) {
$in{'timeserver'} =~ /\S/ || &error($text{'error_etimeserver'});
}
$in{'timeserver'} =~ /\S/ || &error($text{'error_etimeserver'});
$err = &sync_time($in{'timeserver'}, $in{'hardware'});
if ($err) {
my $err_ = "<pre>".&html_escape($err)."</pre>";
if ($time_out_no_cmd) {
$err_ = $err;
}
&error($err_);
}
&error("<pre>".&html_escape($err)."</pre>") if ($err);
# Save settings in module config
&lock_file($module_config_file);

View File

@@ -3,7 +3,7 @@
use strict;
use warnings;
require './time-lib.pl';
our (%in, %text, %config, %access, $base_remote_user, $get_hardware_time_error, $time_is_chrony);
our (%in, %text, %config, %access, $base_remote_user, $get_hardware_time_error);
my ($rawdate, $rawhwdate, %system_date, $rawtime, %hw_date, $txt);
$txt = "";
@@ -159,23 +159,16 @@ if ( ( !$access{ 'sysdate' } && &has_command( "date" ) || !$access{ 'hwdate' } &
print &ui_hidden("mode", "ntp");
print &ui_table_start(&hlink($text{'index_timeserver'}, "timeserver"),
"width=100%", 2, [ "width=30%" ]);
if (!$time_is_chrony) {
print &ui_table_row($text{'index_addresses'},
&ui_textbox("timeserver", $config{'timeserver'}, 60));
# Show hardware time checkbox
if (&support_hwtime()) {
print &ui_table_row(" ",
&ui_checkbox("hardware", 1, $text{'index_hardware2'},
$config{'timeserver_hardware'}));
}
print &ui_table_row($text{'index_addresses'},
&ui_textbox("timeserver", $config{'timeserver'}, 60));
# Show hardware time checkbox
if (&support_hwtime()) {
print &ui_table_row(" ",
&ui_checkbox("hardware", 1, $text{'index_hardware2'},
$config{'timeserver_hardware'}));
}
else {
if (&support_hwtime()) {
print &ui_table_row($text{'action_sync_s'},
&ui_yesno_radio("hardware", $config{'timeserver_hardware'}));
}
}
# Show boot-time checkbox
my $job = &find_webmin_cron_job();

View File

@@ -11,8 +11,6 @@ our ($timezones_file, $currentzone_link, $currentzone_file, $timezones_dir,
$sysclock_file);
our ($get_hardware_time_error);
our $cron_cmd = "$module_config_directory/sync.pl";
our $time_is_chrony = &has_command("chronyc");
our $time_out_no_cmd = 0;
if ($config{'zone_style'}) {
do "$config{'zone_style'}-lib.pl";
}
@@ -42,18 +40,14 @@ my ($server, $hwtoo) = @_;
my @servs = split(/\s+/, $server);
my $servs = join(" ", map { quotemeta($_) } @servs);
my $out;
if ($time_is_chrony) {
$out = &backquote_logged("chronyc -a makestep 2>&1");
}
elsif (&has_command("ntpdate")) {
if (&has_command("ntpdate")) {
$out = &backquote_logged("ntpdate -u $servs 2>&1");
}
elsif (&has_command("sntp")) {
$out = &backquote_logged("sntp -s $servs 2>&1");
}
else {
$out = "Missing <tt>chronyc</tt> or <tt>ntpdate</tt> and <tt>sntp</tt> commands";
$time_out_no_cmd = 1;
$out = "Missing ntpdate and sntp commands";
$? = 1;
}
if ($? && $config{'ntp_only'}) {