summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-28 18:28:32 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-28 18:28:32 +0000
commit9b390d119d131f7db4e77ad7001d4ddf36367cd7 (patch)
treed116e2362d9284e665282d64d0ede48b569c73df
parent1f5e05396d83bdd1362aa1b86e1ac82381507cf8 (diff)
downloaddrakx-9b390d119d131f7db4e77ad7001d4ddf36367cd7.tar
drakx-9b390d119d131f7db4e77ad7001d4ddf36367cd7.tar.gz
drakx-9b390d119d131f7db4e77ad7001d4ddf36367cd7.tar.bz2
drakx-9b390d119d131f7db4e77ad7001d4ddf36367cd7.tar.xz
drakx-9b390d119d131f7db4e77ad7001d4ddf36367cd7.zip
extract get_timezone_prefix()
-rw-r--r--perl-install/timezone.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm
index e5750fd6e..5babf2061 100644
--- a/perl-install/timezone.pm
+++ b/perl-install/timezone.pm
@@ -6,10 +6,14 @@ use strict;
use common;
use log;
+sub get_timezone_prefix() {
+ my $prefix = $::testing ? '' : $::prefix;
+ $prefix . "/usr/share/zoneinfo";
+}
sub getTimeZones() {
- my $prefix = $::testing ? '' : $::prefix;
- open(my $F, "cd $prefix/usr/share/zoneinfo && find [A-Z]* -noleaf -type f |");
+ my $tz_prefix = get_timezone_prefix();
+ open(my $F, "cd $tz_prefix && find [A-Z]* -noleaf -type f |");
my @l = difference2([ chomp_(<$F>) ], [ 'ROC', 'PRC' ]);
close $F or die "cannot list the available zoneinfos";
sort @l;
@@ -52,7 +56,8 @@ sub write {
set_ntp_server($t->{ntp});
- eval { cp_af("$::prefix/usr/share/zoneinfo/$t->{timezone}", "$::prefix/etc/localtime") };
+ my $tz_prefix = get_timezone_prefix();
+ eval { cp_af($tz_prefix . '/' . $t->{timezone}, "$::prefix/etc/localtime") };
$@ and log::l("installing /etc/localtime failed");
setVarsInSh("$::prefix/etc/sysconfig/clock", {
ZONE => $t->{timezone},