diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-07-03 13:25:40 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-07-03 13:25:40 +0000 |
commit | efd1a3220085f5317b8daac3372b28b79381c5c9 (patch) | |
tree | 903b768355aae9578ebd3b46206f766eae09c772 /perl-install/timezone.pm | |
parent | dedeabe506d093314b7be2e03fd046e4d5f492fa (diff) | |
download | drakx-backup-do-not-use-efd1a3220085f5317b8daac3372b28b79381c5c9.tar drakx-backup-do-not-use-efd1a3220085f5317b8daac3372b28b79381c5c9.tar.gz drakx-backup-do-not-use-efd1a3220085f5317b8daac3372b28b79381c5c9.tar.bz2 drakx-backup-do-not-use-efd1a3220085f5317b8daac3372b28b79381c5c9.tar.xz drakx-backup-do-not-use-efd1a3220085f5317b8daac3372b28b79381c5c9.zip |
add ntp handling
Diffstat (limited to 'perl-install/timezone.pm')
-rw-r--r-- | perl-install/timezone.pm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index 35622d2b5..16b888e6e 100644 --- a/perl-install/timezone.pm +++ b/perl-install/timezone.pm @@ -3,7 +3,7 @@ package timezone; # $Id$ use diagnostics; use strict; -use common qw(:common :system); +use common qw(:common :system :file); use commands; use log; @@ -25,9 +25,29 @@ sub read { (timezone => $t{ZONE}, UTC => text2bool($t{UTC})); } +sub ntp_server { + my ($prefix, $server) = @_; + + my $f = "$prefix/etc/ntp.conf"; + -e $f or return; + + if (@_ > 1) { + substInFile { + if (/^#?\s*server\s+(\S*)/ && $1 ne '127.127.1.0') { + $_ = $server ? "server $server\n" : "#server $1\n"; + } + } $f; + } else { + ($server) = grep { $_ ne '127.127.1.0' } map { if_(/^\s*server\s+(\S*)/, $1) } cat_($f); + } + $server; +} + sub write { my ($prefix, $t) = @_; + ntp_server($prefix, $t->{ntp}); + eval { commands::cp("-f", "$prefix/usr/share/zoneinfo/$t->{timezone}", "$prefix/etc/localtime") }; $@ and log::l("installing /etc/localtime failed"); setVarsInSh("$prefix/etc/sysconfig/clock", { |