From 7a08dbc23f114bf6b6eae275e21e63b6667a1b37 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 25 Nov 1999 02:21:17 +0000 Subject: no_comment --- perl-install/ftp.pm | 8 ++------ perl-install/http.pm | 13 +++++++++++++ perl-install/install_any.pm | 1 + perl-install/network.pm | 5 +++++ perl-install/partition_table.pm | 1 + perl-install/standalone/diskdrake | 9 +++++++-- 6 files changed, 29 insertions(+), 8 deletions(-) (limited to 'perl-install') diff --git a/perl-install/ftp.pm b/perl-install/ftp.pm index 6e1002840..6c498f2af 100644 --- a/perl-install/ftp.pm +++ b/perl-install/ftp.pm @@ -3,6 +3,7 @@ package ftp; use Net::FTP; use install_any; +use network; use log; # non-rentrant!! @@ -34,12 +35,7 @@ sub new { $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 ''; + my $ftp = Net::FTP->new(network::resolv($ENV{HOST}), %options) or die ''; $ftp->login($ENV{LOGIN}, $ENV{PASSWORD}) or die ''; $ftp->binary; diff --git a/perl-install/http.pm b/perl-install/http.pm index fbf6c001c..9da302513 100644 --- a/perl-install/http.pm +++ b/perl-install/http.pm @@ -3,6 +3,7 @@ package http; use IO::Socket; use install_any; +use network; my $sock; @@ -11,6 +12,7 @@ sub getFile($) { local($^W) = 0; my ($host, $port, $path) = $ENV{URLPREFIX} =~ m,^http://([^/:]+)(?::(\d+))?(/\S*)?$,; + $host = network::resolv($host); $path .= "/" . install_any::relGetFile($_[0]); $sock->close if $sock; @@ -24,6 +26,17 @@ sub getFile($) { "Host: $host" . ($port && ":$port"), "User-Agent: DrakX/vivelinuxabaszindozs", "", ""); + + #- skip until empty line + local $_; + my ($now, $last) = 0; + do { + $last = $now; + sysread($sock, $_, 1) || die; + sysread($sock, $_, 1) || die if /\015/; + $now = /\012/; + } until ($now && $last); + $sock; } diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 2b2c6e018..dbacd6e12 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -471,6 +471,7 @@ sub install_urpmi { my $dir = ${{ nfs => "file://mnt/nfs", ftp => $ENV{URLPREFIX}, + http => $ENV{URLPREFIX}, cdrom => "removable_cdrom_1://mnt/cdrom" }}{$method}; local *FILES; open FILES, "hdlist2files $f|"; chop, print LIST "$dir/Mandrake/RPMS/$_\n" foreach ; diff --git a/perl-install/network.pm b/perl-install/network.pm index 9ddde836f..e471734bc 100644 --- a/perl-install/network.pm +++ b/perl-install/network.pm @@ -146,6 +146,11 @@ sub sethostname { syscall_('sethostname', $netc->{HOSTNAME}, length $netc->{HOSTNAME}) or log::l("sethostname failed: $!"); } +sub resolv($) { + my ($name) = @_; + is_ip($name) ? $name : join(".", unpack "C4", (gethostbyname $name)[4]); +} + sub dnsServers { my ($netc) = @_; grep { $_ } map { $netc->{$_} } qw(dnsServer dnsServer2 dnsServer3); diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index 7bc22ada5..83831d28f 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -229,6 +229,7 @@ sub verifyParts($) { } sub verifyPrimary($) { my ($pt) = @_; + $_->{start} > 0 || die "partition must NOT start at sector 0" foreach @{$pt->{normal}}; verifyParts_(@{$pt->{normal}}, $pt->{extended}); } diff --git a/perl-install/standalone/diskdrake b/perl-install/standalone/diskdrake index a3ffafe83..1a9bba3c3 100755 --- a/perl-install/standalone/diskdrake +++ b/perl-install/standalone/diskdrake @@ -22,7 +22,7 @@ # DiskDrake is also based upon the libfdisk and the install from Red Hat Software -use lib qw(/usr/lib/libDrakX .); +use lib qw(/usr/lib/libDrakX); use common qw(:common :functional); use diskdrake; use interactive_gtk; @@ -31,8 +31,13 @@ use fsedit; use fs; use log; +local $_ = join '', @ARGV; + +/-h/ and die "usage: XFdrake [--expert] [--testing]\n"; + +$::expert = /--expert/; +$::testing = /--testing/; $::isStandalone = 1; -#$::expert = 1; if ($>) { $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; -- cgit v1.2.1