summaryrefslogtreecommitdiffstats
path: root/time_wizard
diff options
context:
space:
mode:
Diffstat (limited to 'time_wizard')
-rw-r--r--time_wizard/Ntp.pm32
1 files changed, 16 insertions, 16 deletions
diff --git a/time_wizard/Ntp.pm b/time_wizard/Ntp.pm
index 0c0a67a4..4f76504a 100644
--- a/time_wizard/Ntp.pm
+++ b/time_wizard/Ntp.pm
@@ -60,9 +60,9 @@ if (-d '/usr/share/zoneinfo') {
if (-d "/usr/share/zoneinfo/$z") {
opendir my $dir2, "/usr/share/zoneinfo/$z";
push @{$country{$z}}, map { $_ } grep { /^[A-Z]/ } readdir $dir2;
- closedir $dir2
+ closedir $dir2;
} else {
- $country{$z} = 1
+ $country{$z} = 1;
}
}
closedir $dir;
@@ -93,20 +93,20 @@ $o->{pages} = {
pre => sub {
my (undef, $region, $country) = get_timezone();
$o->{var}{wiz_region} ||= $region;
- $o->{var}{wiz_country} ||= $country
+ $o->{var}{wiz_country} ||= $country;
},
data => [
{ label => N("Choose a region:"), val => \$o->{var}{wiz_region}, list => [ keys %country ] },
],
post => sub {
- 'choose_country' if ref $country{$o->{var}{wiz_region}}
+ return 'choose_country' if ref $country{$o->{var}{wiz_region}};
},
next => 'test_server'
},
choose_country => {
name => N("Choose a timezone"),
pre => sub {
- @country = ref $country{$o->{var}{wiz_region}} ? @{$country{$o->{var}{wiz_region}}} : ()
+ @country = ref $country{$o->{var}{wiz_region}} ? @{$country{$o->{var}{wiz_region}}} : ();
},
data => [
{ label => N("Choose a city:"), val => \$o->{var}{wiz_country}, list_ref => \@country },
@@ -145,9 +145,9 @@ $o->{pages} = {
post => sub {
if ($o->{var}{action} eq 'save_quit') {
do_it();
- 'end',
+ 'end';
} else {
- 'test_server',
+ 'test_server';
}
},
data => [
@@ -180,24 +180,24 @@ sub test {
return 'end';
}
my $command = "/usr/sbin/ntpdate -q $o->{var}{varserver1}"; # $o->{var}{varserver2}";
- my $o = MDK::Wizard::Wizcommon_gtk2::gtk_log($command, "Test NTP server Responding...");
- $o;
+ my $_o = MDK::Wizard::Wizcommon_gtk2::gtk_log($command, "Test NTP server Responding...");
+
# system("/usr/sbin/ntpdate -q $o->{var}{varserver1} $o->{var}{varserver2}");
if (!($? >> 8)) {
do_it();
- return 'end'
+ return 'end';
}
- 'server_not_responding'
+ return 'server_not_responding';
}
sub do_it {
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
+ return;
}
my $file = "/etc/sysconfig/clock";
- !-f "$file.orig" and 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";
@@ -207,9 +207,9 @@ sub do_it {
-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";
+ 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: $!";
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");