From 9b390d119d131f7db4e77ad7001d4ddf36367cd7 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 28 Mar 2008 18:28:32 +0000 Subject: extract get_timezone_prefix() --- perl-install/timezone.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'perl-install') 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}, -- cgit v1.2.1