From 5ad0ed55d7a51db8301f44ed2bafdd48c0682e4c Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 13 Sep 2000 13:30:37 +0000 Subject: no_comment --- perl-install/fs.pm | 7 ++- perl-install/fsedit.pm | 11 +---- perl-install/install2.pm | 26 ++++++----- perl-install/install_any.pm | 12 ++--- perl-install/install_interactive.pm | 9 ++-- perl-install/install_steps.pm | 10 +++-- perl-install/install_steps_auto_install.pm | 3 +- perl-install/install_steps_gtk.pm | 20 +++------ perl-install/install_steps_interactive.pm | 10 ++--- perl-install/install_steps_stdio.pm | 5 +-- perl-install/modules.pm | 72 +++++++++++++++++------------- perl-install/partition_table.pm | 15 +++---- perl-install/raid.pm | 8 +--- 13 files changed, 97 insertions(+), 111 deletions(-) (limited to 'perl-install') diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 0c07c9994..5b5876415 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -8,12 +8,10 @@ use log; use devices; use partition_table qw(:types); use run_program; -use nfs; use swap; use detect_devices; use commands; use modules; -use raid; use fsedit; use loopback; @@ -136,7 +134,8 @@ sub real_format_part { } sub format_part { my ($raid, $part, $prefix) = @_; - if (raid::is($part)) { + if (isRAID($part)) { + require raid; raid::format_part($raid, $part); } elsif (isLoopback($part)) { loopback::format_part($part, $prefix); @@ -187,7 +186,7 @@ sub mount($$$;$) { if ($fs eq 'nfs') { log::l("calling nfs::mount($dev, $where)"); - nfs::mount($dev, $where) or die _("nfs mount failed"); +# nfs::mount($dev, $where) or die _("nfs mount failed"); } elsif ($fs eq 'smb') { die "no smb yet..."; } else { diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index a868493f4..72a96cfd9 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -14,9 +14,8 @@ use Data::Dumper; use fsedit; use devices; use loopback; -use raid; -use fs; use log; +use fs; #-##################################################################################### #- Globals @@ -110,12 +109,6 @@ sub free_space { sum map { $_->{size} } map { partition_table::get_holes($_) } @_; } -sub hasRAID { - my $b = 0; - map { $b ||= isRAID($_) } get_fstab(@_); - $b; -} - sub is_one_big_fat { my ($hds) = @_; @$hds == 1 or return; @@ -261,7 +254,7 @@ sub check_mntpoint { }; $check->($fake_part) unless $mntpoint eq '/' && $loopbackDevice; #- '/' is a special case, no loop check - die "raid / with no /boot" if $mntpoint eq "/" && raid::is($part) && !has_mntpoint("/boot", $hds); + die "raid / with no /boot" if $mntpoint eq "/" && isMDRAID($part) && !has_mntpoint("/boot", $hds); die _("You need a true filesystem (ext2, reiserfs) for this mount point\n") if !isTrueFS($part) && member($mntpoint, qw(/ /usr)); #- if ($part->{start} + $part->{size} > 1024 * $hd->cylinder_size() && arch() =~ /i386/) { #- die "/boot ending on cylinder > 1024" if $mntpoint eq "/boot"; diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 342255535..ff9a30c87 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -12,22 +12,19 @@ use vars qw($o $version); #-###################################################################################### use common qw(:common :file :system :functional); use install_any qw(:all); -use log; +use install_steps; use commands; -use network; use lang; use keyboard; use mouse; -use fs; -use raid; use fsedit; use devices; use partition_table qw(:types); use modules; use detect_devices; use run_program; - -use install_steps; +use log; +use fs; $::VERSION = "7.1"; #-$::corporate=1; @@ -289,6 +286,7 @@ sub formatPartitions { home mnt tmp var var/tmp var/lib var/lib/rpm var/lib/urpmi); mkdir "$o->{prefix}/$_", 0700 foreach qw(root); + require raid; raid::prepare_prefixed($o->{raid}, $o->{prefix}); my $d = "/initrd/loopfs/lnx4win"; @@ -372,6 +370,7 @@ STORAGE= sub configureNetwork { $::live and return; #- get current configuration of network device. + require network; eval { network::read_all_conf($o->{prefix}, $o->{netc} ||= {}, $o->{intf} ||= {}) }; $o->configureNetwork($_[1] == 1); } @@ -642,12 +641,15 @@ sub main { $::o = $o = $o_; - #- get stage1 network configuration if any. - $o->{netc} ||= network::read_conf("/tmp/network"); - if (my ($file) = glob_('/tmp/ifcfg-*')) { - log::l("found network config file $file"); - my $l = network::read_interface_conf($file); - add2hash(network::findIntf($o->{intf} ||= {}, $l->{DEVICE}), $l); + if (-e "/tmp/network") { + require network; + #- get stage1 network configuration if any. + $o->{netc} ||= network::read_conf("/tmp/network"); + if (my ($file) = glob_('/tmp/ifcfg-*')) { + log::l("found network config file $file"); + my $l = network::read_interface_conf($file); + add2hash(network::findIntf($o->{intf} ||= {}, $l->{DEVICE}), $l); + } } #-the main cycle diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 49a31cf10..201efe590 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -15,18 +15,16 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @needToCopy); #- misc imports #-###################################################################################### use common qw(:common :system :functional :file); -use commands; use run_program; use partition_table qw(:types); use partition_table_raw; use devices; use fsedit; -use network; use modules; use detect_devices; -use fs; use any; use log; +use fs; #- package that have to be copied for proper installation (just to avoid changing cdrom) #- here XFree86 is copied entirey if not already installed, maybe better to copy only server. @@ -158,11 +156,12 @@ sub setup_postinstall_rpms($$) { $postinstall_rpms and return; $postinstall_rpms = "$prefix/usr/postinstall-rpm"; + require pkgs; + require commands; + log::l("postinstall rpms directory set to $postinstall_rpms"); commands::mkdir_('-p', $postinstall_rpms); - require pkgs; - #- compute closure of unselected package that may be copied, #- don't complain if package does not exists as it may happen #- for the various architecture taken into account (X servers). @@ -182,6 +181,7 @@ sub setup_postinstall_rpms($$) { commands::cp((map { "/tmp/rhimage/" . relGetFile(pkgs::packageFile($_)) } @toCopy), $postinstall_rpms); } sub clean_postinstall_rpms() { + require commands; $postinstall_rpms and -d $postinstall_rpms and commands::rm('-rf', $postinstall_rpms); } @@ -342,6 +342,7 @@ sub setAuthentication { $_ = "#~$_" unless /^#/; $_ .= "$t $nis\n" if eof; } "$p/etc/yp.conf"; + require network; network::write_conf("$p/etc/sysconfig/network", $o->{netc}); } } @@ -599,6 +600,7 @@ sub generate_ks_cfg { if ($intf{BOOTPROTO} =~ /^(dhcp|bootp)$/) { $ks .= "network --bootproto $intf{BOOTPROTO}\n"; } else { + require network; my %l = (ip => $intf{IPADDR}, netmask => $intf{NETMASK}, gateway => $o->{netc}{GATEWAY}); $ks .= "network " . join(" ", map_each { $::b && "--$::a $::b" } %l); $ks .= " --nameserver $_" foreach network::dnsServers($o->{netc}); diff --git a/perl-install/install_interactive.pm b/perl-install/install_interactive.pm index 641d9ad59..e51fa5a8b 100644 --- a/perl-install/install_interactive.pm +++ b/perl-install/install_interactive.pm @@ -6,15 +6,14 @@ use strict; use vars; use common qw(:common :functional); -use fs; -use fsedit; -use log; use partition_table qw(:types); use partition_table_raw; use detect_devices; use install_steps; use devices; -use modules; +use fsedit; +use log; +use fs; sub tellAboutProprietaryModules { @@ -30,6 +29,7 @@ sub partition_with_diskdrake { my $ok; do { $ok = 1; + require diskdrake; diskdrake::main($hds, $o->{raid}, interactive_gtk->new, $o->{partitions}, $nowizard); delete $o->{wizard} and return partitionWizard($o, 'nodiskdrake'); my @fstab = fsedit::get_fstab(@$hds); @@ -154,7 +154,6 @@ When sure, press Ok.")) or return; } if (!$readonly && ref($o) =~ /gtk/) { #- diskdrake only available in gtk for now - require diskdrake; $solutions{diskdrake} = [ 0, ($::beginner ? _("Expert mode") : _("Use diskdrake")), sub { partition_with_diskdrake($o, $hds, 'nowizard') } ]; } diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 9de509b72..298189c21 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -15,14 +15,12 @@ use detect_devices; use modules; use run_program; use lang; -use raid; use keyboard; -use log; use fsedit; use loopback; -use commands; -use network; +#use commands; use any; +use log; use fs; @filesToSaveForUpgrade = qw( @@ -291,6 +289,7 @@ sub beforeInstallPackages { $::live or fs::write($o->{prefix}, $o->{fstab}, $o->{manualFstab}, $o->{useSupermount}); log::l("before install packages, after adding localhost in hosts"); + require network; network::add2hosts("$o->{prefix}/etc/hosts", "localhost.localdomain", "127.0.0.1"); log::l("before openning database"); @@ -502,6 +501,7 @@ sub selectMouse($) { #------------------------------------------------------------------------------ sub configureNetwork { my ($o) = @_; + require network; network::configureNetwork2($o->{prefix}, $o->{netc}, $o->{intf}); } @@ -629,6 +629,7 @@ sub addUser($) { chmod $mode, "$p$u->{home}"; } } + require commands; eval { commands::chown_("-r", "$u->{uid}.$u->{gid}", "$p$u->{home}") } if $u->{uid} != $u->{oldu} || $u->{gid} != $u->{oldg}; } @@ -736,6 +737,7 @@ sub configureXBefore { my ($o) = @_; my $xkb = $o->{X}{keyboard}{xkb_keymap} || keyboard::keyboard2xkb($o->{keyboard}); if (!-e "$o->{prefix}/usr/X11R6/lib/X11/xkb/symbols/$xkb" && (my $f = keyboard::xmodmap_file($o->{keyboard}))) { + require commands; commands::cp("-f", $f, "$o->{prefix}/etc/X11/xinit/Xmodmap"); $xkb = ''; } diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm index 6f22b2522..f6043bf75 100644 --- a/perl-install/install_steps_auto_install.pm +++ b/perl-install/install_steps_auto_install.pm @@ -2,7 +2,6 @@ package install_steps_auto_install; use diagnostics; use strict; -use netconnect; use lang; use vars qw(@ISA); @@ -36,7 +35,7 @@ sub new { sub configureNetwork { my ($o) = @_; modules::load_thiskind('net'); - netconnect::main($o->{prefix}, $o->{netcnx} ||= {}, $o->{netc}, $o->{mouse}, $o, $o->{pcmcia}, $o->{intf}, 1); + goto &install_steps::configureNetwork; } sub enteringStep($$$) { diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index fb9bc4504..ed254b816 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -9,28 +9,17 @@ use vars qw(@ISA); #-###################################################################################### #- misc imports #-###################################################################################### +use install_steps_interactive; +use interactive_gtk; use common qw(:common :file :functional :system); -use partition_table qw(:types); use my_gtk qw(:helpers :wrappers); use Gtk; -#-use Gtk::XmHTML; use devices; -use fsedit; -use commands; use modules; -use pkgs; -use partition_table qw(:types); -use partition_table_raw; -use install_steps; -use install_steps_interactive; -use interactive_gtk; use install_gtk; use install_any; -use diskdrake; use log; use mouse; -use help; -use lang; #-###################################################################################### #- In/Out Steps Functions @@ -189,9 +178,11 @@ sub selectMouse { $o->SUPER::selectMouse($force); $old{FULLNAME} eq $o->{mouse}{FULLNAME} && !$force and return; + local $my_gtk::grab = 1; #- unsure a crazy mouse don't go wild clicking everywhere + while (1) { log::l("telling X server to use another mouse"); - eval { commands::modprobe("serial") } if $o->{mouse}{device} =~ /ttyS/; + eval { modules::load('serial') } if $o->{mouse}{device} =~ /ttyS/; if (!$::testing) { symlinkf($o->{mouse}{device}, "/dev/mouse"); @@ -218,6 +209,7 @@ sub chooseSizeToInstall { my $spin = gtkset_usize(new Gtk::SpinButton($adj, 0, 0), 20, 0); my $val; + require pkgs; gtkadd($w->{window}, gtkpack(new Gtk::VBox(0,20), _("The total size for the groups you have selected is approximately %d MB.\n", pkgs::correctSize($max_size_ / sqr(1024))) . diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 7954d31cf..04a5ac94a 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -17,17 +17,13 @@ use install_steps; use install_interactive; use install_any; use detect_devices; -use netconnect; use run_program; -use commands; use devices; use fsedit; -use network; -use raid; +use loopback; use mouse; use modules; use lang; -use loopback; use keyboard; use any; use fs; @@ -470,6 +466,7 @@ sub afterInstallPackages($) { #------------------------------------------------------------------------------ sub configureNetwork { my ($o, $first_time) = @_; + require netconnect; netconnect::main($o->{prefix}, $o->{netcnx} ||= {}, $o->{netc}, $o->{mouse}, $o, $o->{pcmcia}, $o->{intf}, $first_time); } @@ -872,16 +869,15 @@ sub configureX { #------------------------------------------------------------------------------ sub generateAutoInstFloppy($) { my ($o) = @_; - $::expert || $::g_auto_install or return; my ($floppy) = detect_devices::floppies(); - $o->ask_yesorno('', _("Do you want to generate an auto install floppy for linux replication?"), $floppy) or return; $o->ask_warn('', _("Insert a blank floppy in drive %s", $floppy)); + require commands; my $dev = devices::make($floppy); my $image = $o->{pcmcia} ? "pcmcia" : diff --git a/perl-install/install_steps_stdio.pm b/perl-install/install_steps_stdio.pm index 86d10cb48..974e21c23 100644 --- a/perl-install/install_steps_stdio.pm +++ b/perl-install/install_steps_stdio.pm @@ -7,12 +7,9 @@ use vars qw(@ISA); @ISA = qw(install_steps_interactive interactive_stdio); use common qw(:common); -use devices; -use run_program; use interactive_stdio; use install_steps_interactive; -use install_any; -use log; +use lang; sub new($$) { my ($type, $o) = @_; diff --git a/perl-install/modules.pm b/perl-install/modules.pm index f6be1262e..8fad8efba 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -30,7 +30,7 @@ arch() =~ /^sparc/ ? ( "3c90x" => "3Com 3c90x (Cyclone/Hurricane/Tornado)", "at1700" => "Allied Telesis AT1700", "ac3200" => "Ansel Communication AC3200", -#BIG "acenic" => "AceNIC Gigabit Ethernet", + "acenic" => "AceNIC Gigabit Ethernet", "pcnet32" => "AMD PC/Net 32", "82596" => "Apricot 82596", # "atp" => "ATP", # builtin the kernel @@ -82,10 +82,10 @@ arch() =~ /^sparc/ ? ( "sb1000" => "sb1000", "sbni" => "sbni", "sis900" => "sis900", -#BIG "sk98lin" => "Syskonnect (Schneider & Koch)|Gigabit Ethernet", + "sk98lin" => "Syskonnect (Schneider & Koch)|Gigabit Ethernet", ), "3c59x" => "3com 3c59x (Vortex)", -#BIG "de4x5" => "Digital 425,434,435,450,500", + "de4x5" => "Digital 425,434,435,450,500", "rtl8139" => "RealTek RTL8129/8139", }], [ 'net_raw', { @@ -111,12 +111,12 @@ arch() =~ /^sparc/ ? ( "advansys" => "AdvanSys Adapters", "in2000" => "Always IN2000", "AM53C974" => "AMD SCSI", -#unsused "BusLogic" => "BusLogic Adapters", + "BusLogic" => "BusLogic Adapters", "dtc" => "DTC 3180/3280", -#unsused "seagate" => "Future Domain TMC-885, TMC-950", -#unsused "fdomain" => "Future Domain TMC-16x0", + "seagate" => "Future Domain TMC-885, TMC-950", + "fdomain" => "Future Domain TMC-16x0", "initio" => "Initio", -#unsused "g_NCR5380" => "NCR 5380", + "g_NCR5380" => "NCR 5380", "NCR53c406a" => "NCR 53c406a", "53c7,8xx" => "NCR 53c7xx", "qlogicfas" => "Qlogic FAS", @@ -128,12 +128,12 @@ arch() =~ /^sparc/ ? ( "a100u2w" => "a100u2w", "atp870u" => "atp870u (Acard/Artop)", -#unsused "dc395x_trm" => "dc395x_trm", + "dc395x_trm" => "dc395x_trm", "psi240i" => "psi240i", "qlogicfc" => "qlogicfc", "sim710" => "sim710", "sym53c416" => "sym53c416", -#unsused "tmscsim" => "tmscsim", + "tmscsim" => "tmscsim", ), "aic7xxx" => "Adaptec 2740, 2840, 2940", "ncr53c8xx" => "NCR 53C8xx PCI", @@ -144,8 +144,8 @@ arch() =~ /^sparc/ ? ( [ 'scsi_raw', { "scsi_mod" => "scsi_mod", "sd_mod" => "sd_mod", - "ide-mod" => "ide-mod", - "ide-probe" => "ide-probe", +#- "ide-mod" => "ide-mod", +#- "ide-probe" => "ide-probe", #- "ide-probe-mod" => "ide-probe-mod", }], [ 'disk', { @@ -153,33 +153,33 @@ arch() =~ /^sparc/ ? ( "pluto" => "Sun SparcSTORAGE Array SCSI", #- name it "fc4:soc:pluto" ? ) : arch() =~ /alpha/ ? () : ( "DAC960" => "Mylex DAC960", -#unused "dpt_i2o" => "Distributed Tech SmartCache/Raid I-IV Controller", # not there anymore? + "dpt_i2o" => "Distributed Tech SmartCache/Raid I-IV Controller", # not there anymore? "megaraid" => "AMI MegaRAID", "aacraid" => "AACxxx Raid Controller", "cpqarray" => "Compaq Smart-2/P RAID Controller", "gdth" => "ICP Disk Array Controller", "ips" => "IBM ServeRAID controller", -#unused "eata" => "EATA SCSI PM2x24/PM3224", -#unused "eata_pio" => "EATA PIO Adapters", -#unused "eata_dma" => "EATA DMA Adapters", + "eata" => "EATA SCSI PM2x24/PM3224", + "eata_pio" => "EATA PIO Adapters", + "eata_dma" => "EATA DMA Adapters", "ppa" => "Iomega PPA3 (parallel port Zip)", "imm" => "Iomega Zip (new driver)", ), }], [ 'disk_raw', { - "ide-disk" => "IDE disk", +#- "ide-disk" => "IDE disk", }], [ 'cdrom', { arch() !~ /^sparc|alpha/ ? ( "sbpcd" => "SoundBlaster/Panasonic", -#- "aztcd" => "Aztech CD", -#- "gscd" => "Goldstar R420", -#- "isp16" => "ISP16/MAD16/Mozart", -#- "mcd" => "Mitsumi", #- removed for space -#- "mcdx" => "Mitsumi (alternate)", -#- "optcd" => "Optics Storage 8000", -#- "cm206" => "Phillips CM206/CM260", -#- "sjcd" => "Sanyo", + "aztcd" => "Aztech CD", + "gscd" => "Goldstar R420", + "isp16" => "ISP16/MAD16/Mozart", + "mcd" => "Mitsumi", #- removed for space + "mcdx" => "Mitsumi (alternate)", + "optcd" => "Optics Storage 8000", + "cm206" => "Phillips CM206/CM260", + "sjcd" => "Sanyo", "cdu31a" => "Sony CDU-31A", "sonycd535" => "Sony CDU-5xx", ) : (), @@ -237,7 +237,7 @@ arch() !~ /^sparc/ ? ( "3c589_cs" => "3c589_cs", "parport_cs" => "parport_cs", "3c575_cb" => "3c575_cb", -#unused "apa1480_cb" => "apa1480_cb", + "apa1480_cb" => "apa1480_cb", "cb_enabler" => "cb_enabler", "epic_cb" => "epic_cb", "iflash2+_mtd" => "iflash2+_mtd", @@ -327,9 +327,18 @@ my %type_aliases = ( scsi => 'disk', ); -my @skip_modules_on_stage1 = - arch() =~ /alpha/ ? qw(sb1000) : - (); +my @skip_big_modules_on_stage1 = +qw( +acenic sk98lin de4x5 +BusLogic seagate fdomain g_NCR5380 dc395x_trm tmscsim +dpt_i2o eata eata_pio eata_dma +apa1480_cb +aztcd gscd isp16 mcd mcdx optcd cm206 sjcd +); + +my @skip_modules_on_stage1 = ( + arch() =~ /alpha/ ? qw(sb1000) : (), +); my @drivers_fields = qw(text type); @@ -347,8 +356,11 @@ while (my ($k, $v) = each %drivers) { sub module_of_type__4update_kernel { my ($type) = @_; $type = join "|", map { $_, $_ . "_raw" } split ' ', $type; - my %skip; @skip{@skip_modules_on_stage1} = (); - grep { !exists $skip{$_} } grep { $drivers{$_}{type} =~ /^($type)$/ } keys %drivers; + my %skip; + @skip{@skip_modules_on_stage1} = (); + @skip{@skip_big_modules_on_stage1} = () if $type !~ /big/; + "big" =~ /^($type)$/ ? @skip_big_modules_on_stage1 : (), + grep { !exists $skip{$_} } grep { $drivers{$_}{type} =~ /^($type)$/ } keys %drivers; } sub module_of_type { my ($type) = @_; diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index 249416ba3..95bbe7da8 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -1,24 +1,19 @@ package partition_table; -use diagnostics; -use strict; -use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @important_types @important_types2 @fields2save); +#use diagnostics; +#use strict; +#use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @important_types @important_types2 @fields2save); use Data::Dumper; @ISA = qw(Exporter); %EXPORT_TAGS = ( - types => [ qw(type2name type2fs name2type fs2type isExtended isExt2 isReiserfs isTrueFS isSwap isDos isWin isFat isSunOS isOtherAvailableFS isPrimary isNfs isSupermount isRAID isHFS isNT isMountableRW isApplePartMap isLoopback) ], + types => [ qw(type2name type2fs name2type fs2type isExtended isExt2 isReiserfs isTrueFS isSwap isDos isWin isFat isSunOS isOtherAvailableFS isPrimary isNfs isSupermount isRAID isMDRAID isHFS isNT isMountableRW isApplePartMap isLoopback) ], ); @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; use common qw(:common :system :functional); -use partition_table_empty; use partition_table_raw; -use partition_table_dos; -use partition_table_bsd; -use partition_table_sun; -use partition_table_mac; use log; @@ -214,6 +209,7 @@ sub name2type($) { sub isWholedisk($) { arch() =~ /^sparc/ && $_[0]{type} == 5 } sub isExtended($) { arch() !~ /^sparc/ && ($_[0]{type} == 5 || $_[0]{type} == 0xf || $_[0]{type} == 0x85) } sub isRAID($) { $_[0]{type} == 0xfd } +sub isMDRAID { $_[0]{device} =~ /^md/ } sub isSwap($) { $type2fs{$_[0]{type}} eq 'swap' } sub isExt2($) { $type2fs{$_[0]{type}} eq 'ext2' } sub isReiserfs($) { $type2fs{$_[0]{type}} eq 'reiserfs' } @@ -378,6 +374,7 @@ sub read_one($$) { foreach ('empty', @parttype) { /unknown/ and die "unknown partition table format"; eval { + require("partition_table_$_.pm"); bless $hd, "partition_table_$_"; ($pt, $info) = $hd->read($sector); log::l("found a $_ partition table on $hd->{file} at sector $sector"); diff --git a/perl-install/raid.pm b/perl-install/raid.pm index 585f2565e..8bc4d858e 100644 --- a/perl-install/raid.pm +++ b/perl-install/raid.pm @@ -7,6 +7,7 @@ use strict; #- misc imports #-###################################################################################### use common qw(:common :functional); +use partition_table qw(:types); use run_program; use devices; use commands; @@ -17,11 +18,6 @@ sub nb($) { first((ref $nb ? $nb->{device} : $nb) =~ /(\d+)/); } -sub is($) { - my ($part) = @_; - $part->{device} =~ /^md/; -} - sub new($$) { my ($raid, $part) = @_; my $nb = @$raid; @@ -122,7 +118,7 @@ EOF sub make { my ($raid, $part) = @_; - is($_) and make($raid, $_) foreach @{$part->{disks}}; + isMDRAID($_) and make($raid, $_) foreach @{$part->{disks}}; my $dev = devices::make($part->{device}); eval { commands::modprobe(module($part)) }; run_program::run("raidstop", $dev); -- cgit v1.2.1