diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/Makefile | 66 | ||||
-rw-r--r-- | perl-install/fs.pm | 2 | ||||
-rw-r--r-- | perl-install/install2.pm | 28 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 12 | ||||
-rw-r--r-- | perl-install/my_gtk.pm | 16 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 4 |
6 files changed, 77 insertions, 51 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile index 1e8321b0b..d05997e96 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -2,8 +2,8 @@ SO_FILES = c/blib/arch/auto/c/c.so PMS = *.pm c/*.pm resize_fat/*.pm commands diskdrake DEST = /tmp/t DESTREP4PMS = $(DEST)/usr/bin/perl-install -PERL = ./perl -BINS = /bin/ash /sbin/mke2fs $(PERL) +PERL = perl +LOCALFILES = $(PERL) mouseconfig fr.map .PHONY: all tags install clean verify_c @@ -18,7 +18,13 @@ clean: find . -name "*~" -o -name "TAGS" -o -name "*.old" | xargs rm -f tar: clean - cd .. ; tar cfy perl-install.tar.bz2 --exclude perl-install/perl perl-install + cd .. ; tar cfy perl-install.tar.bz2 $(LOCALFILES:%=--exclude %) perl-install + +tar-diskdrake: clean + cd .. ; cp -af perl-install diskdrake + + l=`perl2fcalls -uses -excludec diskdrake | sort | uniq | sed -e 's/::/\//' -e 's/^/diskdrake\//' -e 's/$$/.pm/'` ; \ + cd .. ; tar cfvy diskdrake.tar.bz2 diskdrake/diskdrake $$l c/c.xs: c/c.xs.pm rm -f $@ @@ -45,7 +51,7 @@ install_pms: $(SO_FILES) install -d $$dest; \ perl -ne 'print #unless /^use (diagnostics|vars|strict)/' $$i > $(DESTREP4PMS)/$$i; \ done - @# cp -f $$i $$dest; \ + cp diskdrake.rc $(DESTREP4PMS) ln -sf perl-install/install2.pm $(DEST)/usr/bin/install2 ln -sf perl-install/commands $(DEST)/usr/bin/commands @@ -55,39 +61,43 @@ install_pms: $(SO_FILES) cp -af */blib/arch/auto $(DESTREP4PMS) find $(DESTREP4PMS) -name "*.so" | xargs strip -full_tar: - cp -af /usr/lib/perl5/site_perl/5.005/i386-linux/Gtk* $(DESTREP4PMS) - cp -af /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Gtk $(DESTREP4PMS)/auto - find $(DESTREP4PMS) -name "*.so" | xargs strip - cd $(DESTREP4PMS)/.. ; tar cfz /tmp/perl-install.tgz perl-install - get_needed_files: $(SO_FILES) - export PERL_INSTALL_TEST=1 ; strace -f -e trace=file -o '| grep -v "(No such file or directory)" | sed -e "s/[^\"]*\"//" -e "s/\".*//" | grep "^/" | grep -v -e "^/tmp" -e "^/home" -e "^/proc" -e "^/var" -e "^/dev" -e "^/etc" -e "^/usr/lib/rpm" > /tmp/list ' $(PERL) -d install2.pm < /dev/null - perl -pi -e 's|/usr/local/|/usr/|' /tmp/list +# export PERL_INSTALL_TEST=1 ; strace -f -e trace=file -o '| grep -v "(No such file or directory)" | sed -e "s/[^\"]*\"//" -e "s/\".*//" | grep "^/" | grep -v -e "^/tmp" -e "^/home" -e "^/proc" -e "^/var" -e "^/dev" -e "^/etc" -e "^/usr/lib/rpm" > /tmp/list ' $(PERL) -d install2.pm < /dev/null + cp -f list /tmp/list + for i in $(LOCALFILES) `cat /tmp/list` ; do \ + ldd $$i 2>/dev/null | sed -e 's/.*=> //' -e 's/ .*//' | uniq | sort >> /tmp/list; \ + done + install -d $(DEST)/lib install -d $(DEST)/bin install -d $(DEST)/usr/bin - for i in $(BINS) `grep "\.so" /tmp/list`; do \ - install -s $$i $(DEST)/lib; \ - ldd $$i | sed -e 's/.*=> //' -e 's/ .*//' >> /tmp/list; \ - done - for i in `sort /tmp/list | uniq`; do \ - install -d $(DEST)/`dirname $$i` && \ - if (echo $$i | grep "\.pm"); then \ - perl -pe '$$_ eq "__END__" and exit(0);' $$i > $(DEST)/$$i; \ + install -s $(LOCALFILES) $(DEST)/usr/bin + + for i in `cat /tmp/list`; do \ + if (echo $$i | grep "lib/[^/]*\.so"); then \ + install -s $$i $(DEST)/lib; \ else \ - cp -f $$i $(DEST)/$$i; \ - fi && \ - strip $(DEST)/$$i 2>/dev/null || true; \ + d=`echo $(DEST)/$$i | sed -e 's/\/usr\/local\//\/usr\//' -e 's/\/sbin\//\/bin\//'`; \ + install -d `dirname $$d` && \ + if (echo $$i | grep "\.pm"); then \ + perl -pe '$$_ eq "__END__" and exit(0);' $$i > $$d; \ + else \ + cp -f $$i $$d; \ + strip $$d 2>/dev/null || true; \ + fi; \ + fi; \ done - mv $(DEST)/usr/lib/*.so* $(DEST)/lib - ln -sf ../usr/bin/sh $(DEST)/bin/sh ln -sf ../usr/bin/tr $(DEST)/bin/tr ln -sf sh $(DEST)/bin/bash - ln -sf ash $(DEST)/usr/bin/sh + ln -sf ash $(DEST)/bin/sh + ln -sf ../../bin/sh $(DEST)/usr/bin/sh + ln -sf ../../bin/mke2fs $(DEST)/usr/bin/mke2fs + + install -d $(DEST)/lib/fonts + cp -a /usr/lib/X11/fonts/misc $(DEST)/lib/fonts - echo -e "#!/usr/bin/perl\n\nsymlink '/tmp/rhimage/usr/lib/perl5', '/usr/lib/perl5';\nexec '/bin/sh'" > $(DEST)/usr/bin/runinstall2 + echo -e "#!/usr/bin/perl\n\nsymlink '/tmp/rhimage/usr/lib/perl5', '/usr/lib/perl5';\nexec '/usr/bin/sh'" > $(DEST)/usr/bin/runinstall2 chmod a+x $(DEST)/usr/bin/runinstall2 as_root: @@ -99,7 +109,7 @@ as_root: full_stage2: rm -rf $(DEST)/[^M]* - ln -sf .. $(DEST)/Mandrake/instimage + rm -f $(DEST)/Mandrake/instimage ; ln -s .. $(DEST)/Mandrake/instimage @#mkdir -p $(DEST)/Mandrake/base @#ln -s .. $(DEST)/Mandrake/instimage $(MAKE) get_needed_files diff --git a/perl-install/fs.pm b/perl-install/fs.pm index bf06934c2..18f6db4cb 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -68,7 +68,7 @@ sub format_ext2($;$) { run_program::run("mke2fs", devices::make($dev), @options) or die "ext2 formatting of $dev failed"; } -sub format_dos($;$) { +sub format_dos($;$@) { my ($dev, $bad_blocks, @options) = @_; run_program::run("mkdosfs", devices::make($dev), @options, $bad_blocks ? "-c" : ()) or die "dos formatting of $dev failed"; diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 4ca092c94..fc75182e5 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -19,6 +19,7 @@ use install_methods; use modules; use partition_table qw(:types); use detect_devices; +use smp; $testing = $ENV{PERL_INSTALL_TEST}; $INSTALL_VERSION = 0; @@ -93,7 +94,7 @@ my $default = { mkbootdisk => 0, comps => [ qw() ], packages => [ qw() ], - partitionning => { clearall => 0, eraseBadPartitions => 1, autoformat => 1 }, + partitionning => { clearall => 1, eraseBadPartitions => 1, autoformat => 1 }, partitions => [ { mntpoint => "/boot", size => 16 << 11, type => 0x83 }, { mntpoint => "/", size => 300 << 11, type => 0x83 }, @@ -143,16 +144,15 @@ sub partitionDisks { $o->{fstab} = [ fsedit::get_fstab(@{$o->{hds}}) ]; - my $root_fs; map { $_->{mntpoint} eq '/' and $root_fs = $_ } @{$o->{fstab}}; + my $root_fs; map { $_->{mntpoint} eq '/' and $root_fs = $_ } @{$o->{fstab}}; $root_fs or die "partitionning failed: no root filesystem"; + $o->choosePartitionsToFormat($o->{fstab}); + $testing and return; - if ($o->{default}->{partitionning}->{autoformat}) { - log::l("formatting all filesystems"); - foreach (@{$o->{fstab}}) { - fs::format_part($_) if $_->{mntpoint} && isExt2($_) || isSwap($_); - } + foreach (@{$o->{fstab}}) { + fs::format_part($_) if $_->{toFormat}; } fs::mount_all([ grep { isExt2($_) || isSwap($_) } @{$o->{fstab}} ], $o->{prefix}); } @@ -162,7 +162,10 @@ sub findInstallFiles { $o->{comps} = $o->{method}->getComponentSet($o->{packages}); } -sub choosePackages { $o->choosePackages($o->{packages}, $o->{comps}); } +sub choosePackages { + $o->choosePackages($o->{packages}, $o->{comps}); + smp::detect() and $o->{packages}->{"kernel-smp"}->{selected} = 1; +} sub doInstallStep { $o->beforeInstallPackages; @@ -198,12 +201,17 @@ sub main { # if this fails, it's okay -- it might help with free space though unlink "/sbin/install"; + symlink '/tmp/rhimage/usr/X11R6', '/usr/X11R6'; print STDERR "in second stage install\n"; log::openLog(($testing || $o->{localInstall}) && 'debug.log'); log::l("second stage install running (version $INSTALL_VERSION)"); log::ld("extra log messages are enabled"); + # make sure we don't pick up any gunk from the outside world + $ENV{PATH} = "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin:$o->{prefix}/sbin:$o->{prefix}/bin:$o->{prefix}/usr/sbin:$o->{prefix}/usr/bin:$o->{prefix}/usr/X11R6/bin"; + $ENV{LD_LIBRARY_PATH} = ""; + spawnSync(); eval { spawnShell() }; @@ -228,10 +236,6 @@ sub main { modules::load_deps("/modules/modules.dep"); modules::read_conf("/tmp/conf.modules"); - # make sure we don't pick up any gunk from the outside world - $ENV{PATH} = "/usr/bin:/bin:/sbin:/usr/sbin:$o->{prefix}/sbin:$o->{prefix}/bin:$o->{prefix}/usr/sbin:$o->{prefix}/usr/bin"; - $ENV{LD_LIBRARY_PATH} = ""; - $o->{keyboard} = eval { keyboard::read("/tmp/keyboard") } || $default->{keyboard}; selectPath(); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index fbfc6c12d..ad993b590 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -5,6 +5,7 @@ use strict; use common qw(:file :system); use install_any qw(:all); +use partition_table qw(:types); use run_program; use lilo; use lang; @@ -14,7 +15,6 @@ use cpio; use log; use fsedit; use commands; -use smp; my $o; @@ -46,6 +46,14 @@ sub doPartitionDisks($$) { my ($o, $hds) = @_; fsedit::auto_allocate($hds, $o->{default}->{partitions}); } +sub choosePartitionsToFormat($$) { + my ($o, $fstab) = @_; + + foreach (@$fstab) { + $_->{toFormat} = $_->{mntpoint} && (isExt2($_) || isSwap($_)) && + ($_->{notFormatted} || $o->{default}->{partitionning}->{autoformat}); + } +} sub choosePackages($$$) { my ($o, $packages, $comps) = @_; @@ -55,8 +63,6 @@ sub choosePackages($$$) { foreach (@{$comps->{$_}->{packages}}) { $_->{selected} = 1; } } foreach (@{$o->{default}->{packages}}) { $packages->{$_}->{selected} = 1; } - - smp::detect() and $packages->{"kernel-smp"}->{selected} = 1; } sub beforeInstallPackages($) { diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 8ab3054e7..99636cf21 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK); @ISA = qw(Exporter); %EXPORT_TAGS = ( - all => [ qw(ask_warn ask_okcancel ask_yesorno ask_from_entry ask_from_list create_okcancel createScrolledWindow create_menu create_notebook create_packtable create_hbox create_adjustment gtksignal_connect gtkpack gtkpack_ gtkappend gtkadd gtkset_usize gtkset_justify gtkshow gtkdestroy) ], + all => [ qw(ask_warn ask_okcancel ask_yesorno ask_from_entry ask_from_list create_okcancel createScrolledWindow create_menu create_notebook create_packtable create_hbox create_adjustment gtksignal_connect gtkpack gtkpack_ gtkappend gtkadd gtkset_usize gtkset_justify gtkset_active gtkshow gtkdestroy) ], ); @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; @@ -63,6 +63,7 @@ sub gtkshow($) { $_[0]->show; $_[0] } sub gtkdestroy($) { $_[0] and $_[0]->destroy } sub gtkset_usize($$$) { $_[0]->set_usize($_[1],$_[2]); $_[0] } sub gtkset_justify($$) { $_[0]->set_justify($_[1]); $_[0] } +sub gtkset_active($$) { $_[0]->set_active($_[1]); $_[0] } sub gtksignal_connect($@) { my $w = shift; @@ -85,7 +86,7 @@ sub gtkpack_($@) { my $l = $_[$i + 1]; ref $l or $l = new Gtk::Label($l); $box->pack_start($l, $_[$i], 1, 0); - $_[$i + 1]->show; + $l->show; } $box } @@ -237,11 +238,14 @@ sub _ask_from_entry($$@) { ); $entry->grab_focus(); } -sub _ask_from_list($\@$@) { +sub _ask_from_list($$$@) { my ($o, $l, @msgs) = @_; - my $f = sub { $o->{retval} = $_[1]; Gtk->main_quit }; - my $list = new Gtk::List(); - map { gtksignal_connect(gtkadd($list, new Gtk::ListItem($_)), selection_changed => $f, $_) } @$l; + my $list = new Gtk::List; + $list->signal_connect(select_child => sub { + $o->{retval} = $l->[$list->child_position($_[1])]; + Gtk->main_quit; + }); + gtkadd($list, map { new Gtk::ListItem($_) } @$l); # myadd($o->{window}, # mypack_(myset_usize(new Gtk::VBox(0,0), 0, 200), diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index a65b3eb90..103af1ec3 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -64,7 +64,9 @@ sub psReadComponentsFile { $inComp = 0; $comps{$current{name}} = { %current }; } else { - push @{$current{packages}}, $packages->{$_} || log::w "package $_ does not exist (line $n of comps file)"; + $packages->{$_} ? + push @{$current{packages}}, $packages->{$_} : + log::w("package $_ does not exist (line $n of comps file)"); } } else { my ($selected, $hidden, $name) = /^([01])\s*(--hide)?\s*(.*)/ or die "bad comps file at line $n"; |