$OpenBSD$ --- dicfiles/getdics.pl.orig Fri Jan 30 02:45:04 2009 +++ dicfiles/getdics.pl Fri Jan 30 03:05:17 2009 @@ -15,10 +15,10 @@ my $SYSTEMWIDE = ($< == 0) ? 1 : 0; # if we run as roo my $UTFDICDIR; if ($SYSTEMWIDE == 1) { - $UTFDICDIR = "/usr/share/gjiten/dics"; + $UTFDICDIR = "/usr/local/share/gjiten/dics"; } else { - $UTFDICDIR = "$ENV{HOME}/gjiten"; + $UTFDICDIR = "$ENV{HOME}/.gjiten"; die "couldn't get home directory!\n" if "$ENV{HOME}" eq ""; } @@ -50,8 +50,8 @@ sub printhelp { them all (this requires ~60Mb of disk space!). If you run this script as a user, the dictionary files will be - installed in \$HOME/gjiten. - If you run it as root, they will be placed under /usr/share/gjiten/dics + installed in \$HOME/.gjiten. + If you run it as root, they will be placed under /usr/local/share/gjiten/dics and they will be set up system-wide in gconf to make them automatically available to all users without any setup. @@ -64,15 +64,15 @@ _HELP_ } # binaries -my $WGET = "/usr/bin/wget"; -my $GUNZIP = "/bin/gunzip"; -my $UNZIP = "/usr/bin/unzip"; -my $ICONV = "/usr/bin/iconv"; -my $GCONFTOOL = "/usr/bin/gconftool-2"; +my $FTP = "/usr/bin/ftp"; +my $GUNZIP = "/usr/bin/gunzip"; +my $UNZIP = "/usr/local/bin/unzip"; +my $ICONV = "/usr/local/bin/iconv"; +my $GCONFTOOL = "/usr/local/bin/gconftool-2"; #my $DELETETMP = 0; # clean up after finishing? -foreach my $bin ($WGET, $GUNZIP, $ICONV, $GCONFTOOL) { +foreach my $bin ($FTP, $GUNZIP, $ICONV, $GCONFTOOL) { if (! -e $bin) { die "Couldn't find executable $bin!\n"; } @@ -80,7 +80,7 @@ foreach my $bin ($WGET, $GUNZIP, $ICONV, $GCONFTOOL) { my @dics = ( { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/edict.gz", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/edict.gz", "package" => "edict.gz", "format" => "gzip", "encoding" => "EUC-JP", @@ -90,7 +90,7 @@ my @dics = ( "section" => "basic", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/kanjidic.gz", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/kanjidic.gz", "package" => "kanjidic.gz", "format" => "gzip", "encoding" => "EUC-JP", @@ -102,7 +102,7 @@ my @dics = ( # EXTRA { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/enamdict.gz", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/enamdict.gz", "package" => "enamdict.gz", "format" => "gzip", "encoding" => "EUC-JP", @@ -112,7 +112,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/j_places.gz", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/j_places.gz", "package" => "j_places.gz", "format" => "gzip", "encoding" => "EUC-JP", @@ -122,7 +122,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/lifscdic.Z", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/lifscdic.Z", "package" => "lifscdic.Z", "format" => "gzip", "encoding" => "EUC-JP", @@ -132,7 +132,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/engscidic.gz", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/engscidic.gz", "package" => "engscidic.gz", "format" => "gzip", "encoding" => "EUC-JP", @@ -142,7 +142,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/compdic.gz", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/compdic.gz", "package" => "compdic.gz", "format" => "gzip", "encoding" => "EUC-JP", @@ -152,7 +152,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/geodic.gz", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/geodic.gz", "package" => "geodic.gz", "format" => "gzip", "encoding" => "EUC-JP", @@ -162,7 +162,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/compverb.gz", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/compverb.gz", "package" => "compverb.gz", "format" => "gzip", "encoding" => "EUC-JP", @@ -172,7 +172,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/riverwater.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/riverwater.zip", "package" => "riverwater.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -182,7 +182,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/4jword3_edict.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/4jword3_edict.zip", "package" => "4jword3_edict.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -192,7 +192,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/classical.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/classical.zip", "package" => "classical.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -202,7 +202,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/lingdic.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/lingdic.zip", "package" => "lingdic.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -212,7 +212,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/forsdic.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/forsdic.zip", "package" => "forsdic.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -222,7 +222,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/aviation.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/aviation.zip", "package" => "aviation.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -232,7 +232,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/concrete.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/concrete.zip", "package" => "concrete.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -242,7 +242,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/findic.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/findic.zip", "package" => "findic.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -252,7 +252,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/mktdic.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/mktdic.zip", "package" => "mktdic.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -262,7 +262,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/stardict.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/stardict.zip", "package" => "stardict.zip", "format" => "zip", "encoding" => "EUC-JP", @@ -272,7 +272,7 @@ my @dics = ( "section" => "extra", }, { - "url" => "http://ftp.cc.monash.edu.au/pub/nihongo/buddhdic.zip", + "url" => "ftp://ftp.monash.edu.au/pub/nihongo/buddhdic.zip", "package" => "buddhdic.zip", "format" => "zip", "encoding" => "UTF-8", @@ -328,11 +328,11 @@ foreach my $dic (@dics) { next if (($BASICSETUP == 1) && ($dic->{section} eq "extra")); # DOWNLOAD -#wget -c http://ftp.cc.monash.edu.au/pub/nihongo/edict.gz -O dl/edict.gz +#ftp -CV ftp://ftp.monash.edu.au/pub/nihongo/edict.gz -o dl/edict.gz if (! -f "$DLDIR/$dic->{package}") { print "Downloading \"$dic->{name}\" from $dic->{url}\n"; - my @wget = ("$WGET -q -c $dic->{url} -O $DLDIR/$dic->{package}"); - if (system(@wget) != 0) { + my @ftp = ("$FTP -CV $dic->{url} -o $DLDIR/$dic->{package}"); + if (system(@ftp) != 0) { $dic->{status} = "download failed"; next; } @@ -373,8 +373,8 @@ foreach my $dic (@dics) { if (! -f "$UTFDICDIR/$dic->{targetfile}") { my @iconv; if ($dic->{encoding} ne "UTF-8") { - #print "$ICONV -c -f $dic->{encoding} -t UTF-8 $DLDIR/$dic->{sourcefile} -o $DLDIR/$dic->{targetfile}.utf8\n"; - @iconv = ("$ICONV -c -f $dic->{encoding} -t UTF-8 $DLDIR/$dic->{sourcefile} -o $DLDIR/$dic->{targetfile}.utf8"); + #print "$ICONV -c -f $dic->{encoding} -t UTF-8 $DLDIR/$dic->{sourcefile} > $DLDIR/$dic->{targetfile}.utf8\n"; + @iconv = ("$ICONV -c -f $dic->{encoding} -t UTF-8 $DLDIR/$dic->{sourcefile} > $DLDIR/$dic->{targetfile}.utf8"); if (system(@iconv) != 0) { $dic->{status} = "iconv failed"; next;