Annotation of ports/japanese/gjiten/patches/patch-dicfiles_getdics_pl, Revision 1.2
1.1 nbrk 1: $OpenBSD$
1.2 ! nbrk 2: --- dicfiles/getdics.pl.orig Sun Oct 29 20:17:36 2006
! 3: +++ dicfiles/getdics.pl Sun Feb 1 21:35:57 2009
1.1 nbrk 4: @@ -15,10 +15,10 @@ my $SYSTEMWIDE = ($< == 0) ? 1 : 0; # if we run as roo
5:
6: my $UTFDICDIR;
7: if ($SYSTEMWIDE == 1) {
8: - $UTFDICDIR = "/usr/share/gjiten/dics";
9: + $UTFDICDIR = "/usr/local/share/gjiten/dics";
10: }
11: else {
12: - $UTFDICDIR = "$ENV{HOME}/gjiten";
13: + $UTFDICDIR = "$ENV{HOME}/.gjiten";
14: die "couldn't get home directory!\n" if "$ENV{HOME}" eq "";
15: }
16:
17: @@ -50,8 +50,8 @@ sub printhelp {
18: them all (this requires ~60Mb of disk space!).
19:
20: If you run this script as a user, the dictionary files will be
21: - installed in \$HOME/gjiten.
22: - If you run it as root, they will be placed under /usr/share/gjiten/dics
23: + installed in \$HOME/.gjiten.
24: + If you run it as root, they will be placed under /usr/local/share/gjiten/dics
25: and they will be set up system-wide in gconf to make them automatically
26: available to all users without any setup.
27:
28: @@ -64,15 +64,15 @@ _HELP_
29: }
30:
31: # binaries
32: -my $WGET = "/usr/bin/wget";
33: -my $GUNZIP = "/bin/gunzip";
34: -my $UNZIP = "/usr/bin/unzip";
35: -my $ICONV = "/usr/bin/iconv";
36: -my $GCONFTOOL = "/usr/bin/gconftool-2";
37: +my $FTP = "/usr/bin/ftp";
38: +my $GUNZIP = "/usr/bin/gunzip";
39: +my $UNZIP = "/usr/local/bin/unzip";
40: +my $ICONV = "/usr/local/bin/iconv";
41: +my $GCONFTOOL = "/usr/local/bin/gconftool-2";
42:
43: #my $DELETETMP = 0; # clean up after finishing?
44:
45: -foreach my $bin ($WGET, $GUNZIP, $ICONV, $GCONFTOOL) {
46: +foreach my $bin ($FTP, $GUNZIP, $ICONV, $GCONFTOOL) {
47: if (! -e $bin) {
48: die "Couldn't find executable $bin!\n";
49: }
50: @@ -80,7 +80,7 @@ foreach my $bin ($WGET, $GUNZIP, $ICONV, $GCONFTOOL) {
51:
52: my @dics = (
53: {
54: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/edict.gz",
55: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/edict.gz",
56: "package" => "edict.gz",
57: "format" => "gzip",
58: "encoding" => "EUC-JP",
59: @@ -90,7 +90,7 @@ my @dics = (
60: "section" => "basic",
61: },
62: {
63: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/kanjidic.gz",
64: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/kanjidic.gz",
65: "package" => "kanjidic.gz",
66: "format" => "gzip",
67: "encoding" => "EUC-JP",
68: @@ -102,7 +102,7 @@ my @dics = (
69:
70: # EXTRA
71: {
72: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/enamdict.gz",
73: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/enamdict.gz",
74: "package" => "enamdict.gz",
75: "format" => "gzip",
76: "encoding" => "EUC-JP",
77: @@ -112,7 +112,7 @@ my @dics = (
78: "section" => "extra",
79: },
80: {
81: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/j_places.gz",
82: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/j_places.gz",
83: "package" => "j_places.gz",
84: "format" => "gzip",
85: "encoding" => "EUC-JP",
86: @@ -122,7 +122,7 @@ my @dics = (
87: "section" => "extra",
88: },
89: {
90: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/lifscdic.Z",
91: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/lifscdic.Z",
92: "package" => "lifscdic.Z",
93: "format" => "gzip",
94: "encoding" => "EUC-JP",
95: @@ -132,7 +132,7 @@ my @dics = (
96: "section" => "extra",
97: },
98: {
99: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/engscidic.gz",
100: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/engscidic.gz",
101: "package" => "engscidic.gz",
102: "format" => "gzip",
103: "encoding" => "EUC-JP",
104: @@ -142,7 +142,7 @@ my @dics = (
105: "section" => "extra",
106: },
107: {
108: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/compdic.gz",
109: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/compdic.gz",
110: "package" => "compdic.gz",
111: "format" => "gzip",
112: "encoding" => "EUC-JP",
113: @@ -152,7 +152,7 @@ my @dics = (
114: "section" => "extra",
115: },
116: {
117: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/geodic.gz",
118: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/geodic.gz",
119: "package" => "geodic.gz",
120: "format" => "gzip",
121: "encoding" => "EUC-JP",
122: @@ -162,7 +162,7 @@ my @dics = (
123: "section" => "extra",
124: },
125: {
126: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/compverb.gz",
127: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/compverb.gz",
128: "package" => "compverb.gz",
129: "format" => "gzip",
130: "encoding" => "EUC-JP",
131: @@ -172,7 +172,7 @@ my @dics = (
132: "section" => "extra",
133: },
134: {
135: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/riverwater.zip",
136: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/riverwater.zip",
137: "package" => "riverwater.zip",
138: "format" => "zip",
139: "encoding" => "EUC-JP",
140: @@ -182,7 +182,7 @@ my @dics = (
141: "section" => "extra",
142: },
143: {
144: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/4jword3_edict.zip",
145: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/4jword3_edict.zip",
146: "package" => "4jword3_edict.zip",
147: "format" => "zip",
148: "encoding" => "EUC-JP",
149: @@ -192,7 +192,7 @@ my @dics = (
150: "section" => "extra",
151: },
152: {
153: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/classical.zip",
154: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/classical.zip",
155: "package" => "classical.zip",
156: "format" => "zip",
157: "encoding" => "EUC-JP",
158: @@ -202,7 +202,7 @@ my @dics = (
159: "section" => "extra",
160: },
161: {
162: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/lingdic.zip",
163: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/lingdic.zip",
164: "package" => "lingdic.zip",
165: "format" => "zip",
166: "encoding" => "EUC-JP",
167: @@ -212,7 +212,7 @@ my @dics = (
168: "section" => "extra",
169: },
170: {
171: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/forsdic.zip",
172: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/forsdic.zip",
173: "package" => "forsdic.zip",
174: "format" => "zip",
175: "encoding" => "EUC-JP",
176: @@ -222,7 +222,7 @@ my @dics = (
177: "section" => "extra",
178: },
179: {
180: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/aviation.zip",
181: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/aviation.zip",
182: "package" => "aviation.zip",
183: "format" => "zip",
184: "encoding" => "EUC-JP",
185: @@ -232,7 +232,7 @@ my @dics = (
186: "section" => "extra",
187: },
188: {
189: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/concrete.zip",
190: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/concrete.zip",
191: "package" => "concrete.zip",
192: "format" => "zip",
193: "encoding" => "EUC-JP",
194: @@ -242,7 +242,7 @@ my @dics = (
195: "section" => "extra",
196: },
197: {
198: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/findic.zip",
199: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/findic.zip",
200: "package" => "findic.zip",
201: "format" => "zip",
202: "encoding" => "EUC-JP",
203: @@ -252,7 +252,7 @@ my @dics = (
204: "section" => "extra",
205: },
206: {
207: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/mktdic.zip",
208: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/mktdic.zip",
209: "package" => "mktdic.zip",
210: "format" => "zip",
211: "encoding" => "EUC-JP",
212: @@ -262,7 +262,7 @@ my @dics = (
213: "section" => "extra",
214: },
215: {
216: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/stardict.zip",
217: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/stardict.zip",
218: "package" => "stardict.zip",
219: "format" => "zip",
220: "encoding" => "EUC-JP",
221: @@ -272,7 +272,7 @@ my @dics = (
222: "section" => "extra",
223: },
224: {
225: - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/buddhdic.zip",
226: + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/buddhdic.zip",
227: "package" => "buddhdic.zip",
228: "format" => "zip",
229: "encoding" => "UTF-8",
230: @@ -328,11 +328,11 @@ foreach my $dic (@dics) {
231: next if (($BASICSETUP == 1) && ($dic->{section} eq "extra"));
232:
233: # DOWNLOAD
234: -#wget -c http://ftp.cc.monash.edu.au/pub/nihongo/edict.gz -O dl/edict.gz
1.2 ! nbrk 235: - if (! -f "$DLDIR/$dic->{package}") {
! 236: +#ftp -o dl/edict.gz ftp://ftp.monash.edu.au/pub/nihongo/edict.gz
! 237: +if (! -f "$DLDIR/$dic->{package}") {
1.1 nbrk 238: print "Downloading \"$dic->{name}\" from $dic->{url}\n";
239: - my @wget = ("$WGET -q -c $dic->{url} -O $DLDIR/$dic->{package}");
240: - if (system(@wget) != 0) {
1.2 ! nbrk 241: + my @ftp = ("$FTP -o $DLDIR/$dic->{package} $dic->{url}");
1.1 nbrk 242: + if (system(@ftp) != 0) {
243: $dic->{status} = "download failed";
244: next;
245: }
1.2 ! nbrk 246: @@ -341,12 +341,12 @@ foreach my $dic (@dics) {
! 247:
! 248:
! 249: # UNPACK
! 250: -#gunzip <dl/edict.gz >tmp/edict
! 251: +#gunzip -o tmp/edict dl/edict.gz
! 252: #unzip -o dl/classical.zip -d tmp
! 253: if (! -f "$DLDIR/$dic->{sourcefile}") {
! 254: my @unpack;
! 255: if ($dic->{format} eq "gzip") {
! 256: - @unpack = ("$GUNZIP <$DLDIR/$dic->{package} >$DLDIR/$dic->{sourcefile}");
! 257: + @unpack = ("$GUNZIP -o $DLDIR/$dic->{sourcefile} $DLDIR/$dic->{package}");
! 258: #print join(" ", @unpack) . "\n";
! 259: if (system(@unpack) != 0) {
! 260: $dic->{status} = "unpack failed";
1.1 nbrk 261: @@ -373,8 +373,8 @@ foreach my $dic (@dics) {
262: if (! -f "$UTFDICDIR/$dic->{targetfile}") {
263: my @iconv;
264: if ($dic->{encoding} ne "UTF-8") {
265: - #print "$ICONV -c -f $dic->{encoding} -t UTF-8 $DLDIR/$dic->{sourcefile} -o $DLDIR/$dic->{targetfile}.utf8\n";
266: - @iconv = ("$ICONV -c -f $dic->{encoding} -t UTF-8 $DLDIR/$dic->{sourcefile} -o $DLDIR/$dic->{targetfile}.utf8");
267: + #print "$ICONV -c -f $dic->{encoding} -t UTF-8 $DLDIR/$dic->{sourcefile} > $DLDIR/$dic->{targetfile}.utf8\n";
268: + @iconv = ("$ICONV -c -f $dic->{encoding} -t UTF-8 $DLDIR/$dic->{sourcefile} > $DLDIR/$dic->{targetfile}.utf8");
269: if (system(@iconv) != 0) {
270: $dic->{status} = "iconv failed";
271: next;
CVSweb