From 69907ed1e861483d4063a1eec3662690681651a7 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 27 Aug 1999 10:58:06 +0000 Subject: no_comment --- perl-install/Makefile | 9 +++++ perl-install/Xconfig.pm | 8 ++-- perl-install/Xconfigurator.pm | 8 ++-- perl-install/common.pm | 2 + perl-install/fs.pm | 10 +++-- perl-install/install2.pm | 41 +++++++++++--------- perl-install/install_any.pm | 24 ++++++++++-- perl-install/install_steps.pm | 4 +- perl-install/install_steps_interactive.pm | 7 +--- perl-install/my_gtk.pm | 4 +- perl-install/network.pm | 6 +++ perl-install/pkgs.pm | 64 ++++++++++++++++--------------- perl-install/share/list | 1 + 13 files changed, 113 insertions(+), 75 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Makefile b/perl-install/Makefile index 2d4ca11f8..aef4c2bd0 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -1,8 +1,10 @@ VERSION = 2.2.10-BOOT +SUDO = sudo SO_FILES = c/blib/arch/auto/c/c.so PMS = *.pm c/*.pm resize_fat/*.pm po/*.pm pci_probing/*.pm commands install2 diskdrake XFdrake ROOTDEST = /export DEST = $(ROOTDEST)/Mandrake/mdkinst +STAGE2 = $(ROOTDEST)/Mandrake/base/mdkinst_stage2 DESTREP4PMS = $(DEST)/usr/bin/perl-install PERL = perl LOCALFILES = $(PERL) mouseconfig @@ -158,6 +160,13 @@ full_stage2: stage2: $(MAKE) install_pms + + dd if=/dev/zero of=$(STAGE2) bs=1M count=16 + echo y | /sbin/mke2fs $(STAGE2) + $(SUDO) mount $(STAGE2) /mnt/stage2 -o loop + $(SUDO) cp -a $(DEST)/* /mnt/stage2 + $(SUDO) umount $(STAGE2) + gzip -f -9 $(STAGE2) # cd $(ROOTDEST) ; tar cfz /tmp/instimage-full.tgz Mandrake # cd $(ROOTDEST) ; tar cfz /tmp/instimage-light.tgz Mandrake/base/compss Mandrake/mdkinst/usr/[bl]* diff --git a/perl-install/Xconfig.pm b/perl-install/Xconfig.pm index 1d1babd49..edbdc2c01 100644 --- a/perl-install/Xconfig.pm +++ b/perl-install/Xconfig.pm @@ -22,9 +22,9 @@ sub getinfo { getinfoFromSysconfig($o); $o->{mouse}{emulate3buttons} = 1; - unless ($o->{mouse}{xtype}) { + unless ($o->{mouse}{XMOUSETYPE}) { my ($type, $dev) = split("\n", `mouseconfig --nointeractive 2>/dev/null`) or die "mouseconfig failed"; - $o->{mouse}{xtype} ||= $type; + $o->{mouse}{XMOUSETYPE} ||= $type; $o->{mouse}{device} ||= "/dev/$dev"; } $o->{mouse}{device} ||= "/dev/mouse" if -e "/dev/mouse"; @@ -43,7 +43,7 @@ sub getinfoFromXF86Config { if (/^Section "Keyboard"/ .. /^EndSection/) { $o->{keyboard}{xkb_keymap} ||= $1 if /^\s*XkbLayout\s+"(.*?)"/; } elsif (/^Section "Pointer"/ .. /^EndSection/) { - $o->{mouse}{xtype} ||= $1 if /^\s*Protocol\s+"(.*?)"/; + $o->{mouse}{XMOUSETYPE} ||= $1 if /^\s*Protocol\s+"(.*?)"/; $o->{mouse}{device} ||= $1 if /^\s*Device\s+"(.*?)"/; } elsif (my $i = /^Section "Device"/ .. /^EndSection/) { if ($i = 1 && $c{type} && $c{type} ne "Generic VGA") { @@ -81,7 +81,7 @@ sub getinfoFromXF86Config { sub getinfoFromSysconfig { my $o = shift || {}; if (my %mouse = getVarsFromSh "/etc/sysconfig/mouse") { - $o->{mouse}{xtype} ||= $mouse{XMOUSETYPE}; + $o->{mouse}{XMOUSETYPE} ||= $mouse{XMOUSETYPE}; } if (my %keyboard = getVarsFromSh "/etc/sysconfig/keyboard") { $keyboard{KEYTABLE} or last; diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 30eeaf047..dab54bda3 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -135,7 +135,7 @@ sub keepOnlyLegalModes { sub cardConfigurationAuto() { my $card; - if (my ($c) = pci_probing::main::probe('video')) { + if (my ($c) = pci_probing::main::probe("DISPLAY")) { local $_; ($card->{identifier}, $_) = @$c; $card->{type} = $1 if /Card:(.*)/; @@ -482,11 +482,11 @@ sub write_XF86Config { # Write pointer section. $O = $o->{mouse}; print F $pointersection_text1; - print F qq( Protocol "$O->{xtype}"\n); + print F qq( Protocol "$O->{XMOUSETYPE}"\n); print F qq( Device "$O->{device}"\n); # this will enable the "wheel" or "knob" functionality if the mouse supports it print F " ZAxisMapping 4 5\n" if - member($O->{xtype}, qw(IntelliMouse IMPS/2 ThinkingMousePS/2 NetScrollPS/2 NetMousePS/2 MouseManPlusPS/2)); + member($O->{XMOUSETYPE}, qw(IntelliMouse IMPS/2 ThinkingMousePS/2 NetScrollPS/2 NetMousePS/2 MouseManPlusPS/2)); print F $pointersection_text2; print F "#" unless $O->{emulate3buttons}; @@ -609,7 +609,7 @@ sub show_info { my $info; $info .= _("Keyboard layout: %s\n", $o->{keyboard}{xkb_keymap}); - $info .= _("Mouse type: %s\n", $o->{mouse}{xtype}); + $info .= _("Mouse type: %s\n", $o->{mouse}{XMOUSETYPE}); $info .= _("Mouse device: %s\n", $o->{mouse}{device}) if $::expert; $info .= _("Monitor: %s\n", $o->{monitor}{type}); $info .= _("Monitor HorizSync: %s\n", $o->{monitor}{hsyncrange}) if $::expert; diff --git a/perl-install/common.pm b/perl-install/common.pm index 4578b61c9..4e5dccf9c 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -240,6 +240,8 @@ sub getVarsFromSh($) { sub setVarsInSh { my ($file, $l, @fields) = @_; + @fields = keys %$l unless @fields; + local *F; open F, "> $_[0]" or die "cannot create config file $file"; $l->{$_} and print F "$_=$l->{$_}\n" foreach @fields; diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 860ab4ebd..4c7cbc469 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -143,11 +143,13 @@ sub mount_part($;$) { my ($part, $prefix) = @_; $part->{isMounted} and return; - $part->{mntpoint} or die "missing mount point"; - isSwap($part) ? - swap::swapon($part->{device}) : + if (isSwap($part)) { + swap::swapon($part->{device}); + } else { + $part->{mntpoint} or die "missing mount point"; mount(devices::make($part->{device}), ($prefix || '') . $part->{mntpoint}, type2fs($part->{type}), 0); + } $part->{isMounted} = $part->{isFormatted} = 1; # assume that if mount works, partition is formatted } @@ -169,7 +171,7 @@ sub mount_all($;$) { # order mount by alphabetical ordre, that way / < /home < /home/httpd... foreach (sort { $a->{mntpoint} cmp $b->{mntpoint} } @$fstab) { - $_->{mntpoint} and mount_part($_, $prefix); + mount_part($_, $prefix) if ($_->{mntpoint} || isSwap($_)); } } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index f76e27a67..a7ba19a76 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -51,6 +51,17 @@ partitionDisks => is not hardly if you be carrefull so that you do. Also, take your time, are sure you before click on \"Finishing\" and READ the handbook of DiskDrake before use them."), + +#"In this stage, you must partition your hard disk. Partitioning is the +#division of space on the hard disk into zones (which need not be equal) and +#certain types of software are installed in certain partitions. This +#operation, while both spectacular and intimidating, is not difficult to do +#if you understand what your system needs and what you need to do in the +#process. If you are uncertain, read the DiskDrake handbook and the +#Partitioning HOWTO before you proceed. Be cautious during this step. If you +#make an error, consult the DiskDrake handbook as to how to go about +#correcting it." + formatPartitions => __("The partitions lately created must be formatted so that the system can use them. You can also format partitions before created and used if you wish to remove all the data which @@ -108,13 +119,13 @@ my @installSteps = ( 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 ], + configureMouse => [ __("Configure mouse"), 1, 1, "formatPartitions" ], configureNetwork => [ __("Configure networking"), 1, 1, "formatPartitions" ], # configureTimezone => [ __("Configure timezone"), 0, 0 ], # configureServices => [ __("Configure services"), 0, 0 ], # configurePrinter => [ __("Configure printer"), 0, 0 ], - setRootPassword => [ __("Set root password"), 1, 0, "formatPartitions" ], - addUser => [ __("Add a user"), 1, 0, "formatPartitions" ], + setRootPassword => [ __("Set root password"), 1, 1, "formatPartitions" ], + addUser => [ __("Add a user"), 1, 1, "formatPartitions" ], createBootdisk => [ __("Create bootdisk"), 1, 0, "doInstallStep" ], setupBootloader => [ __("Install bootloader"), 1, 1, "doInstallStep" ], configureX => [ __("Configure X"), 1, 0, "doInstallStep" ], @@ -168,7 +179,7 @@ $o = $::o = { # isUpgrade => 0, # installClass => 'beginner', - intf => [ { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } ], +# intf => [ { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } ], default => $default, steps => \%installSteps, orderedSteps => \@orderedInstallSteps, @@ -249,26 +260,17 @@ sub formatPartitions { fs::mount_all([ grep { isExt2($_) || isSwap($_) } @{$o->{fstab}} ], $o->{prefix}); } 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); + home mnt tmp var var/tmp var/lib var/lib/rpm); #) } sub choosePackages { - if ($o->{steps}{$o->{step}}{entered} == 1) { - $o->{packages} = pkgs::psUsingDirectory(); - pkgs::getDeps($o->{packages}); - - $o->{compss} = pkgs::readCompss($o->{packages}); - push @{$o->{base}}, "kernel-smp" if smp::detect(); - - foreach (@{$o->{base}}) { $o->{packages}{$_}{base} = 1 } - - pkgs::setCompssSelected($o->{compss}, $o->{packages}, $o->{installClass}); - } + install_any::setPackages($o) if $o->{steps}{$o->{step}}{entered} == 1; $o->choosePackages($o->{packages}, $o->{compss}); - foreach (@{$o->{base}}) { $o->{packages}{$_}{selected} = 1 } + $o->{packages}{$_}{base} = 1 foreach @{$o->{base}}; } sub doInstallStep { + install_any::setPackages($o) unless $o->{steps}{choosePackages}{entered}; $o->beforeInstallPackages; $o->installPackages($o->{packages}); $o->afterInstallPackages; @@ -325,14 +327,15 @@ sub main { eval { spawnShell() }; # needed very early for install_steps_graphical - $o->{mouse} = install_any::mouse_detect() unless $::testing; + $o->{mouse} = install_any::mouse_detect() unless $::testing || $o->{mouse}; $o = install_steps_graphical->new($o); $o->{netc} = network::read_conf("/tmp/network"); if (my ($file) = glob_('/tmp/ifcfg-*')) { log::l("found network config file $file"); - push @{$o->{intf}}, network::read_interface_conf($file); + my $l = network::read_interface_conf($file); + add2hash(network::findIntf($o->{intf} ||= [], $l->{DEVICE}), $l); } modules::load_deps("/modules/modules.dep"); diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 58fde0abd..48b0d0863 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -11,11 +11,13 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK); @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; use common qw(:common :system); +use pkgs; +use smp; use log; 1; -sub fileInBase { member($_[0], qw(compss depslist)); } +sub fileInBase { member($_[0], qw(compss depslist hdlist)); } sub imageGetFile { fileInBase($_[0]) and return "/tmp/rhimage/Mandrake/base/$_[0]"; @@ -71,15 +73,29 @@ sub spawnShell { sub mouse_detect() { my %l; - @l{qw(type xtype device)} = split("\n", `mouseconfig --nointeractive 2>/dev/null`) or die "mouseconfig failed"; + @l{qw(MOUSETYPE XMOUSETYPE DEVICE)} = split("\n", `mouseconfig --nointeractive 2>/dev/null`) or die "mouseconfig failed"; \%l; } sub shells($) { my ($o) = @_; my @l = grep { -x "$o->{prefix}$_" } @{$o->{default}{shells}}; - @l or die "no shell available"; - @l; + @l ? @l : "/bin/bash"; +} + +sub setPackages { + my ($o) = @_; + + eval { $o->{packages} = pkgs::psUsingHdlist() }; + $@ and $o->{packages} = pkgs::psUsingDirectory(); + pkgs::getDeps($o->{packages}); + + $o->{compss} = pkgs::readCompss($o->{packages}); + push @{$o->{base}}, "kernel-smp" if smp::detect(); + + $o->{packages}{$_}{base} = 1 foreach @{$o->{base}}; + + pkgs::setCompssSelected($o->{compss}, $o->{packages}, $o->{installClass}); } sub addToBeDone(&$) { diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index af02ae1d6..8dac8db20 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -144,7 +144,9 @@ sub afterInstallPackages($) { } sub mouseConfig($) { - #TODO + my ($o) = @_; + setVarsInSh("$o->{prefix}/etc/sysconfig/mouse", $o->{mouse}); + symlink $o->{mouse}{DEVICE}, "$o->{prefix}/dev/mouse" or log::l("creating /dev/mouse symlink failed"); } sub configureNetwork($) { diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 1ad5d3e2a..96f2712f0 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -126,12 +126,7 @@ sub configureNetwork($) { my @l = first(network::getNet()); @l = ($l[0]) unless $::expert; # keep only one - foreach my $dev (@l) { - my ($l) = grep { $_->{DEVICE} eq $dev } @{$o->{intf}}; - - push @{$o->{intf}}, $l = { DEVICE => $dev } unless $l; - $o->configureNetworkIntf($l); - } + $o->configureNetworkIntf(network::findIntf($o->{intf}, $_)) foreach @l; $o->configureNetworkNet($o->{netc} ||= {}); } $o->SUPER::configureNetwork; diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 887bc3e0f..55cf17094 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -59,14 +59,14 @@ sub destroy($) { sub DESTROY { goto &destroy } sub sync($) { my ($o) = @_; - $o->show; + show($o); my $h = Gtk->idle_add(sub { Gtk->main_quit; 1 }); map { Gtk->main } (1..4); Gtk->idle_remove($h); } sub flush(;$) { - Gtk->main_iteration while Gtk::Gdk->events_pending; + Gtk->main_iteration while Gtk->events_pending; } sub bigsize($) { $_[0]{rwindow}->set_usize(600,400); diff --git a/perl-install/network.pm b/perl-install/network.pm index bce10e35a..7dd3f9349 100644 --- a/perl-install/network.pm +++ b/perl-install/network.pm @@ -137,3 +137,9 @@ sub getNet() { @l; } +sub findIntf { + my ($intf, $device) = @_; + my ($l) = grep { $_->{DEVICE} eq $device } @$intf; + push @$intf, $l = { DEVICE => $device } unless $l; + $l; +} diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index d10713c5b..e377cf361 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -8,6 +8,7 @@ use common qw(:common :file); use install_any; use log; use smp; +use pkgs; use fs; use lang; @@ -85,11 +86,10 @@ sub set($$$) { $val ? &select($packages, $p) : unselect($packages, $p); } -sub psUsingDirectory(;$) { - my ($dirname) = @_; +sub psUsingDirectory() { + my $dirname = install_any::imageGetFile(''); my %packages; - $dirname ||= install_any::imageGetFile(''); log::l("scanning $dirname for packages"); foreach (all("$dirname")) { my ($name, $version, $release) = /(.*)-([^-]+)-([^-.]+)\.[^.]+\.rpm/ or log::l("skipping $_"), next; @@ -102,6 +102,31 @@ sub psUsingDirectory(;$) { \%packages; } +sub psUsingHdlist() { + my $file = install_any::imageGetFile('hdlist'); + my ($noSeek, $end, %packages) = 0; + + local *F; + sysopen F, $file, 0 or die "error opening header file $file: $!"; + + $end = sysseek F, 0, 2 or die "seek failed"; + sysseek F, 0, 0 or die "seek failed"; + + while (sysseek(F, 0, 1) < $end) { + my $header = c::headerRead(fileno F, 1) or die "error reading header at offset ", sysseek(F, 0, 1); + + my $name = c::headerGetEntry($header, 'name'); + + $packages{$name} = { + name => $name, version => c::headerGetEntry($header, 'version'), release => c::headerGetEntry($header, 'release'), + header => $header, selected => 0, deps => [], + }; + } + log::l("psUsingHdlist read " . scalar keys(%packages) . " headers"); + + \%packages; +} + sub chop_version($) { first($_[0] =~ /(.*)-[^-]+-[^-.]+/) || $_[0]; } @@ -172,34 +197,6 @@ sub setCompssSelected($$$) { } } -sub addHdlistInfos { - my ($fd, $noSeek) = @_; - my %packages; - my $end; - my $file; - local *F; - sysopen F, $file, 0 or die "error opening header file $file: $!"; - - $end = sysseek $fd, 0, 2 or die "seek failed"; - sysseek $fd, 0, 0 or die "seek failed"; - - while (sysseek($fd, 0, 1) <= $end) { - my $header = c::headerRead(fileno($fd), 1); - unless ($header) { - $noSeek and last; - die "error reading header at offset ", sysseek($fd, 0, 1); - } - - c::headerGetEntry($header, 'name'); - - $noSeek or $end <= sysseek($fd, 0, 1) and last; - } - - log::l("psFromHeaderListDesc read " . scalar keys(%packages) . " headers"); - - \%packages; -} - sub init_db { my ($prefix, $isUpgrade) = @_; @@ -241,6 +238,11 @@ sub install { foreach my $p (@$toInstall) { $p->{installed} = 1; + $p->{file} ||= install_any::imageGetFile(sprintf "%s-%s-%s.%s.rpm", + $p->{name}, + $p->{version}, + $p->{release}, + c::headerGetEntry(getHeader($p), 'arch')); c::rpmtransAddPackage($trans, getHeader($p), $p->{file}, $isUpgrade); $nb++; $total += $p->{size}; diff --git a/perl-install/share/list b/perl-install/share/list index 3ab0eed94..14ed9111f 100644 --- a/perl-install/share/list +++ b/perl-install/share/list @@ -2,6 +2,7 @@ /bin/cpio /sbin/insmod /sbin/mke2fs +/sbin/mkdosfs /usr/bin/bzip2 /usr/lib/rpm/rpmrc /usr/X11R6/bin/xmodmap -- cgit v1.2.1