X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=build%2Fzoneinfo2lua.pl;h=d3f04032637234b6c7f5a5635cbc675582c725ea;hp=fdcc3d60ec7c0a4dfa2feec32a1a28d1724b6258;hb=6c72dec7e520bf9bef18b5db8656532278bcac26;hpb=0d00e3b691146fbd0f51b0782988a62621a72b88 diff --git a/build/zoneinfo2lua.pl b/build/zoneinfo2lua.pl old mode 100644 new mode 100755 index fdcc3d60e..d3f040326 --- a/build/zoneinfo2lua.pl +++ b/build/zoneinfo2lua.pl @@ -1,14 +1,17 @@ #!/usr/bin/perl # zoneinfo2lua.pl - Make Lua module from /usr/share/zoneinfo -# Execute from within /usr/share/zoneinfo +# Execute from within root of Luci feed, usually feeds/luci # $Id$ 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,32 +40,110 @@ 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 <