diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-08-28 21:16:44 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-08-28 21:16:44 +0000 |
commit | 10eb8eaf9bc1aefd90eef0330fc1aed7751427b7 (patch) | |
tree | 041ec0233350c7aac1ea944582580edc1f9ffdc6 /perl-install/ftp.pm | |
parent | b48994c225138c5a1834877f60be771363e63816 (diff) | |
download | drakx-backup-do-not-use-10eb8eaf9bc1aefd90eef0330fc1aed7751427b7.tar drakx-backup-do-not-use-10eb8eaf9bc1aefd90eef0330fc1aed7751427b7.tar.gz drakx-backup-do-not-use-10eb8eaf9bc1aefd90eef0330fc1aed7751427b7.tar.bz2 drakx-backup-do-not-use-10eb8eaf9bc1aefd90eef0330fc1aed7751427b7.tar.xz drakx-backup-do-not-use-10eb8eaf9bc1aefd90eef0330fc1aed7751427b7.zip |
no_comment
Diffstat (limited to 'perl-install/ftp.pm')
-rw-r--r-- | perl-install/ftp.pm | 49 |
1 files changed, 49 insertions, 0 deletions
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])); +} |