[BACK]Return to patch-dicfiles_getdics_pl CVS log [TXT][DIR] Up to [local] / ports / japanese / gjiten / patches

File: [local] / ports / japanese / gjiten / patches / patch-dicfiles_getdics_pl (download)

Revision 1.2, Sun Feb 1 19:53:56 2009 UTC (15 years, 3 months ago) by nbrk
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +21 -5 lines

do not use -CV to ftp(1) and properly specify an output file name;
correct gunzip flags to OpenBSD's gunzip;

this unbreaks downloading of dictionaries.

$OpenBSD$
--- dicfiles/getdics.pl.orig	Sun Oct 29 20:17:36 2006
+++ dicfiles/getdics.pl	Sun Feb  1 21:35:57 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
-    if (! -f "$DLDIR/$dic->{package}") {
+#ftp -o dl/edict.gz ftp://ftp.monash.edu.au/pub/nihongo/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 -o $DLDIR/$dic->{package} $dic->{url}");
+	if (system(@ftp) != 0) {
 	    $dic->{status} = "download failed";
 	    next;
 	}
@@ -341,12 +341,12 @@ foreach my $dic (@dics) {
 
 
 # UNPACK
-#gunzip   <dl/edict.gz >tmp/edict
+#gunzip -o tmp/edict dl/edict.gz 
 #unzip -o  dl/classical.zip -d tmp
     if (! -f "$DLDIR/$dic->{sourcefile}") {
 	my @unpack;
 	if ($dic->{format} eq "gzip") {
-	    @unpack = ("$GUNZIP <$DLDIR/$dic->{package} >$DLDIR/$dic->{sourcefile}");
+	    @unpack = ("$GUNZIP -o $DLDIR/$dic->{sourcefile} $DLDIR/$dic->{package}");
 	    #print join(" ", @unpack) . "\n";
 	    if (system(@unpack) != 0) {
 		$dic->{status} = "unpack failed";
@@ -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;