diff options
-rw-r--r-- | docs/TODO | 2 | ||||
-rw-r--r-- | perl-install/Makefile | 5 | ||||
-rw-r--r-- | perl-install/common.pm | 7 | ||||
-rw-r--r-- | perl-install/fs.pm | 2 | ||||
-rw-r--r-- | perl-install/fsedit.pm | 6 | ||||
-rw-r--r-- | perl-install/install2.pm | 8 | ||||
-rw-r--r-- | perl-install/install_any.pm | 10 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 3 | ||||
-rw-r--r-- | perl-install/install_steps_auto_install.pm | 2 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 7 | ||||
-rw-r--r-- | perl-install/my_gtk.pm | 23 | ||||
-rw-r--r-- | perl-install/partition_table.pm | 7 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 2 | ||||
-rw-r--r-- | perl-install/raid.pm | 112 | ||||
-rw-r--r-- | perl-install/share/aliases | 5 | ||||
-rw-r--r-- | perl-install/share/compssList | 20 | ||||
-rw-r--r-- | perl-install/share/list | 2 |
17 files changed, 179 insertions, 44 deletions
@@ -20,6 +20,8 @@ install postfix in place of sendmail for security levels 4&5 update the list of modules (in update_kernel) merge the install(1) of redhat +install ssh + suggested partition tables must be better foreach installClass (fpons)verify the free space is big enough. diff --git a/perl-install/Makefile b/perl-install/Makefile index 20792080b..c09cf9f16 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -82,8 +82,6 @@ install_pms: $(DIRS) cp *.rc $(DESTREP4PMS) install -d $(DESTREP4PMS)/po cp -f po/*.po* $(DESTREP4PMS)/po ||: - ln -sf perl-install/install2 $(DEST)/usr/bin - ln -sf perl-install/commands $(DEST)/usr/bin chmod a+x $(DESTREP4PMS)/install2 chmod a+x $(DESTREP4PMS)/commands chmod a+x $(DESTREP4PMS)/XFdrake @@ -133,7 +131,7 @@ get_needed_files: $(DIRS) cd $(DEST)/usr/bin ; mv insmod insmod_ rmdir $(DEST)/bin $(DEST)/sbin - ln -sf ash $(DEST)/usr/bin/sh + perl -ane 'symlink "$$F[1]", "$(DEST)/usr/bin/$$F[0]"' aliases tar xfy locales.tar.bz2 -C $(DEST) # DEST=$(DEST) perl -I. -MForMakefile -e 'locale()' @@ -155,7 +153,6 @@ get_needed_files: $(DIRS) 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 # chmod a+x $(DEST)/usr/bin/runinstall2 diff --git a/perl-install/common.pm b/perl-install/common.pm index de552b7c8..f983b1bfd 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -6,9 +6,9 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int @ISA = qw(Exporter); %EXPORT_TAGS = ( - common => [ qw(__ even odd min max sqr sum sign product bool invbool listlength bool2text text2bool to_int to_float ikeys member divide is_empty_array_ref is_empty_hash_ref add2hash add2hash_ set_new set_add round round_up round_down first second top uniq translate untranslate warp_text formatAlaTeX formatLines) ], + common => [ qw(__ even odd min max sqr sum and_ or_ sign product bool invbool listlength bool2text text2bool to_int to_float ikeys member divide is_empty_array_ref is_empty_hash_ref add2hash add2hash_ set_new set_add round round_up round_down first second top uniq translate untranslate warp_text formatAlaTeX formatLines) ], functional => [ qw(fold_left compose map_index grep_index map_each grep_each map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie) ], - file => [ qw(dirname basename touch all glob_ cat_ symlinkf chop_ mode typeFromMagic) ], + file => [ qw(dirname basename touch all glob_ cat_ output symlinkf chop_ mode typeFromMagic) ], system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ salt getVarsFromSh setVarsInSh setVarsInCsh substInFile availableRam availableMemory removeXiBSuffix template2file) ], constant => [ qw($printable_chars $sizeof_int $bitof_int $SECTORSIZE) ], ); @@ -42,6 +42,8 @@ sub odd($) { $_[0] % 2 == 1 } sub min { fold_left { $a < $b ? $a : $b } @_ } sub max { fold_left { $a > $b ? $a : $b } @_ } sub sum { fold_left { $a + $b } @_ } +sub and_{ fold_left { $a && $b } @_ } +sub or_ { fold_left { $a || $b } @_ } sub sqr { $_[0] * $_[0] } sub sign { $_[0] <=> 0 } sub product { fold_left { $a * $b } @_ } @@ -64,6 +66,7 @@ sub bool2text { $_[0] ? "true" : "false" } sub text2bool { my $t = lc($_[0]); $t eq "true" || $t eq "yes" ? 1 : 0 } sub strcpy { substr($_[0], $_[2] || 0, length $_[1]) = $_[1] } sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } +sub output { my $f = shift; local *F; open F, ">$f" or die "output in file $f failed: $!\n"; print F foreach @_; } sub linkf { unlink $_[1]; link $_[0], $_[1] } sub symlinkf { unlink $_[1]; symlink $_[0], $_[1] } sub chop_ { map { my $l = $_; chomp $l; $l } @_ } diff --git a/perl-install/fs.pm b/perl-install/fs.pm index d77a0dc0d..1a81a238a 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -235,7 +235,7 @@ sub write_fstab($;$$) { #- tested? devices::make("$prefix/$dir$_->{device}") if $_->{device} && $dir && !$_->{noMakeDevice}; eval { devices::make("$prefix/$dir$_->{device}") } if $_->{device} && $dir; - mkdir "$prefix/$_->{mntpoint}", 0755 if $_->{mntpoint}; + mkdir "$prefix/$_->{mntpoint}", 0755 if $_->{mntpoint} && !isSwap($_); [ ( $_->{device} =~ /^\// ? $_->{device} : "$dir$_->{device}" ), $_->{mntpoint}, type2fs($_->{type}), $options, $freq, $passno ]; diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 50f9fa890..a0c019c52 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -94,6 +94,12 @@ sub get_fstab(@) { map { partition_table::get_normal_parts($_) } @_; } +sub hasRAID { + my $b = 0; + map { $b ||= isRAID($_) } get_fstab(@_); + $b; +} + sub get_root($) { my ($fstab) = @_; $_->{mntpoint} eq "/" and return $_ foreach @$fstab; diff --git a/perl-install/install2.pm b/perl-install/install2.pm index ed506f7d9..b22783ff2 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -181,8 +181,8 @@ $o = $::o = { steps => \%installSteps, orderedSteps => \@orderedInstallSteps, - base => [ qw(basesystem sed initscripts console-tools mkbootdisk anacron utempter ldconfig chkconfig ntsysv mktemp setup filesystem SysVinit bdflush crontabs dev e2fsprogs etcskel fileutils findutils getty_ps grep groff gzip hdparm info initscripts isapnptools kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash sed setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time tmpwatch util-linux vim-minimal vixie-cron which perl-base) ], -#-GOLD base => [ qw(basesystem sed initscripts console-tools mkbootdisk anacron utempter ldconfig chkconfig ntsysv mktemp setup filesystem SysVinit bdflush crontabs dev e2fsprogs etcskel fileutils findutils getty_ps grep groff gzip hdparm info initscripts isapnptools kbdconfig kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash sed setconsole setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time tmpwatch util-linux vim-minimal vixie-cron which cpio perl) ], +#-GOLD base => [ qw(basesystem sed initscripts console-tools mkbootdisk anacron utempter ldconfig chkconfig ntsysv mktemp setup filesystem SysVinit bdflush crontabs dev e2fsprogs etcskel fileutils findutils getty_ps grep groff gzip hdparm info initscripts isapnptools kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash sed setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time tmpwatch util-linux vim-minimal vixie-cron which perl-base) ], + base => [ qw(basesystem sed initscripts console-tools mkbootdisk anacron utempter ldconfig chkconfig ntsysv mktemp setup filesystem SysVinit bdflush crontabs dev e2fsprogs etcskel fileutils findutils getty_ps grep groff gzip hdparm info initscripts isapnptools kbdconfig kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash sed setconsole setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time tmpwatch util-linux vim-minimal vixie-cron which cpio perl) ], #- for the list of fields available for user and superuser, see @etc_pass_fields in install_steps.pm #- intf => [ { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } ], @@ -297,12 +297,12 @@ sub partitionDisks { } elsif ($o->{partitioning}{readonly}) { $o->ask_mntpoint_s($o->{fstab}); } else { - $o->doPartitionDisks($o->{hds}); + $o->doPartitionDisks($o->{hds}, $o->{raid} ||= {}); } unless ($::testing) { $o->rebootNeeded foreach grep { $_->{rebootNeeded} } @{$o->{hds}}; } - $o->{fstab} = [ fsedit::get_fstab(@{$o->{hds}}) ]; + $o->{fstab} = [ fsedit::get_fstab(@{$o->{hds}}, $o->{raid}) ]; fsedit::get_root($o->{fstab}) or die _("Partitioning failed: no root filesystem"); } diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 2326edaa1..d02a80608 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -172,9 +172,11 @@ sub getHds { getHds: $o->{hds} = catch_cdie { fsedit::hds(\@drives, $o->{partitioning}) } sub { - $o->ask_warn(_("Error"), -_("I can't read your partition table, it's too corrupted for me :( -I'll try to go on blanking bad partitions")) unless $o->{partitioning}{readonly}; + my ($err) = $@ =~ /(.*) at /; + $@ =~ /overlapping/ and $o->ask_warn('', $@), return 1; + $o->ask_okcancel(_("Error"), +[_("I can't read your partition table, it's too corrupted for me :( +I'll try to go on blanking bad partitions"), $err]) unless $o->{partitioning}{readonly}; $ok = 0; 1 }; @@ -339,7 +341,7 @@ sub unlockCdroms() { foreach detect_devices::cdroms(); } sub ejectCdrom() { - ioctl detect_devices::tryOpen($_), c::CDROMEJECT(), 1 + eval { ioctl detect_devices::tryOpen($_), c::CDROMEJECT(), 1 } foreach map { first split } grep { m|/tmp/rhimage| } cat_("/proc/mounts"); } diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 3ec11a021..b537263f7 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -15,6 +15,7 @@ use modules; use run_program; use lilo; use lang; +use raid; use keyboard; use printer; use pkgs; @@ -166,7 +167,7 @@ sub choosePartitionsToFormat($$) { sub formatPartitions { my $o = shift; foreach (@_) { - fs::format_part($_) if $_->{toFormat}; + raid::format_part($o->{raid}, $_) if $_->{toFormat}; } } diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm index 254f092ff..394bf4e70 100644 --- a/perl-install/install_steps_auto_install.pm +++ b/perl-install/install_steps_auto_install.pm @@ -23,7 +23,7 @@ sub ask_warn { log::l(ref $_[1] ? join " ", @{$_[1]} : $_[1]); } -sub errorInStep { +sub errorInStep { print "error :(\n"; print "switch to console f2 for a shell\n"; print "press to return to reboot\n"; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index ae96317f2..c5f1a4526 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -21,6 +21,7 @@ use run_program; use commands; use fsedit; use network; +use raid; use mouse; use modules; use lang; @@ -36,7 +37,7 @@ use lilo; #-###################################################################################### sub errorInStep($$) { my ($o, $err) = @_; - $err =~ s/(.*) at .*?$/$1\./ unless $::testing; #- avoid error message. + $err =~ s/ at .*?$/\./ unless $::testing; #- avoid error message. $o->ask_warn(_("Error"), [ _("An error occurred"), $err ]); } @@ -211,7 +212,7 @@ sub formatPartitions { foreach (@_) { if ($_->{toFormat}) { $w->set(_("Formatting partition %s", $_->{device})); - fs::format_part($_); + raid::format_part($o->{raid}, $_); } } } @@ -595,7 +596,7 @@ _("Use NIS") => { val => \$o->{authentification}{NIS}, type => 'bool', text => _ ], complete => sub { $sup->{password} eq $sup->{password2} or $o->ask_warn('', [ _("The passwords do not match"), _("Please try again") ]), return (1,1); - length $sup->{password} < ($o->{security} > 3 ? 10 : 6) + length $sup->{password} < 2 * $o->{security} and $o->ask_warn('', _("This password is too simple")), return (1,0); return 0 } diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 848a764a4..29de8a794 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -239,19 +239,20 @@ sub create_menu($@) { $w } +sub add2notebook { + my ($n, $title, $book) = @_; + + my ($w1, $w2) = map { new Gtk::Label($_) } $title, $title; + $book->{widget_title} = $w1; + $n->append_page_menu($book, $w1, $w2); + $book->show; + $w1->show; + $w2->show; +} + sub create_notebook(@) { my $n = new Gtk::Notebook; - while (@_) { - my $title = shift; - my $book = shift; - - my ($w1, $w2) = map { new Gtk::Label($_) } $title, $title; - $book->{widget_title} = $w1; - $n->append_page_menu($book, $w1, $w2); - $book->show; - $w1->show; - $w2->show; - } + add2notebook($n, splice(@_, 0, 2)) while @_; $n } diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index 073ecc1c3..652f3f81f 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @important_types @fields2save); @ISA = qw(Exporter); %EXPORT_TAGS = ( - types => [ qw(type2name type2fs name2type fs2type isExtended isExt2 isSwap isDos isWin isFat isPrimary isNfs) ], + types => [ qw(type2name type2fs name2type fs2type isExtended isExt2 isSwap isDos isWin isFat isPrimary isNfs isRAID) ], ); @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; @@ -167,6 +167,7 @@ sub name2type($) { } sub isExtended($) { $_[0]{type} == 5 || $_[0]{type} == 0xf } +sub isRAID($) { $_[0]{type} == 0xfd } sub isSwap($) { $type2fs{$_[0]{type}} eq 'swap' } sub isExt2($) { $type2fs{$_[0]{type}} eq 'ext2' } sub isDos($) { $ {{ 1=>1, 4=>1, 6=>1 }}{$_[0]{type}} } @@ -219,7 +220,7 @@ sub verifyInside($$) { sub verifyParts_ { foreach my $i (@_) { foreach (@_) { - $i != $_ and verifyNotOverlap($i, $_) || die "partitions $i->{start} $i->{size} and $_->{start} $_->{size} are overlapping!"; + $i != $_ and verifyNotOverlap($i, $_) || cdie "partitions sector #$i->{start} ($i->{size}bytes) and sector #$_->{start} ($_->{size}bytes) are overlapping!"; }} } sub verifyParts($) { @@ -294,6 +295,8 @@ sub adjust_main_extended($) { sub get_normal_parts($) { my ($hd) = @_; + $hd->{raid} and return grep {$_} @{$hd->{raid}}; + @{$hd->{primary}{normal} || []}, map { $_->{normal} } @{$hd->{extended} || []} } diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index bb83ab3ca..1e8c2326e 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -230,7 +230,7 @@ sub readCompssList($$$) { $e or log::l("neither packages nor categories"); my $p = $e->{$name} or log::l("unknown entry $name (in compssList)"), next; - @values = map { $_ + 40 } @values if $name =~ /$s$r$/i; + @values = map { $_ + 68 } @values if $name =~ /$s$r$/i; $p->{values} = \@values; } $level; diff --git a/perl-install/raid.pm b/perl-install/raid.pm new file mode 100644 index 000000000..7cc2eb7d6 --- /dev/null +++ b/perl-install/raid.pm @@ -0,0 +1,112 @@ +package raid; + +use diagnostics; +use strict; + +#-###################################################################################### +#- misc imports +#-###################################################################################### +use common qw(:common :functional); +use run_program; +use devices; +use fs; + +sub nb($) { + my ($nb) = @_; + first((ref $nb ? $nb->{device} : $nb) =~ /(\d+)/); +} + +sub is($) { + my ($part) = @_; + $part->{device} =~ /^md/; +} + +sub new($$) { + my ($raid, $part) = @_; + my $nb = @$raid; + $raid->[$nb] = { 'chunk-size' => "64k", type => 0x83, disks => [ $part ], device => "md$nb", notFormatted => 1 }; + $part->{raid} = $nb; +} + +sub add($$$) { + my ($raid, $part, $nb) = @_; + $raid->[$nb]{isMounted} and die _("Can't add a partition to _formatted_ RAID md%d", $nb); + $part->{raid} = $nb; + push @{$raid->[$nb]{disks}}, $part; +} + +sub delete($$) { + my ($raid, $nb) = @_; + $nb = nb($nb); + + delete $_->{raid} foreach @{$raid->[$nb]{disks}}; + $raid->[$nb] = undef; +} + +sub removeDisk($$) { + my ($raid, $part) = @_; + my $nb = nb($part->{raid}); + delete $part->{raid}; + @{$raid->[$nb]{disks}} = grep { $_ != $part } @{$raid->[$nb]{disks}}; + update($raid->[$nb]); +} + +sub updateSize($) { + my ($part) = @_; + local $_ = $part->{level}; + my @l = map { $_->{size} } @{$part->{disks}}; + + $part->{size} = do { + if (/0|linear/) { sum @l } + elsif (/1/ ) { min @l } + elsif (/4|5/) { min(@l) * $#l } + }; +} + +sub updateIsFormatted($) { + my ($part) = @_; + $part->{isFormatted} = and_ map { $_->{isFormatted} } @{$part->{disks}}; + $part->{notFormatted} = and_ map { $_->{notFormatted} } @{$part->{disks}}; +} +sub update($) { + &updateSize; + &updateIsFormatted; +} + +sub write($) { + my ($raid, $file) = @_; + local *F; + local $\ = "\n"; + + foreach (grep {$_} @$raid) { + open F, ">$file" or die _("Can't write file $file"); + print F <<"EOF"; +raiddev /dev/$_->{device} +raid-level $_->{level} +chunk-size $_->{'chunk-size'} +persistent-superblock 1 +EOF + print F "nr-raid-disks ", int @{$_->{disks}}; + map_index { + print F " device /dev/$_->{device}"; + print F " raid-disk $::i"; + } @{$_->{disks}}; + } +} + +sub make($$) { + my ($raid, $part) = @_; + my $dev = devices::make($part->{device}); + run_program::run("raidstop", $dev); + &write($raid, "/etc/raidtab"); + run_program::run("mkraid", "--really-force", $dev); + run_program::run("raidstart", $dev); +} + +sub format_part($$) { + my ($raid, $part) = @_; + make($raid->{raid}, $part) if is($part); + fs::format_part($part); +} + +1; diff --git a/perl-install/share/aliases b/perl-install/share/aliases new file mode 100644 index 000000000..516733eea --- /dev/null +++ b/perl-install/share/aliases @@ -0,0 +1,5 @@ +raidstop raidstart +sh ash +install2 perl-install/install2 +commands perl-install/commands +runinstall2 install2 diff --git a/perl-install/share/compssList b/perl-install/share/compssList index 048750938..db546808e 100644 --- a/perl-install/share/compssList +++ b/perl-install/share/compssList @@ -395,15 +395,15 @@ mandrake_desk 82 0 70 mandrake_doc 82 0 70 MandrakeUpdate 82 0 70 man-pages 82 0 72 -man-pages-cs 60 0 54 -man-pages-de 60 0 54 -man-pages-es 60 0 54 -man-pages-fr 60 0 54 -man-pages-it 60 0 54 -man-pages-ja 60 0 54 -man-pages-ko 60 0 54 -man-pages-pl 60 0 54 -man-pages-ru 60 0 54 +man-pages-cs 20 0 20 +man-pages-de 20 0 20 +man-pages-es 20 0 20 +man-pages-fr 20 0 20 +man-pages-it 20 0 20 +man-pages-ja 20 0 20 +man-pages-ko 20 0 20 +man-pages-pl 20 0 20 +man-pages-ru 20 0 20 mars-nwe 0 0 0 mawk 0 0 80 mc 35 0 31 @@ -489,7 +489,7 @@ postgresql-clients 26 0 23 postgresql-devel 26 99 23 postgresql-server 26 99 23 postgresql-tcl 26 0 23 -ppp 1 0 0 +ppp 87 0 82 printtool 52 0 46 procinfo 32 0 96 procps-X11 36 0 32 diff --git a/perl-install/share/list b/perl-install/share/list index fd8ce8fca..1b17c0b59 100644 --- a/perl-install/share/list +++ b/perl-install/share/list @@ -7,9 +7,11 @@ /etc/protocols /sbin/fdisk /sbin/insmod +/sbin/mkraid /sbin/rmmod /sbin/mkdosfs /sbin/mke2fs +/sbin/raidstart /usr/bin/bzip2 /usr/bin/perl /usr/lib/libimlib-png.so |