diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-09-02 14:07:44 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-09-02 14:07:44 +0000 |
commit | 04143a661a72da86d0eeadd41e09c1293cd8cce7 (patch) | |
tree | 4a9a102e4038d3d5c032d423da484678c3a95ccc | |
parent | f589c6c8db6a460fb5a46b1c7cb9493d4bc49a87 (diff) | |
download | drakwizard-04143a661a72da86d0eeadd41e09c1293cd8cce7.tar drakwizard-04143a661a72da86d0eeadd41e09c1293cd8cce7.tar.gz drakwizard-04143a661a72da86d0eeadd41e09c1293cd8cce7.tar.bz2 drakwizard-04143a661a72da86d0eeadd41e09c1293cd8cce7.tar.xz drakwizard-04143a661a72da86d0eeadd41e09c1293cd8cce7.zip |
perl traduction
-rw-r--r-- | time_wizard/scripts/NTPConf.pm | 70 | ||||
-rw-r--r-- | time_wizard/time.wiz | 247 |
2 files changed, 78 insertions, 239 deletions
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 <adesmons@mandrakesoft.com> +# +# 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" > <Variable @@ -53,28 +55,11 @@ name="welcome" executionLevel="NORMAL" nextFinish="false" + jumpPage="choice_setting" canBack="true" canCancel="true" > - <Target - targetName="choice_setting" - jumpIndex="0" - > - </Target> - - <Target - targetName="must be root" - jumpIndex="1" - > - </Target> - - <Target - targetName="error_need_net" - jumpIndex="2" - > - </Target> - <Info helpText="Time configuration wizard" > @@ -100,25 +85,12 @@ <Page helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" name="choice_setting" - jumpScript="__WIZ_HOME__/time_wizard/scripts/handle_local_internet.sh" + func="chooser" executionLevel="NORMAL" nextFinish="false" canBack="true" canCancel="true" > - - <Target - targetName="no_tools" - jumpIndex="4" - > - </Target> - - <Target - targetName="choose_server" - jumpIndex="3" - > - </Target> - <Target targetName="ciao" jumpIndex="1" @@ -126,7 +98,7 @@ </Target> <Target - targetName="invisible" + targetName="choose_server" jumpIndex="2" > </Target> @@ -176,130 +148,6 @@ </Option> </Chooser> </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" - name="invisible" - comment="This invisible page is only to keep track of the absence of network." - executionLevel="DEBUG" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Freetext - name="freetext" - variableName="wiz_time_ok" - fillScript="echo not_ok" - editable="false" - > - </Freetext> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" - name="no_network" - jumpScript="__WIZ_HOME__/time_wizard/scripts/install_rpm.sh" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Target - targetName="choose_server" - jumpIndex="1" - > - </Target> - - <Target - targetName="not_installed" - jumpIndex="2" - > - </Target> - - <Info - helpText="WARNING:" - > - </Info> - - <Info - helpText="No network have been detected." - > - </Info> - - <Info - helpText="If you want to continue (and you know what you are doing) press next. Otherwise, press \qback\q to set the local time only, or cancel to exit this wizard." - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" - name="no_tools" - jumpScript="__WIZ_HOME__/time_wizard/scripts/install_rpm.sh" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Target - targetName="choose_target" - jumpIndex="1" - > - </Target> - - <Target - targetName="not_installed" - jumpIndex="2" - > - </Target> - - <Info - helpText="WARNING: the net time tools aren't there." - > - </Info> - - <Info - helpText="Click next to install those tools, back to return, or cancel to exit this wizard." - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" - name="not_installed" - jumpScript="__WIZ_HOME__/time_wizard/scripts/test_tools.sh" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Target - targetName="choose_server" - jumpIndex="1" - > - </Target> - - <Target - targetName="no_tools" - jumpIndex="2" - > - </Target> - - <Info - helpText="Can't install the NTP tools!" - > - </Info> - - <Info - helpText="Please, install ntp manually if you can, or insert the CDROM containing it." - > - </Info> - </Page> - <Page helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" name="choose_server" @@ -710,7 +558,7 @@ <Page helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" name="test_server" - jumpScript="__WIZ_HOME__/time_wizard/scripts/test_timeservers.sh" + func="test" executionLevel="NORMAL" nextFinish="false" canBack="true" @@ -718,7 +566,7 @@ > <Target - targetName="invisible2" + targetName="server_not_responding" jumpIndex="1" > </Target> @@ -772,30 +620,10 @@ </Freetext> </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" - name="invisible2" - comment="This invisible page is only to keep track of the absence of network" - executionLevel="DEBUG" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Freetext - name="freetext" - variableName="wiz_time_ok" - fillScript="echo not_ok" - editable="false" - > - </Freetext> - </Page> - <Page helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" name="server_not_responding" - jumpScript="__WIZ_HOME__/time_wizard/scripts/handle_no_network.sh" + func="test" executionLevel="NORMAL" nextFinish="false" canBack="true" @@ -891,63 +719,4 @@ </Info> </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" - name="must be root" - executionLevel="NORMAL" - nextFinish="true" - canBack="true" - canCancel="true" - > - - <Info - helpText="Sorry, you must be root to run this wizard" - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" - name="error_need_net" - subWizard="__WIZ_HOME__/server_wizard/server.wiz" - executionLevel="NORMAL" - nextFinish="false" - canBack="false" - canCancel="true" - > - - <Info - helpText="Network not configured yet" - > - </Info> - - - <Info - helpText="You have to configure the basic network parameters before launching this wizard." - > - </Info> - - <Info - helpText="Press next to configure these parameters now, or Cancel to exit this wizard." - > - </Info> - - - <Info - helpText="If you choose to configure now, you will automatically continue with the TIME configuration." - > - </Info> - </Page> - - <Page - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-time.html" - name="server launcher" - jumpPage="choice_setting" - executionLevel="DEBUG" - nextFinish="false" - canBack="true" - canCancel="true" - > - </Page> </Wizard> |