summaryrefslogtreecommitdiffstats
path: root/time_wizard
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2004-02-13 16:13:57 +0000
committerFlorent Villard <warly@mandriva.com>2004-02-13 16:13:57 +0000
commit8f3e8ec10ad970a1abf1453235f7a5fa663ef91f (patch)
treeac044b582b3b3c73f88b631b961766b90c191b35 /time_wizard
parent9b3af7e067d0bb0f807e1adef11d9397155d7fc9 (diff)
downloaddrakwizard-8f3e8ec10ad970a1abf1453235f7a5fa663ef91f.tar
drakwizard-8f3e8ec10ad970a1abf1453235f7a5fa663ef91f.tar.gz
drakwizard-8f3e8ec10ad970a1abf1453235f7a5fa663ef91f.tar.bz2
drakwizard-8f3e8ec10ad970a1abf1453235f7a5fa663ef91f.tar.xz
drakwizard-8f3e8ec10ad970a1abf1453235f7a5fa663ef91f.zip
stricter ntp config
Diffstat (limited to 'time_wizard')
-rw-r--r--time_wizard/Ntp.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/time_wizard/Ntp.pm b/time_wizard/Ntp.pm
index a4fc4ca9..9ea8144f 100644
--- a/time_wizard/Ntp.pm
+++ b/time_wizard/Ntp.pm
@@ -183,7 +183,10 @@ sub get_timezone {
}
sub test {
- $::testing and return 'end';
+ if ($::testing) {
+ do_it();
+ return 'end';
+ }
system("/usr/sbin/ntpdate -q $o->{var}{varserver1} $o->{var}{varserver2}");
if (!($? >> 8)) {
do_it();
@@ -193,16 +196,20 @@ sub test {
}
sub do_it {
- $::testing and return;
+ if ($::testing){
+ print "Would have written\nUTC=true\nZONE=$o->{var}{wiz_timezone}\nARC=false\n to /etc/sysconfig/clock\n\n";
+ print "Would have copied /usr/share/zoneinfo/$o->{var}{wiz_timezone} to /etc/localtime\n";
+ return
+ }
my $file = "/etc/sysconfig/clock";
- MDK::Common::cp_af($file, $file.".orig");
+ !-f "$file.orig" and MDK::Common::cp_af($file, $file.".orig");
local *NEW;
open(NEW, "> $file") or die "can not open $file: $!";
print NEW "UTC=true\n";
print NEW "ZONE=$o->{var}{wiz_timezone}\n";
print NEW "ARC=false\n";
close NEW or die "can not close $file: $!";
- MDK::Common::cp_af("/usr/share/zoneinfo/$o->{var}{wiz_timezone}", "/etc/localtime");
+ -f "/usr/share/zoneinfo/$o->{var}{wiz_timezone}" and MDK::Common::cp_af("/usr/share/zoneinfo/$o->{var}{wiz_timezone}", "/etc/localtime");
-f "/etc/ntp/step-tickers" and MDK::Common::cp_af("/etc/ntp/step-tickers", "/etc/ntp/step-tickers.orig");
open(NEW, "> /etc/ntp/step-tickers") or die "can not open /etc/ntp/step-tickers: $!";
print NEW $o->{var}{varserver1}."\n";