From 10eb8eaf9bc1aefd90eef0330fc1aed7751427b7 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sat, 28 Aug 1999 21:16:44 +0000 Subject: no_comment --- perl-install/ftp.pm | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 perl-install/ftp.pm (limited to 'perl-install/ftp.pm') diff --git a/perl-install/ftp.pm b/perl-install/ftp.pm new file mode 100644 index 000000000..e6c27e68c --- /dev/null +++ b/perl-install/ftp.pm @@ -0,0 +1,49 @@ +package ftp; + +use Net::FTP; + +use install_any; +use log; + +# non-rentrant!! + +my %options = (Passive => 1); +$options{Firewall} = $ENV{PROXY} if $ENV{PROXY}; +$options{Port} = $ENV{PROXYPORT} if $ENV{PROXYPORT}; +my @l; +unless ($ENV{HOST}) { + # must be in kickstart, using URLPREFIX to find out information + ($ENV{LOGIN}, $ENV{PASSWORD}, $ENV{HOST}, $ENV{PREFIX}) = @l = + $ENV{URLPREFIX} =~ m| + :// + (?: ([^:]*) # login + (?: :([^@]*))? # password + @)? + ([^/]*) # host + /?(.*) # prefix + |x; +} +unless ($ENV{LOGIN}) { + $ENV{LOGIN} = 'anonymous'; + $ENV{PASSWORD} = 'mdkinst@test'; +} + +my $host = $ENV{HOST}; +if ($host !~ /^[.\d]+$/) { + $host = join ".", unpack "C4", (gethostbyname $host)[4]; + print ">>>>> $host <<<<<<\n"; +} + +my $ftp = Net::FTP->new($host, %options) or die; +$ftp->login($ENV{LOGIN}, $ENV{PASSWORD}) or die; +$ftp->binary; + +my $retr; + +1; + + +sub getFile($) { + $retr->close if $retr; + $retr = $ftp->retr($ENV{PREFIX} . "/" . install_any::relGetFile($_[0])); +} -- cgit v1.2.1