luci-base: escape path strings and field parameter
[project/luci.git] / build / zoneinfo2lua.pl
index 722711a..1a0bee1 100755 (executable)
@@ -1,6 +1,6 @@
 #!/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;
@@ -8,7 +8,7 @@ use strict;
 my %TZ;
 
 my $tzdin  = $ARGV[0] || "/usr/share/zoneinfo";
-my $tzdout = $ARGV[1] || "./libs/sys/luasrc/sys/zoneinfo";
+my $tzdout = $ARGV[1] || "./modules/luci-base/luasrc/sys/zoneinfo";
 
 local $/ = "\012";
 open( ZTAB, "< $tzdin/zone.tab" ) || die "open($tzdin/zone.tab): $!";
@@ -46,21 +46,40 @@ while( ! eof ZTAB ) {
 
 close ZTAB;
 
+# Add Etc/GMT zones from manually as they are not in zone.tab
+$TZ{"Etc/GMT"} = "GMT0";
+$TZ{"Etc/GMT-1"} = "<+01>-1";
+$TZ{"Etc/GMT-2"} = "<+02>-2";
+$TZ{"Etc/GMT-3"} = "<+03>-3";
+$TZ{"Etc/GMT-4"} = "<+04>-4";
+$TZ{"Etc/GMT-5"} = "<+05>-5";
+$TZ{"Etc/GMT-6"} = "<+06>-6";
+$TZ{"Etc/GMT-7"} = "<+07>-7";
+$TZ{"Etc/GMT-8"} = "<+08>-8";
+$TZ{"Etc/GMT-9"} = "<+09>-9";
+$TZ{"Etc/GMT-10"} = "<+10>-10";
+$TZ{"Etc/GMT-11"} = "<+11>-11";
+$TZ{"Etc/GMT-12"} = "<+12>-12";
+$TZ{"Etc/GMT-13"} = "<+13>-13";
+$TZ{"Etc/GMT-14"} = "<+14>-14";
+$TZ{"Etc/GMT+1"} = "<-01>1";
+$TZ{"Etc/GMT+2"} = "<-02>2";
+$TZ{"Etc/GMT+3"} = "<-03>3";
+$TZ{"Etc/GMT+4"} = "<-04>4";
+$TZ{"Etc/GMT+5"} = "<-05>5";
+$TZ{"Etc/GMT+6"} = "<-06>6";
+$TZ{"Etc/GMT+7"} = "<-07>7";
+$TZ{"Etc/GMT+8"} = "<-08>8";
+$TZ{"Etc/GMT+9"} = "<-09>9";
+$TZ{"Etc/GMT+10"} = "<-10>10";
+$TZ{"Etc/GMT+11"} = "<-11>11";
+$TZ{"Etc/GMT+12"} = "<-12>12";
 
 open(O, "> $tzdout/tzdata.lua") || die "open($tzdout/tzdata.lua): $!\n";
 
 print STDERR "Writing time zones to $tzdout/tzdata.lua ... ";
 print O <<HEAD;
---[[
-LuCI - Autogenerated Zoneinfo Module
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-]]--
+-- Licensed to the public under the Apache License 2.0.
 
 module "luci.sys.zoneinfo.tzdata"
 
@@ -81,16 +100,7 @@ open (O, "> $tzdout/tzoffset.lua") || die "open($tzdout/tzoffset.lua): $!\n";
 
 print STDERR "Writing time offsets to $tzdout/tzoffset.lua ... ";
 print O <<HEAD;
---[[
-LuCI - Autogenerated Zoneinfo Module
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-]]--
+-- Licensed to the public under the Apache License 2.0.
 
 module "luci.sys.zoneinfo.tzoffset"