diff options
author | Francesc Pinyol Margalef <francesc.pinyol.m@gmail.com> | 2013-12-21 13:37:33 +0100 |
---|---|---|
committer | Francesc Pinyol Margalef <francesc.pinyol.m@gmail.com> | 2013-12-21 13:37:33 +0100 |
commit | 095c6b25885ce3d22eedba8cdb98f1fd7e8708a5 (patch) | |
tree | 5bfc768996b3ddec185abeb02b602b48b14d10db /perl-install/timezone.pm | |
parent | df60191bdbddfa7c8e5bd11a2578aae6740963c0 (diff) | |
parent | f76dc0931e47338aa9c7db257d28e5015d8a2f47 (diff) | |
download | drakx-095c6b25885ce3d22eedba8cdb98f1fd7e8708a5.tar drakx-095c6b25885ce3d22eedba8cdb98f1fd7e8708a5.tar.gz drakx-095c6b25885ce3d22eedba8cdb98f1fd7e8708a5.tar.bz2 drakx-095c6b25885ce3d22eedba8cdb98f1fd7e8708a5.tar.xz drakx-095c6b25885ce3d22eedba8cdb98f1fd7e8708a5.zip |
Merge branch 'master' of git://git.mageia.org/software/drakx
Diffstat (limited to 'perl-install/timezone.pm')
-rw-r--r-- | perl-install/timezone.pm | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index d9a5dc246..eeb1ed30d 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 = "ntp"; +my $servername_config_suffix = ""; +unless (-f $::prefix . "/etc/" . $ntp . ".conf") { + $ntp = "chrony"; + $servername_config_suffix = " iburst"; +} 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 { |