diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-08-29 20:15:36 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-08-29 20:15:36 +0000 |
commit | d5e061896a35a49a50124949c2882ac9cbe94589 (patch) | |
tree | 920e7af830e2aa3a766dba5b7aacdca4a6b50a44 /perl-install/ftp.pm | |
parent | c05cafad9c601272884cf75ee4e056bfbf4b2917 (diff) | |
download | drakx-backup-do-not-use-d5e061896a35a49a50124949c2882ac9cbe94589.tar drakx-backup-do-not-use-d5e061896a35a49a50124949c2882ac9cbe94589.tar.gz drakx-backup-do-not-use-d5e061896a35a49a50124949c2882ac9cbe94589.tar.bz2 drakx-backup-do-not-use-d5e061896a35a49a50124949c2882ac9cbe94589.tar.xz drakx-backup-do-not-use-d5e061896a35a49a50124949c2882ac9cbe94589.zip |
no_comment
Diffstat (limited to 'perl-install/ftp.pm')
-rw-r--r-- | perl-install/ftp.pm | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/perl-install/ftp.pm b/perl-install/ftp.pm index e6c27e68c..0879a8b72 100644 --- a/perl-install/ftp.pm +++ b/perl-install/ftp.pm @@ -7,14 +7,18 @@ 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| +1; + + +sub new { + 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 @@ -22,28 +26,28 @@ unless ($ENV{HOST}) { ([^/]*) # 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"; + } + unless ($ENV{LOGIN}) { + $ENV{LOGIN} = 'anonymous'; + $ENV{PASSWORD} = 'mdkinst@test'; + } + + my $host = $ENV{HOST}; + if ($host !~ /^[.\d]+$/) { + $host = join ".", unpack "C4", (gethostbyname $host)[4]; + } + + my $ftp = Net::FTP->new($host, %options) or die; + $ftp->login($ENV{LOGIN}, $ENV{PASSWORD}) or die; + $ftp->binary; + + $ftp; } -my $ftp = Net::FTP->new($host, %options) or die; -$ftp->login($ENV{LOGIN}, $ENV{PASSWORD}) or die; -$ftp->binary; my $retr; - -1; - - sub getFile($) { + $ftp ||= new(); $retr->close if $retr; $retr = $ftp->retr($ENV{PREFIX} . "/" . install_any::relGetFile($_[0])); } |