From 5c3f880e202d0b2d4c3b03236a38c35192653f91 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 6 Jan 2004 16:27:40 +0000 Subject: use $::prefix --- perl-install/install_any.pm | 2 +- perl-install/install_steps.pm | 2 +- perl-install/install_steps_interactive.pm | 2 +- perl-install/standalone/drakclock | 8 ++++---- perl-install/timezone.pm | 19 +++++++++---------- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index d7f180123..28810502b 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -278,7 +278,7 @@ sub preConfigureTimezone { $o->{timezone}{timezone} ||= timezone::bestTimezone($o->{locale}{country}); my $utc = every { !isFat_or_NTFS($_) } @{$o->{fstab}}; - my $ntp = timezone::ntp_server($o->{prefix}); + my $ntp = timezone::ntp_server(); add2hash_($o->{timezone}, { UTC => $utc, ntp => $ntp }); } diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 04d65a817..80a6597c9 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -664,7 +664,7 @@ sub configureTimezone { $o->pkg_install('ntp') if $o->{timezone}{ntp}; require timezone; - timezone::write($o->{prefix}, $o->{timezone}); + timezone::write($o->{timezone}); } #------------------------------------------------------------------------------ diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index d30433d08..d1ae7ab65 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -821,7 +821,7 @@ sub configureTimezone { my ($o, $clicked) = @_; require timezone; - $o->{timezone}{timezone} = $o->ask_from_treelist('', N("Which is your timezone?"), '/', [ timezone::getTimeZones($o->{prefix}) ], $o->{timezone}{timezone}) || return; + $o->{timezone}{timezone} = $o->ask_from_treelist('', N("Which is your timezone?"), '/', [ timezone::getTimeZones() ], $o->{timezone}{timezone}) || return; my $ntp = to_bool($o->{timezone}{ntp}); $o->ask_from_({ interactive_help_id => 'configureTimezoneGMT' }, [ diff --git a/perl-install/standalone/drakclock b/perl-install/standalone/drakclock index 1b52328d4..35620e4a8 100755 --- a/perl-install/standalone/drakclock +++ b/perl-install/standalone/drakclock @@ -39,10 +39,10 @@ $button_time->signal_connect(clicked => sub { $in->{timezone} = {}; add2hash($in->{timezone}, timezone::read()); my $timezone = $in->{timezone}{timezone}; - $in->{timezone}{timezone} = $in->ask_from_treelist(N("Timezone - DrakClock"), N("Which is your timezone?"), '/', [ timezone::getTimeZones('') ], $timezone); + $in->{timezone}{timezone} = $in->ask_from_treelist(N("Timezone - DrakClock"), N("Which is your timezone?"), '/', [ timezone::getTimeZones() ], $timezone); if (defined($in->{timezone}{timezone})) { $in->{timezone}{UTC} = $in->ask_yesorno(N("GMT - DrakClock"), N("Is your hardware clock set to GMT?"), $in->{timezone}{UTC}); - timezone::write('', $in->{timezone}); + timezone::write($in->{timezone}); } else { $in->{timezone}{timezone} = $timezone; } @@ -111,7 +111,7 @@ $my_win->{window}->add(gtkpack_(Gtk2::VBox->new(0,0), if ($check_ntp->get_active) { my $choosed_serv = $combo_ntpserver->entry->get_text; $choosed_serv =~ s/(\S+)\s*(.*)$/$1/; - timezone::ntp_server('', $1); + timezone::ntp_server($1); system("/sbin/chkconfig --level 35 ntpd on"); system("service ntpd restart"); } else { @@ -135,7 +135,7 @@ $my_win->{window}->add(gtkpack_(Gtk2::VBox->new(0,0), my $servers = get_server(); $combo_ntpserver->set_popdown_strings(@$servers); if (-e $ntpfile && -e $ntpdlock) { - $ntp = timezone::ntp_server(''); + $ntp = timezone::ntp_server(); $ntp and ntp_widget_state(1); foreach my $s (@$servers) { $s =~ /\Q$ntp/ and $fullntp = $s; diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index a070da66e..69af76e60 100644 --- a/perl-install/timezone.pm +++ b/perl-install/timezone.pm @@ -7,9 +7,8 @@ use common; use log; -sub getTimeZones { - my ($prefix) = @_; - $::testing and $prefix = ''; +sub getTimeZones() { + my $prefix = $::testing ? '' : $::prefix; open(my $F, "cd $prefix/usr/share/zoneinfo && find [A-Z]* -type f |"); my @l = difference2([ chomp_(<$F>) ], [ 'ROC', 'PRC' ]); close $F or die "cannot list the available zoneinfos"; @@ -23,9 +22,9 @@ sub read() { sub ntp_server { my $setting = @_ > 1; - my ($prefix, $server) = @_; + my ($server) = @_; - my $f = "$prefix/etc/ntp.conf"; + my $f = "$::prefix/etc/ntp.conf"; -e $f or return; if ($setting) { @@ -36,7 +35,7 @@ sub ntp_server { $added = 1; } } $f; - output_p("$prefix/etc/ntp/step-tickers", "$server\n"); + output_p("$::prefix/etc/ntp/step-tickers", "$server\n"); } else { $server = find { $_ ne '127.127.1.0' } map { if_(/^\s*server\s+(\S*)/, $1) } cat_($f); } @@ -44,13 +43,13 @@ sub ntp_server { } sub write { - my ($prefix, $t) = @_; + my ($t) = @_; - ntp_server($prefix, $t->{ntp}); + ntp_server($t->{ntp}); - eval { cp_af("$prefix/usr/share/zoneinfo/$t->{timezone}", "$prefix/etc/localtime") }; + eval { cp_af("$::prefix/usr/share/zoneinfo/$t->{timezone}", "$::prefix/etc/localtime") }; $@ and log::l("installing /etc/localtime failed"); - setVarsInSh("$prefix/etc/sysconfig/clock", { + setVarsInSh("$::prefix/etc/sysconfig/clock", { ZONE => $t->{timezone}, UTC => bool2text($t->{UTC}), ARC => "false", -- cgit v1.2.1