summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-08-24 20:00:24 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-08-24 20:00:24 +0000
commit9062c92ba51a7170424f825c60e5ff5ec46c85dd (patch)
tree87d6ac3e24fa81ba65847ce0bff69894ab5ceacc /perl-install
parent10b649b6503f47388f1548c8ba9391dd6ce0284e (diff)
downloaddrakx-backup-do-not-use-9062c92ba51a7170424f825c60e5ff5ec46c85dd.tar
drakx-backup-do-not-use-9062c92ba51a7170424f825c60e5ff5ec46c85dd.tar.gz
drakx-backup-do-not-use-9062c92ba51a7170424f825c60e5ff5ec46c85dd.tar.bz2
drakx-backup-do-not-use-9062c92ba51a7170424f825c60e5ff5ec46c85dd.tar.xz
drakx-backup-do-not-use-9062c92ba51a7170424f825c60e5ff5ec46c85dd.zip
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install2.pm24
-rw-r--r--perl-install/install_any.pm2
-rw-r--r--perl-install/install_steps.pm8
-rw-r--r--perl-install/network.pm55
-rw-r--r--perl-install/partition_table.pm1
5 files changed, 49 insertions, 41 deletions
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 17bd8f1b1..90b8d8b2d 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -100,15 +100,15 @@ appropriate to you."),
my @installStepsFields = qw(text redoable onError needs);
my @installSteps = (
- selectLanguage => [ __("Choose your language"), 1, 1 ],
- selectPath => [ __("Choose install or upgrade"), 0, 0 ],
- selectInstallClass => [ __("Select installation class"), 1, 1, "selectPath" ],
- setupSCSI => [ __("Setup SCSI"), 1, 0 ],
- partitionDisks => [ __("Setup filesystems"), 1, 0 ],
- formatPartitions => [ __("Format partitions"), 1, -1, "partitionDisks" ],
- choosePackages => [ __("Choose packages to install"), 1, 1, "selectInstallClass" ],
- doInstallStep => [ __("Install system"), 1, -1, ["formatPartitions", "selectPath"] ],
-# configureMouse => [ __("Configure mouse"), 0, 0 ],
+# selectLanguage => [ __("Choose your language"), 1, 1 ],
+# selectPath => [ __("Choose install or upgrade"), 0, 0 ],
+# selectInstallClass => [ __("Select installation class"), 1, 1, "selectPath" ],
+# setupSCSI => [ __("Setup SCSI"), 1, 0 ],
+# partitionDisks => [ __("Setup filesystems"), 1, 0 ],
+# formatPartitions => [ __("Format partitions"), 1, -1, "partitionDisks" ],
+# choosePackages => [ __("Choose packages to install"), 1, 1, "selectInstallClass" ],
+# doInstallStep => [ __("Install system"), 1, -1, ["formatPartitions", "selectPath"] ],
+## configureMouse => [ __("Configure mouse"), 0, 0 ],
configureNetwork => [ __("Configure networking"), 1, 1, "formatPartitions" ],
# configureTimezone => [ __("Configure timezone"), 0, 0 ],
# configureServices => [ __("Configure services"), 0, 0 ],
@@ -249,7 +249,8 @@ sub formatPartitions {
fs::mount_all([ grep { isExt2($_) || isSwap($_) } @{$o->{fstab}} ], $o->{prefix});
- mkdir "$o->{prefix}/$_", 0755 foreach qw(dev etc home mnt tmp var var/tmp var/lib var/lib/rpm);
+ mkdir "$o->{prefix}/$_", 0755 foreach qw(dev etc etc/sysconfig etc/sysconfig/network-scripts
+ home mnt tmp var var/tmp var/lib var/lib/rpm);
network::add2hosts("$o->{prefix}/etc/hosts", "127.0.0.1", "localhost.localdomain");
pkgs::init_db($o->{prefix}, $o->{isUpgrade});
}
@@ -330,7 +331,8 @@ sub main {
$o = install_steps_graphical->new($o);
- $o->{netc} = network::read_conf("/tmp/network");
+ # all information is put in {intf}, but don't let network be aware of this :)
+ $o->{intf} = network::read_conf("/tmp/network");
if (my ($file) = glob_('/tmp/ifcfg-*')) {
log::l("found network config file $file");
$o->{intf} = network::read_interface_conf($file);
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 155f2ef04..58fde0abd 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -77,7 +77,7 @@ sub mouse_detect() {
sub shells($) {
my ($o) = @_;
- my @l = grep { 1 || -x "$o->{prefix}$_" } @{$o->{default}{shells}};
+ my @l = grep { -x "$o->{prefix}$_" } @{$o->{default}{shells}};
@l or die "no shell available";
@l;
}
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 5c4a189fb..a42cb57bd 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -140,13 +140,15 @@ sub mouseConfig($) {
sub configureNetwork($) {
my ($o) = @_;
my $etc = "$o->{prefix}/etc";
+
+ # all information is in {intf}, but don't let network be aware of this :)
#
# rc = checkNetConfig(&$o->{intf}, &$o->{netc}, &$o->{intfFinal},
# &$o->{netcFinal}, &$o->{driversLoaded}, $o->{direction});
- network::write_conf("$etc/sysconfig/network", $o->{netc});
+ network::write_conf("$etc/sysconfig/network", $o->{intf});
network::write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$o->{intf}{DEVICE}", $o->{intf});
- network::write_resolv_conf("$etc/resolv.conf", $o->{netc});
- network::add2hosts("$etc/hosts", $o->{intf}{IPADDR}, $o->{netc}{HOSTNAME});
+ network::write_resolv_conf("$etc/resolv.conf", $o->{intf});
+ network::add2hosts("$etc/hosts", $o->{intf}{IPADDR}, $o->{intf}{HOSTNAME});
# syscall_('sethostname', $hostname, length $hostname) or warn "sethostname failed: $!";
#res_init(); # reinit the resolver so DNS changes take affect
}
diff --git a/perl-install/network.pm b/perl-install/network.pm
index 29edb4ff3..b97a043ed 100644
--- a/perl-install/network.pm
+++ b/perl-install/network.pm
@@ -42,34 +42,11 @@ sub write_conf {
setVarsInSh($file, $netc, qw(NETWORKING FORWARD_IPV4 HOSTNAME DOMAINNAME GATEWAY GATEWAYDEV));
}
-sub add2hosts {
- my ($file, $ip, $hostname) = @_;
- my %l = ($ip => $hostname);
-
- local *F;
- if (-e $file) {
- open F, $file or die "cannot open $file: $!";
- /\s*(\S+)(.*)/ and $l{$1} = $2 foreach <F>;
- }
- log::l("writing host information to $file");
- open F, ">$file" or die "cannot write $file: $!";
- while (my ($ip, $v) = each %l) {
- print F "$ip";
- if ($v =~ /^\s/) {
- print F $v;
- } else {
- print F "\t\t$v";
- print F " $1" if $v =~ /(.*?)\./;
- }
- print F "\n";
- }
-}
-
sub write_resolv_conf {
my ($file, $netc) = @_;
# We always write these, even if they were autoconfigured. Otherwise, the reverse name lookup in the install doesn't work.
- unless ($netc->{DOMAINNAME} || $netc->{dnsServers}) {
+ unless ($netc->{DOMAINNAME} || dnsServers($netc)) {
unlink($file);
log::l("neither domain name nor dns server are configured");
return 0;
@@ -79,7 +56,7 @@ sub write_resolv_conf {
local *F;
open F, "> $file" or die "cannot write $file: $!";
print F "search $netc->{DOMAINNAME}\n" if $netc->{DOMAINNAME};
- print F "nameserver $_\n" foreach @{$netc->{dnsServers}};
+ print F "nameserver $_\n" foreach dnsServers($netc);
print F "#$_" foreach @l;
#res_init(); # reinit the resolver so DNS changes take affect
@@ -93,12 +70,34 @@ sub write_interface_conf {
setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT));
}
+sub add2hosts {
+ my ($file, $ip, $hostname) = @_;
+ my %l = ($ip => $hostname);
+
+ local *F;
+ if (-e $file) {
+ open F, $file or die "cannot open $file: $!";
+ /\s*(\S+)(.*)/ and $l{$1} = $2 foreach <F>;
+ }
+ log::l("writing host information to $file");
+ open F, ">$file" or die "cannot write $file: $!";
+ while (my ($ip, $v) = each %l) {
+ print F "$ip";
+ if ($v =~ /^\s/) {
+ print F $v;
+ } else {
+ print F "\t\t$v";
+ print F " $1" if $v =~ /(.*?)\./;
+ }
+ print F "\n";
+ }
+}
# The interface/gateway needs to be configured before this will work!
sub guessHostname {
my ($prefix, $netc, $intf) = @_;
- $intf->{isUp} && $netc->{dnsServers} or return 0;
+ $intf->{isUp} && dnsServers($netc) or return 0;
$netc->{HOSTNAME} && $netc->{DOMAINNAME} and return 1;
write_resolv_conf("$prefix/etc/resolv.conf", $netc);
@@ -127,3 +126,7 @@ sub getAvailableNetDevice {
$device;
}
+sub dnsServers {
+ my ($netc) = @_;
+ map { $netc->{$_} } qw(dnsServer dnsServer2 dnsServer3);
+}
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 5ef63bc65..5d7cbd890 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -83,6 +83,7 @@ my %fs2type = reverse %type2fs;
1;
sub important_types { $_[0] and return sort values %types; @important_types }
+
sub type2name($) { $types{$_[0]} || 'unknown' }
sub type2fs($) { $type2fs{$_[0]} }
sub name2type($) { $types_rev{$_[0]} }