X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=build%2Fzoneinfo2lua.pl;h=4a90dae355f469aed54ebdab5766fa11ffd3e294;hp=7e772c0aff39c1d52dfd536e8d00a699b31ae8b2;hb=61a9a58efcb27e2860cef804f04c9c4ba4ceb168;hpb=cbdc5af52ef0eeae955753ab0a8a0df650027b55 diff --git a/build/zoneinfo2lua.pl b/build/zoneinfo2lua.pl old mode 100644 new mode 100755 index 7e772c0af..4a90dae35 --- a/build/zoneinfo2lua.pl +++ b/build/zoneinfo2lua.pl @@ -7,8 +7,11 @@ use strict; my %TZ; +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 ); @@ -18,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 ) { @@ -37,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 <