From 5fe426f2d1024c2a73791ffdafc2404bfccb8736 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Sun, 7 Nov 1999 19:14:26 +0000 Subject: *** empty log message *** --- perl-install/Makefile | 15 +++++++---- perl-install/commands.pm | 66 +++++++++++++++++++++++++++++++++++++++++++-- perl-install/install_any.pm | 33 ++++++++++++++--------- 3 files changed, 95 insertions(+), 19 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Makefile b/perl-install/Makefile index a6cae4b8e..532956cfc 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -11,7 +11,7 @@ BASE = $(ROOTDEST)/Mandrake/base DESTREP4PMS = $(DEST)$(REP4PMS) STAGE2TMP = /tmp/stage2_tmp PERL = perl -LOCALFILES = pnp_serial mouseconfig ddcxinfos +LOCALFILES = pnp_serial mouseconfig ddcxinfos extract_archive DIRS = c po pci_probing resize_fat EXCLUDE = $(LOCALFILES) boot.img keymaps consolefonts install RPMS = $(wildcard $(ROOTDEST)/Mandrake/RPMS/*.rpm) @@ -105,7 +105,7 @@ get_needed_files: $(DIRS) install -d $(DEST)/usr/share/gtk install -d $(DEST)/usr/share/xmodmap install -d $(ROOTDEST)/Mandrake/base - install -s $(LOCALFILES) $(DEST)/usr/bin + cp -af $(LOCALFILES) $(DEST)/usr/bin for i in `cat /tmp/list`; do \ if (echo $$i | grep -q "lib/[^/]*\.so"); then \ @@ -143,9 +143,14 @@ get_needed_files: $(DIRS) cp -a themes $(DEST)/usr/share/gtk cp compss compssUsers compssList $(ROOTDEST)/Mandrake/base - cp -f ../modules/modules.cpio.bz2 $(DEST)/lib/ - install -d $(DEST)/lib/modules - cp -f ../modules/pristine/* $(DEST)/lib/modules + if [ -f "../modules/modules.cz2" ]; then \ + cp -f ../modules/modules.cz2 $(DEST)/lib/; \ + cp -f ../modules/modules.cz2.pl $(DEST)/lib/; \ + else \ + cp -f ../modules/modules.cpio.bz2 $(DEST)/lib/; \ + install -d $(DEST)/lib/modules; \ + cp -f ../modules/pristine/* $(DEST)/lib/modules; \ + fi ln -s install2 $(DEST)/usr/bin/runinstall2 # echo -e "#!/bin/sh\n\nexec '/usr/bin/sh'" > $(DEST)/usr/bin/runinstall2 diff --git a/perl-install/commands.pm b/perl-install/commands.pm index f4ed2d870..34653ba74 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -14,7 +14,6 @@ use common qw(:common :file :system :constant); #-##################################################################################### my $BUFFER_SIZE = 1024; - #-###################################################################################### #- Functions #-###################################################################################### @@ -403,7 +402,13 @@ sub insmod { $_ = $1 if m@.*/([^/]*)\.o@; unless (-r ($f = "/lib/modules/$_.o")) { $f = "/tmp/$_.o"; - run_program::run("cd /tmp ; bzip2 -cd /lib/modules.cpio.bz2 | cpio -i $_.o"); + if (-e "/lib/modules.cz2") { + run_program::run("extract_archive /lib/modules /tmp $_.o"); + } elsif (-e "/lib/modules.cpio.bz2") { + run_program::run("cd /tmp ; bzip2 -cd /lib/modules.cpio.bz2 | cpio -i $_.o"); + } else { + die "unable to find an archive for modules"; + } } } -r $f or die "can't find module $_"; @@ -512,6 +517,63 @@ sub install_cpio($$) { $cached_failed_install_cpio{"$dir $name"} = 1; } +sub catsksz($$$$) { + my ($input, $seek, $siz, $output) = @_; + my ($buf, $sz); + + while (($sz = sysread($input, $buf, $seek > 4096 ? 4096 : $seek))) { + $seek -= $sz; + last unless $seek > 0; + } + while (($sz = sysread($input, $buf, $siz > 4096 ? 4096 : $siz))) { + $siz -= $sz; + syswrite($output, $buf); + last unless $siz > 0; + } +} + +sub extract_from_archive($$$) { + my ($archive, $dir, $file) = @_; + + require 'log.pm'; + + log::l("data=$archive->{data}"); + unless (-r $archive->{archive}) { + log::l($_) foreach keys %{$archive}; + log::l("unable to access archive $archive->{archive} from $archive"); + return; + } + unless ($archive->{data}) { + my %data; + + log::l("loading archive description file $archive->{data_file}"); + eval `cat $archive->{data_file}`; + $archive->{data} = { %data }; + } + my $data_of_file = $archive->{data}{$file}; + unless ($data_of_file) { + log::l("unable to find file $file in archive $archive->{archive}"); + return; + } + unless ($data_of_file->[0] >= 0 && $data_of_file->[1] > 0 && + $data_of_file->[2] >= 0 && $data_of_file->[3] > 0) { + log::l("bad entry of file $file in archive $archive->{archive}"); + return; + } + + local *OUTPUT; + if (open OUTPUT, "-|") { #- parent create file from child extraction from archive. + local *FILE; open FILE, ">$dir/$file"; + catsksz(\*OUTPUT, $data_of_file->[2], $data_of_file->[3], \*FILE); + } else { #- child execute bzip2 -d on its stdout which is OUTPUT. + local *BUNZIP2; open BUNZIP2, "| bzip2 -d >&STDOUT"; + local *ARCHIVE; open ARCHIVE, "<$archive->{archive}" or exec 'false'; + catsksz(\*ARCHIVE, $data_of_file->[0], $data_of_file->[1], \*BUNZIP2); + exec 'true'; + } + 1; +} + #-###################################################################################### #- Wonderful perl :( #-###################################################################################### diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index fa963c4d4..34540d103 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -345,21 +345,30 @@ sub setupFB { pkgs::select($o->{packages}, $o->{packages}{'XFree86-FBDev'}); $o->installPackages($o->{packages}); - #- update lilo entries with a new fb label. a bit hack. - my $root = $o->{bootloader}{entries}{'/boot/vmlinuz'}{root}; - if (lilo::add_kernel($o->{prefix}, $o->{bootloader}, kernelVersion(), 'fb', - { - label => 'linux-fb', - root => $root, - vga => $vga || 785, - })) { - $o->{bootloader}{default} = 'linux-fb'; + $vga ||= 785; #- assume at least 640x480x16. + + #- update lilo entries with a new fb label. a bit hack unless + #- a frame buffer kernel is used, in such case we use it instead + #- with the right mode, nothing more to do. + if ($o->{bootloader}{entries}{'/boot/vmlinuz-smp'}) { + $o->{bootloader}{entries}{'/boot/vmlinuz-smp'}{vga} = $vga; lilo::install($o->{prefix}, $o->{bootloader}); } else { - #- should deactivate X11 in such case. - #- TODO - die _("I can't access the kernel with frame buffer support.\nDisabling automatic X11 startup if any."); + my $root = $o->{bootloader}{entries}{'/boot/vmlinuz'}{root}; + if (lilo::add_kernel($o->{prefix}, $o->{bootloader}, kernelVersion(), 'fb', + { + label => 'linux-fb', + root => $root, + vga => $vga, + })) { + $o->{bootloader}{default} = 'linux-fb'; + lilo::install($o->{prefix}, $o->{bootloader}); + } else { + log::l("unable to install kernel with frame buffer support, disabling"); + return 0; + } } + 1; } sub auto_inst_file() { "$::o->{prefix}/root/auto_inst.cfg.pl" } -- cgit v1.2.1