From fe224251aa0fe2285b7b1eda762e5b18ddee07a0 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 6 Oct 1999 17:52:58 +0000 Subject: *** empty log message *** --- perl-install/Makefile | 2 ++ perl-install/Xconfig.pm | 3 +- perl-install/install2.pm | 13 ++++++-- perl-install/install_any.pm | 10 ++++--- perl-install/install_steps.pm | 28 ++++++++++++++++- perl-install/install_steps_interactive.pm | 7 +++-- perl-install/modules.pm | 28 +++++++++++++---- perl-install/pkgs.pm | 50 ++++++++++++++++++------------- perl-install/share/list | 1 + 9 files changed, 106 insertions(+), 36 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Makefile b/perl-install/Makefile index f764a05be..1f1db5421 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -160,6 +160,8 @@ get_needed_files: $(SO_FILES) # echo -e "#!/bin/sh\n\nexec '/usr/bin/sh'" > $(DEST)/usr/bin/runinstall2 # chmod a+x $(DEST)/usr/bin/runinstall2 + cp -a ../install/install1_pcmcia/etc/pcmcia $(DEST)/etc + as_root: /bin/dd if=/dev/zero of=/tmp/initrd bs=1k count=4000 echo y | /sbin/mke2fs /tmp/initrd diff --git a/perl-install/Xconfig.pm b/perl-install/Xconfig.pm index 6158873df..f44a9ad21 100644 --- a/perl-install/Xconfig.pm +++ b/perl-install/Xconfig.pm @@ -71,10 +71,11 @@ sub getinfoFromXF86Config { $o->{monitor}{vsyncrange} ||= $1 if /^\s*VertRefresh\s+(.*)/; $o->{monitor}{vendor} ||= $1 if /^\s*VendorName\s+"(.*?)"/; $o->{monitor}{model} ||= $1 if /^\s*ModelName\s+"(.*?)"/; + $o->{monitor}{modelines} .= $_ if /^\s*Mode[lL]ine\s+/; } elsif (my $s = /^Section "Screen"/ .. /^EndSection/) { $driver = undef if $s == 1; $driver = $1 if /^\s*Driver\s+"(.*?)"/; - print "($driver eq $Xconfigurator::serversdriver{$o->{card}{server}})"; + #- print "($driver eq $Xconfigurator::serversdriver{$o->{card}{server}})"; if ($driver eq $Xconfigurator::serversdriver{$o->{card}{server}}) { #- take into account the right screen section for the server. $o->{card}{default_depth} ||= $1 if /^\s*DefaultColorDepth\s+(\d+)/; if (my $i = /^\s*Subsection\s+"Display"/ .. /^\s*EndSubsection/) { diff --git a/perl-install/install2.pm b/perl-install/install2.pm index d19240f9c..f50f289a5 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -75,6 +75,7 @@ $installSteps{first} = $installSteps[0]; #-##################################################################################### #-INTERN CONSTANT #-##################################################################################### + #- these strings are used in quite a lot of places and must not be changed!!!!! my @install_classes = (__("beginner"), __("developer"), __("server"), __("expert")); @@ -412,6 +413,8 @@ sub choosePackages { #------------------------------------------------------------------------------ sub doInstallStep { + $o->readBootloaderConfigBeforeInstall if $_[1] == 1; + $o->beforeInstallPackages; $o->installPackages($o->{packages}); $o->afterInstallPackages; @@ -423,8 +426,8 @@ sub configureNetwork { if ($o->{isUpgrade} && !$clicked) { $o->{netc} or $o->{netc} = {}; - add2hash($o->{netc}, { network::read_conf("$o->{prefix}/etc/sysconfig/network") }); - add2hash($o->{netc}, { network::read_resolv_conf("$o->{prefix}/etc/resolv.conf") }); + add2hash($o->{netc}, { network::read_conf("$o->{prefix}/etc/sysconfig/network") }) if -r "$o->{prefix}/etc/sysconfig/network";; + add2hash($o->{netc}, { network::read_resolv_conf("$o->{prefix}/etc/resolv.conf") }) if -r "$o->{prefix}/etc/resolv.conf"; foreach (all("$o->{prefix}/etc/sysconfig/network-scripts")) { if (/ifcfg-(\w*)/) { push @{$o->{intf}}, { network::read_conf("$o->{prefix}/etc/sysconfig/network-scripts/$_") }; @@ -518,7 +521,13 @@ sub main { #- if this fails, it's okay -- it might help with free space though unlink "/sbin/install" unless $::testing; + unlink "/sbin/cardmgr" unless $::testing; unlink "/sbin/insmod" unless $::testing; + unlink "/sbin/rmmod" unless $::testing; + unlink "/modules/pcmcia_core.o" unless $::testing; + unlink "/modules/i82365.o" unless $::testing; + unlink "/modules/tcic.o" unless $::testing; + unlink "/modules/ds.o" unless $::testing; print STDERR "in second stage install\n"; log::openLog(($::testing || $o->{localInstall}) && 'debug.log'); diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 56e5be526..c77448218 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -99,8 +99,8 @@ sub getAvailableSpace { do { $_->{mntpoint} eq '/' and return $_->{size} * 512 } foreach @{$o->{fstab}}; if ($::testing) { - log::l("taking 2000MB for testing"); - return 2000 << 20; + log::l("taking 200MB for testing"); + return 200 << 20; } die "missing root partition"; } @@ -124,6 +124,8 @@ sub setPackages($$) { push @{$o->{base}}, "kernel-pcmcia-cs" if $o->{pcmcia}; } + #- this will be done if necessary in the selectPackagesToUpgrade, + #- move the selection here ? this will remove the little window. unless ($o->{isUpgrade}) { do { my $p = $o->{packages}{$_} or log::l("missing base package $_"), next; @@ -138,7 +140,7 @@ sub setPackages($$) { sub selectPackagesToUpgrade($) { my ($o) = @_; - pkgs::selectPackagesToUpgrade($o->{packages}, $o->{prefix}); + pkgs::selectPackagesToUpgrade($o->{packages}, $o->{prefix}, $o->{base}); } sub addToBeDone(&$) { @@ -149,7 +151,7 @@ sub addToBeDone(&$) { push @{$::o->{steps}{$step}{toBeDone}}, $f; } -sub install_cpio { +sub install_cpio($$) { my ($dir, $name) = @_; return "$dir/$name" if -e "$dir/$name"; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 26bb636af..37667a202 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -285,9 +285,35 @@ sub createBootdisk($) { } #------------------------------------------------------------------------------ -sub setupBootloaderBefore { +sub readBootloaderConfigBeforeInstall { my ($o) = @_; + my ($image, $v); add2hash($o->{bootloader} ||= {}, lilo::read($o->{prefix}, "/etc/lilo.conf")); + + #- since kernel or kernel-smp may not be upgraded, it should be checked + #- if there is a need to update existing lilo.conf entries by using that + #- hash. + my %ofpkgs = ( + 'vmlinuz' => 'kernel', + 'vmlinuz-smp' => 'kernel-smp', + ); + + #- change the /boot/vmlinuz or /boot/vmlinuz-smp entries to follow symlink. + foreach $image (keys %ofpkgs) { + if ($o->{bootloader}{entries}{"/boot/$image"} && $o->{packages}{$ofpkgs{$image}}{selected}) { + $v = readlink "$o->{prefix}/boot/$image"; + if ($v) { + $v = "/boot/$v" if $v !~ m@/@; + $o->{bootloader}{entries}{$v} = $o->{bootloader}{entries}{"/boot/$image"}; + delete $o->{bootloader}{entries}{"/boot/$image"}; + log::l("renaming /boot/$image entry by $v"); + } + } + } +} + +sub setupBootloaderBefore { + my ($o) = @_; lilo::suggest($o->{prefix}, $o->{bootloader}, $o->{hds}, $o->{fstab}, install_any::kernelVersion()); $o->{bootloader}{keytable} ||= keyboard::kmap($o->{keyboard}); } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 41052c851..03899cb83 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -82,7 +82,7 @@ sub selectRootPartition($@) { $o->{upgradeRootPartition} = $o->ask_from_list_(_("Root Partition"), _("What is the root partition (/) of your system?"), - [ @partitions ], $o->{upgradeRootPartitions}); + [ @partitions ]); #- TODO check choice, then mount partition in $o->{prefix} and autodetect. #- install_steps::selectRootPartition($o); } @@ -552,6 +552,7 @@ sub setupBootloaderBefore { $o->SUPER::setupBootloaderBefore($o); } +#------------------------------------------------------------------------------ sub setupBootloader { my ($o, $more) = @_; my $b = $o->{bootloader}; @@ -725,13 +726,13 @@ Do you want to try again with other parameters?", $l), 1) or return; #------------------------------------------------------------------------------ sub load_thiskind { my ($o, $type) = @_; - my $w; + my ($pcmcia, $w) = $o->{pcmcia} unless $::expert && modules::pcmcia_need_config($o->{pcmcia}) && $o->ask_yesorno('', _("Skip PCMCIA probing", 1)); modules::load_thiskind($type, sub { $w = $o->wait_message('', [ _("Installing driver for %s card %s", $type, $_->[0]), $::beginner ? () : _("(module %s)", $_->[1]) ]); - }); + }, $pcmcia); } #------------------------------------------------------------------------------ diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 0b53dfa7a..60ca503b2 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -268,13 +268,13 @@ sub get_stage1_conf { \%conf; } -sub load_thiskind($;&) { - my ($type, $f) = @_; +sub load_thiskind($;&$) { + my ($type, $f, $pcic) = @_; my @pcidevs = pci_probing::main::probe($type); log::l("pci probe found " . scalar @pcidevs . " $type devices"); - my @pcmciadevs = get_pcmcia_devices($type); + my @pcmciadevs = get_pcmcia_devices($type, $pcic); log::l("pcmcia probe found " . scalar @pcmciadevs . " $type devices"); my @devs = (@pcidevs, @pcmciadevs); @@ -290,10 +290,28 @@ sub load_thiskind($;&) { @devs; } -sub get_pcmcia_devices($) { - my ($type) = @_; +sub pcmcia_need_config($) { + return $_[0] && ! -s "/var/run/stab"; +} + +sub get_pcmcia_devices($$) { + my ($type, $pcic) = @_; my (@devs, $module, $desc); + #- try to setup pcmcia if cardmgr is not running. + if (pcmcia_need_config($pcic)) { + log::l("i try to configure pcmcia services"); + + symlink("/tmp/rhimage/etc/pcmcia", "/etc/pcmcia") unless -e "/etc/pcmcia"; + + load("pcmcia_core"); + load($pcic); + load("ds"); + + #- run cardmgr in foreground while it is configuring the card. + run_program::run("cardmgr", "-f", "-m" ,"/modules"); + } + foreach (cat_("/var/run/stab")) { $desc = $1 if /^Socket\s+\d+:\s+(.*)/; $module = $1 if /^\d+\s+$type[^\s]*\s+([^\s]+)/; diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index bc873e86c..8570e2e07 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -292,8 +292,8 @@ sub getHeader($) { $p->{header}; } -sub selectPackagesToUpgrade($$) { - my ($packages, $prefix) = @_; +sub selectPackagesToUpgrade($$$) { + my ($packages, $prefix, $base) = @_; log::l("reading /usr/lib/rpm/rpmrc"); c::rpmReadConfigFiles() or die "can't read rpm config files"; @@ -304,11 +304,13 @@ sub selectPackagesToUpgrade($$) { #- mark all files which are not in /etc/rc.d/ for packages which are already installed but which #- are not in the packages list to upgrade. + #- the 'installed' property will make a package unable to be selected, look at select. c::rpmdbTraverse($db, sub { my ($header) = @_; my $p = $packages->{c::headerGetEntry($header, 'name')}; if ($p) { - $p->{installed} = 1 if c::headerGetEntry($header, 'version') ge $p->{version}; + eval { getHeader($p) }; $@ && log::l("cannot get the header for package $p->{name}"); #- not having a header will cause using a bad test for version, should change but a header should always be available. + $p->{installed} = 1 if $p->{header} ? c::rpmVersionCompare($header, $p->{header}) >= 0 : c::headerGetEntry($header, 'version') ge $p->{version}; } else { my @installedFiles = c::headerGetEntry($header, 'filenames'); @installedFilesForUpgrade{grep { $_ !~ m@^/etc/rc.d/@ } @installedFiles} = (); @@ -319,13 +321,18 @@ sub selectPackagesToUpgrade($$) { foreach (values %$packages) { my $p = $_; my $skipThis = 0; - $skipThis ||= 1 if c::rpmdbNameTraverse($db, $p->{name}, sub { - my ($header) = @_; - $skipThis ||= (c::headerGetEntry($header, 'version') ge $p->{version}); - }) == 0; #- skip if not installed (package not found in current install). + my $count = c::rpmdbNameTraverse($db, $p->{name}, sub { + my ($header) = @_; + $skipThis ||= $p->{installed}; + }); + + #- skip if not installed (package not found in current install). + $skipThis ||= ($count == 0); #- select the package if it is already installed with a lower version or simply not installed. unless ($skipThis) { + my $cumulSize; + pkgs::select($packages, $p) unless $p->{selected}; #- keep in mind installed files which are not being updated. doing this costs in @@ -333,11 +340,17 @@ sub selectPackagesToUpgrade($$) { #- all file for package marked for upgrade. c::rpmdbNameTraverse($db, $p->{name}, sub { my ($header) = @_; + $cumulSize += c::headerGetEntry($header, 'size'); #- all these will be deleted on upgrade. my @installedFiles = c::headerGetEntry($header, 'filenames'); @installedFilesForUpgrade{ grep { $_ !~ m@^/etc/rc.d/@ } @installedFiles} = (); }); + eval { getHeader($p) }; my @availFiles = $p->{header} ? c::headerGetEntry($p->{header}, 'filenames') : (); map { delete $installedFilesForUpgrade{$_} } grep { $_ !~ m@^/etc/rc.d/@ } @availFiles; + + #- keep in mind the cumul size of installed package since they will be deleted + #- on upgrade. + $p->{installedCumulSize} = $cumulSize; } } @@ -347,6 +360,7 @@ sub selectPackagesToUpgrade($$) { my $p = $_; if ($p->{selected}) { + eval { getHeader($p) }; my @availFiles = $p->{header} ? c::headerGetEntry($p->{header}, 'filenames') : (); map { delete $installedFilesForUpgrade{$_} } grep { $_ !~ m@^/etc/rc.d/@ } @availFiles; } @@ -357,6 +371,7 @@ sub selectPackagesToUpgrade($$) { my $p = $_; unless ($p->{selected}) { + eval { getHeader($p) }; my @availFiles = $p->{header} ? c::headerGetEntry($p->{header}, 'filenames') : (); my $toSelect = 0; map { if (exists $installedFilesForUpgrade{$_}) { @@ -370,22 +385,16 @@ sub selectPackagesToUpgrade($$) { foreach (values %$packages) { my $p = $_; - my @obsoletes = $p->{header} ? c::headerGetEntry($p->{header}, 'obsoletes') : (); + eval { getHeader($p) }; + my @obsoletes = $p->{header} ? c::headerGetEntry(getHeader($p), 'obsoletes'): (); map { pkgs::select($packages, $p) if c::rpmdbNameTraverse($db, $_) > 0 } @obsoletes; } - #- consistency check: deselect all packages with a version lower to already existing. - foreach (values %$packages) { - my $p = $_; - my $skipThis = 0; - if ($p->{selected}) { - c::rpmdbNameTraverse($db, $p->{name}, sub { - my ($header) = @_; - $skipThis ||= (c::headerGetEntry($header, 'version') ge $p->{version}); - }); - #- unselect the package if it is already installed with a greater or equal version. - pkgs::unselect($packages, $p) if ($skipThis); - } + #- select all base packages which are not installed and not selected. + foreach (@$base) { + my $p = $packages->{$_} or log::l("missing base package $_"), next; + log::l("base package $_ is not installed") unless $p->{installed} || $p->{selected}; #- installed not set on upgrade. + pkgs::select($packages, $p, 1) unless $p->{selected}; #- if installed it cannot be selected. } #- close db, job finished ! @@ -412,6 +421,7 @@ sub install($$) { $p->{name}, $p->{version}, $p->{release}, c::headerGetEntry(getHeader($p), 'arch'); c::rpmtransAddPackage($trans, getHeader($p), $p->{file}, $p->{name} !~ /kernel/); #- TODO: replace `named kernel' by `provides kernel' +# c::rpmtransAddPackage($trans, getHeader($p), $p->{file}, 1); #- TODO: replace `named kernel' by `provides kernel' $nb++; $total += $p->{size}; } diff --git a/perl-install/share/list b/perl-install/share/list index d8e3d7d58..57bf1526d 100644 --- a/perl-install/share/list +++ b/perl-install/share/list @@ -6,6 +6,7 @@ /lib/libresolv.so.2 /etc/protocols /sbin/insmod +/sbin/rmmod /sbin/mkdosfs /sbin/mke2fs /usr/bin/bzip2 -- cgit v1.2.1