diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-10-17 16:30:47 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-10-17 16:30:47 +0000 |
commit | 80aeb2c106769f94c69b8a05a40819155e296b98 (patch) | |
tree | 1ad9638691989db242804c374fdcf0fb70b4ebc6 /time_wizard | |
parent | 56aeaf3c6576de86b90b7293ea3ca3c4efeaa120 (diff) | |
download | drakwizard-80aeb2c106769f94c69b8a05a40819155e296b98.tar drakwizard-80aeb2c106769f94c69b8a05a40819155e296b98.tar.gz drakwizard-80aeb2c106769f94c69b8a05a40819155e296b98.tar.bz2 drakwizard-80aeb2c106769f94c69b8a05a40819155e296b98.tar.xz drakwizard-80aeb2c106769f94c69b8a05a40819155e296b98.zip |
(do_it) do not reinvent output()
Diffstat (limited to 'time_wizard')
-rw-r--r-- | time_wizard/Ntp.pm | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/time_wizard/Ntp.pm b/time_wizard/Ntp.pm index 4f76504a..c754a833 100644 --- a/time_wizard/Ntp.pm +++ b/time_wizard/Ntp.pm @@ -199,18 +199,16 @@ sub do_it { my $file = "/etc/sysconfig/clock"; !-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: $!"; + output($file, qq(UTC=true +ZONE=$o->{var}{wiz_timezone} +ARC=false +)); -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"; - print NEW $o->{var}{varserver2} . "\n"; - print NEW $o->{var}{varserver3} . "\n"; - close NEW or die "can not close /etc/ntp/step-tickers: $!"; + output('/etc/ntp/step-tickers', join("\n", $o->{var}{varserver1}, + $o->{var}{varserver2}, + $o->{var}{varserver3}, + undef)); substInFile { s/(# server clock.via.net)/$1\nserver $o->{var}{varserver1}/ } '/etc/ntp.conf' if -f '/etc/ntp.conf'; standalone::explanations("Wrote /etc/ntp/step-tickers, starting services"); my $command = "service crond stop; service atd stop; service ntpd stop; service ntpd start; service atd start; service crond start; /sbin/hwclock --systohc --utc"; |