#!/usr/bin/perl


use MDK::Common;

if (! member(scalar(@ARGV), (1, 2))) {
	die "Usage: $0 LANGUAGE [FORMAT]\nDefault format is \"html\".\n";
}

my %subdirs = (
	'de' => { root => 'aktuell' },
	'en' => { root => '../../', format => 'other-formats/', rformat => '../' },
	'id' => { format => 'other-formats/', rformat => '../' },
);

my $LG = shift @ARGV;
my $format = shift @ARGV;
$format |= 'html';
print "LANGUAGE is $LG, format is $format\n";

system("mkdir $LG") unless -d $LG;
system("lftp -c \"lcd $LG;
open ftp://ibiblio.org/pub/Linux/docs/HOWTO/translations/$LG/$subdirs{$LG}{root}/;
pwd;
cd $subdirs{$LG}{format}$format/;
mirror -n --delete -x 'Linux(|-mini)-html-HOWTOs-200' .;
cd $subdirs{$LG}{rformat}../mini/$subdirs{$LG}{format};
mirror -n --delete $format mini\"");

