summaryrefslogtreecommitdiffstats
path: root/perl-install/timezone.pm
diff options
context:
space:
mode:
authorDavid Walser <luigiwalser@mageia.org>2013-11-17 19:00:07 +0000
committerColin Guthrie <colin@mageia.org>2013-11-17 20:41:41 +0000
commitd54857e5704e52bc93d810250732affc82e1d65f (patch)
treefbaccf45e44d72d4facdd803a1279baa66c14618 /perl-install/timezone.pm
parent6298fe9b2ec4be3c8845a0ab39c90ad76ea7a49e (diff)
downloaddrakx-d54857e5704e52bc93d810250732affc82e1d65f.tar
drakx-d54857e5704e52bc93d810250732affc82e1d65f.tar.gz
drakx-d54857e5704e52bc93d810250732affc82e1d65f.tar.bz2
drakx-d54857e5704e52bc93d810250732affc82e1d65f.tar.xz
drakx-d54857e5704e52bc93d810250732affc82e1d65f.zip
Add chrony support to drakclock mga#11092
v2 (by Colin Guthrie) * Fix external variable reference (my -> our + $ when using it) * Drop systemd cgroup filesystem check as the path has changed now (prefer "systemctl is-active foo.service" instead) * Add iburst to chrony config server definitions (triggers sync at startup) * Don't use ntpdate with chrony - rather chronyc waitsync * Don't bother checking for ntp in finish-install - just use chrony
Diffstat (limited to 'perl-install/timezone.pm')
-rw-r--r--perl-install/timezone.pm19
1 files changed, 13 insertions, 6 deletions
diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm
index d9a5dc246..b4b4cfe89 100644
--- a/perl-install/timezone.pm
+++ b/perl-install/timezone.pm
@@ -24,15 +24,20 @@ sub read() {
{ timezone => $t{ZONE}, UTC => text2bool($t{UTC}) };
}
-my $ntp_conf_file = "/etc/ntp.conf";
+our $ntp = "chrony";
+my $servername_config_suffix = " iburst";
+unless (-f $::prefix . "/etc/" . $ntp . ".conf") {
+ $ntp = "ntp";
+ $servername_config_suffix = "";
+}
sub ntp_server() {
- find { $_ ne '127.127.1.0' } map { if_(/^\s*server\s+(\S*)/, $1) } cat_($::prefix . $ntp_conf_file);
+ find { $_ ne '127.127.1.0' } map { if_(/^\s*server\s+(\S*)/, $1) } cat_($::prefix . "/etc/" . $ntp . ".conf");
}
sub set_ntp_server {
my ($server) = @_;
- my $f = $::prefix . $ntp_conf_file;
+ my $f = $::prefix . "/etc/" . $ntp . ".conf";
-f $f or return;
my $pool_match = qr/\.pool\.ntp\.org$/;
@@ -41,14 +46,16 @@ sub set_ntp_server {
my $added = 0;
substInFile {
if (/^#?\s*server\s+(\S*)/ && $1 ne '127.127.1.0') {
- $_ = $added ? $_ =~ $pool_match ? undef : "#server $1\n" : join('', map { "server $_\n" } @servers);
+ $_ = $added ? $_ =~ $pool_match ? undef : "#server $1\n" : join('', map { "server $_$servername_config_suffix\n" } @servers);
$added = 1;
}
} $f;
- output_p("$::prefix/etc/ntp/step-tickers", join('', map { "$_\n" } @servers));
+ if ($ntp eq "ntp") {
+ output_p("$::prefix/etc/ntp/step-tickers", join('', map { "$_\n" } @servers));
+ }
require services;
- services::set_status('ntpd', to_bool($server), $::isInstall);
+ services::set_status($ntp . 'd', to_bool($server), $::isInstall);
}
sub write {