X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=build%2Fzoneinfo2lua.pl;h=4a90dae355f469aed54ebdab5766fa11ffd3e294;hp=2e24c9541671ff15d4d46322caa26f09989fff6c;hb=eb25d532a88b140431c20077edf56bb40663c8fc;hpb=c8bac066234103a6fd87c4d32f08fd1622be5ba3 diff --git a/build/zoneinfo2lua.pl b/build/zoneinfo2lua.pl index 2e24c9541..4a90dae35 100755 --- a/build/zoneinfo2lua.pl +++ b/build/zoneinfo2lua.pl @@ -6,12 +6,12 @@ use strict; my %TZ; -my $tzdir = $ARGV[0] || "/usr/share/zoneinfo"; -chdir($tzdir) || die "chdir($tzdir): $!\n"; +my $tzdin = $ARGV[0] || "/usr/share/zoneinfo"; +my $tzdout = $ARGV[1] || "./modules/luci-base/luasrc/sys/zoneinfo"; local $/ = "\012"; -open( ZTAB, "< ./zone.tab" ) || die "Unable to open zone.tab: $!"; +open( ZTAB, "< $tzdin/zone.tab" ) || die "open($tzdin/zone.tab): $!"; while( ! eof ZTAB ) { chomp( my $line = readline ZTAB ); @@ -21,7 +21,7 @@ while( ! eof ZTAB ) { printf STDERR "%-40s", $zone; - if( open ZONE, "< ./$zone" ) { + if( open ZONE, "< $tzdin/$zone" ) { seek ZONE, -2, 2; while( tell(ZONE) > 0 ) { @@ -40,14 +40,17 @@ while( ! eof ZTAB ) { } else { - print STDERR "Unable to open $zone: $!\n"; + print STDERR "open($tzdin/$zone): $!\n"; } } close ZTAB; -print < $tzdout/tzdata.lua") || die "open($tzdout/tzdata.lua): $!\n"; + +print STDERR "Writing time zones to $tzdout/tzdata.lua ... "; +print O < $tzdout/tzoffset.lua") || die "open($tzdout/tzoffset.lua): $!\n"; + +print STDERR "Writing time offsets to $tzdout/tzoffset.lua ... "; +print O <