From 04143a661a72da86d0eeadd41e09c1293cd8cce7 Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Mon, 2 Sep 2002 14:07:44 +0000 Subject: perl traduction --- time_wizard/scripts/NTPConf.pm | 70 ++++++++++++ time_wizard/time.wiz | 247 ++--------------------------------------- 2 files changed, 78 insertions(+), 239 deletions(-) create mode 100644 time_wizard/scripts/NTPConf.pm (limited to 'time_wizard') diff --git a/time_wizard/scripts/NTPConf.pm b/time_wizard/scripts/NTPConf.pm new file mode 100644 index 00000000..5b81124a --- /dev/null +++ b/time_wizard/scripts/NTPConf.pm @@ -0,0 +1,70 @@ +#!/usr/bin/perl + +# NTP Config Parser + +# Copyright (C) 2002 MandrakeSoft Arnaud Desmons +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package NTPConf; +require "__WIZ_HOME__/common/scripts/Vareqval.pm"; +require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm"; +use MDK::Common; +use strict; +use standalone; + +sub chooser { + if ($ENV{chooser1} eq "local") { + do_it(); + return 1; + } + 2; +} + +sub test { + system("/usr/sbin/ntpdate -q $ENV{server1} $ENV{server2}"); + if (!($? >> 8)) { + do_it(); + return 2; + } + return 1; +} + +sub do_it { + my $file = "/etc/sysconfig/clock"; + MDK::Common::cp_af($file, $file.".orig"); + open(NEW, "> $file") or die "can not open /etc/ntp/step-tickers: $!"; + print NEW "UTC=true\n"; + print NEW "ZONE=$ENV{wiz_timezone}\n"; + print NEW "ARC=false\n"; + close NEW or die "can not close /etc/ntp/step-tickers: $!"; + MDK::Common::cp_af("/usr/share/zoneinfo/$ENV{wiz_timezone}", "/etc/localtime"); + 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 $ENV{server1}."\n"; + print NEW $ENV{server2}."\n"; + close NEW or die "can not close /etc/ntp/step-tickers: $!"; + standalone::explanations("Wrote /etc/ntp/step-tickers, starting services"); + my @services = qw(crond atd ntpd); + foreach (@services) { + system("/etc/rc.d/init.d/$_ stop"); + } + foreach (reverse @services) { + system("/etc/rc.d/init.d/$_ start"); + } + system("/sbin/hwclock --systohc --utc"); + 10; +} +1; diff --git a/time_wizard/time.wiz b/time_wizard/time.wiz index d6f546d9..31c46f8a 100644 --- a/time_wizard/time.wiz +++ b/time_wizard/time.wiz @@ -7,6 +7,8 @@ wizardTitle="Time wizard" imagePosition="top" defaultImage="__WIZ_HOME__/time_wizard/images/Time" + perlModule="__WIZ_HOME__/time_wizard/scripts/NTPConf.pm" + rpm="ntp" > - - - - - - - - - @@ -100,25 +85,12 @@ - - - - - - - @@ -176,130 +148,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -772,30 +620,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.1