diff options
Diffstat (limited to 'perl-install')
32 files changed, 125 insertions, 142 deletions
diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm index 8c46c3600..bf6d6d88a 100644 --- a/perl-install/Xconfig/main.pm +++ b/perl-install/Xconfig/main.pm @@ -11,7 +11,6 @@ use Xconfig::screen; use Xconfig::test; use Xconfig::xfree; use common; -use any; sub configure_monitor { diff --git a/perl-install/Xconfig/resolution_and_depth.pm b/perl-install/Xconfig/resolution_and_depth.pm index 7179186ec..bc4a0d784 100644 --- a/perl-install/Xconfig/resolution_and_depth.pm +++ b/perl-install/Xconfig/resolution_and_depth.pm @@ -3,8 +3,6 @@ package Xconfig::resolution_and_depth; # $Id$ use diagnostics; use strict; -use Xconfig::card; -use Xconfig::monitor; use common; diff --git a/perl-install/any.pm b/perl-install/any.pm index 0cd403bd9..97953f608 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -12,7 +12,6 @@ use partition_table; use fs::type; use lang; use run_program; -use keyboard; use devices; use modules; use log; diff --git a/perl-install/authentication.pm b/perl-install/authentication.pm index b67e46159..ce9ac04d6 100644 --- a/perl-install/authentication.pm +++ b/perl-install/authentication.pm @@ -1,7 +1,6 @@ package authentication; # $Id$ use common; -use any; sub kinds { my $no_para = @_ == 0; diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 0d886f4cb..27a129fac 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -7,13 +7,13 @@ use strict; #- misc imports #-###################################################################################### use common; -use partition_table; use fs::type; use fs::get; +use fs::loopback; +use fs::proc_partitions; use log; use any; use devices; -use fs::loopback; use detect_devices; use partition_table::raw; use run_program; @@ -255,7 +255,7 @@ sub read_grub { sub yaboot2dev { my ($of_path) = @_; - find { dev2yaboot($_) eq $of_path } map { "/dev/$_->{dev}" } devices::read_proc_partitions_raw(); + find { dev2yaboot($_) eq $of_path } map { "/dev/$_->{dev}" } fs::proc_partitions::read_raw(); } # assumes file is in /boot diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 15f671670..fad553daf 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -369,7 +369,7 @@ sub getIDE() { sub block_devices() { -d '/sys/block' ? map { s|!|/|; $_ } all('/sys/block') - : map { $_->{dev} } devices::read_proc_partitions_raw(); + : map { $_->{dev} } do { require fs::proc_partitions; fs::proc_partitions::read_raw() }; } sub getCompaqSmartArray() { diff --git a/perl-install/devices.pm b/perl-install/devices.pm index c5ee94c04..9404481a8 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -205,18 +205,6 @@ sub to_devfs { readlink("/dev/" . $dev); } -sub read_proc_partitions_raw() { - my (undef, undef, @all) = cat_("/proc/partitions"); - grep { - $_->{size} != 1 && # skip main extended partition - $_->{size} != 0x3fffffff; # skip cdroms (otherwise stops cd-audios) - } map { - my %l; - @l{qw(major minor size dev)} = split; - \%l; - } @all; -} - sub simple_partition_scan { my ($part) = @_; $part->{device} =~ /([hs]d[a-z])(\d+)$/; diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index 95860d7e5..7de290b89 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -11,8 +11,6 @@ use detect_devices; use diskdrake::interactive; use run_program; use devices; -use raid; -use any; use log; use fsedit; @@ -108,7 +106,7 @@ sub try { sub try_ { my ($name, $f, @args) = @_; - fsedit::undo_prepare($all_hds) if $name ne 'Undo'; + diskdrake::interactive::undo_prepare($all_hds) if $name ne 'Undo'; my $v = eval { $f->($in, @args, $all_hds) }; if (my $err = $@) { diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 080bb375d..ca5b8f4d4 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -7,6 +7,7 @@ use common; use fs::type; use fs::loopback; use fs::format; +use fs::mount_options; use fs; use partition_table; use partition_table::raw; @@ -258,7 +259,7 @@ sub general_possible_actions { sub Undo { my ($_in, $all_hds) = @_; - fsedit::undo($all_hds); + undo($all_hds); } sub Wizard { @@ -1313,3 +1314,26 @@ sub update_bootloader_for_renumbered_partitions { require bootloader; bootloader::update_for_renumbered_partitions($in, \@renumbering, $all_hds); } + +sub undo_prepare { + my ($all_hds) = @_; + require Data::Dumper; + $Data::Dumper::Purity = 1; + foreach (@{$all_hds->{hds}}) { + my @h = @$_{@partition_table::fields2save}; + push @{$_->{undo}}, Data::Dumper->Dump([\@h], ['$h']); + } +} +sub undo { + my ($all_hds) = @_; + foreach (@{$all_hds->{hds}}) { + my $code = pop @{$_->{undo}} or next; + my $h; eval $code; + @$_{@partition_table::fields2save} = @$h; + + if ($_->{hasBeenDirty}) { + partition_table::will_tell_kernel($_, 'force_reboot'); #- next action needing write_partitions will force it. We can not do it now since more undo may occur, and we must not needReboot now + } + } + +} diff --git a/perl-install/diskdrake/smbnfs_gtk.pm b/perl-install/diskdrake/smbnfs_gtk.pm index 69c9517a6..f30857ce0 100644 --- a/perl-install/diskdrake/smbnfs_gtk.pm +++ b/perl-install/diskdrake/smbnfs_gtk.pm @@ -3,7 +3,6 @@ package diskdrake::smbnfs_gtk; # $Id$ use diagnostics; use strict; -use any; use fs::get; use diskdrake::interactive; use common; diff --git a/perl-install/fs/mount_options.pm b/perl-install/fs/mount_options.pm index f59a083f7..358f01e01 100644 --- a/perl-install/fs/mount_options.pm +++ b/perl-install/fs/mount_options.pm @@ -5,6 +5,7 @@ use strict; use common; use fs::type; +use fs::get; use log; sub list() { diff --git a/perl-install/fs/proc_partitions.pm b/perl-install/fs/proc_partitions.pm new file mode 100644 index 000000000..3e1e31b32 --- /dev/null +++ b/perl-install/fs/proc_partitions.pm @@ -0,0 +1,82 @@ +package fs::proc_partitions; # $Id$ + +use common; + + +sub read_raw() { + my (undef, undef, @all) = cat_("/proc/partitions"); + grep { + $_->{size} != 1 && # skip main extended partition + $_->{size} != 0x3fffffff; # skip cdroms (otherwise stops cd-audios) + } map { + my %l; + @l{qw(major minor size dev)} = split; + \%l; + } @all; +} + +sub read { + my ($hds) = @_; + + my @all = read_raw(); + my ($parts, $disks) = partition { $_->{dev} =~ /\d$/ && $_->{dev} !~ /^(sr|scd)/ } @all; + + my $devfs_like = any { $_->{dev} =~ m|/disc$| } @$disks; + + my %devfs2normal = map { + my (undef, $major, $minor) = devices::entry($_->{device}); + my $disk = find { $_->{major} == $major && $_->{minor} == $minor } @$disks; + $disk->{dev} => $_->{device}; + } @$hds; + + my $prev_part; + foreach my $part (@$parts) { + my $dev; + if ($devfs_like) { + $dev = -e "/dev/$part->{dev}" ? $part->{dev} : sprintf("0x%x%02x", $part->{major}, $part->{minor}); + $part->{rootDevice} = $devfs2normal{dirname($part->{dev}) . '/disc'}; + } else { + $dev = $part->{dev}; + if (my $hd = find { $part->{dev} =~ /^\Q$_->{device}\E./ } @$hds) { + put_in_hash($part, partition_table::hd2minimal_part($hd)); + } + } + undef $prev_part if $prev_part && ($prev_part->{rootDevice} || '') ne ($part->{rootDevice} || ''); + + $part->{device} = $dev; + $part->{size} *= 2; # from KB to sectors + $part->{start} = $prev_part ? $prev_part->{start} + $prev_part->{size} : 0; + require fs::type; + put_in_hash($part, fs::type::type_subpart_from_magic($part)); + $prev_part = $part; + delete $part->{dev}; # cleanup + } + @$parts; +} + +sub compare { + my ($hd) = @_; + + my @l1 = partition_table::get_normal_parts($hd); + my @l2 = grep { $_->{rootDevice} eq $hd->{device} } read([$hd]); + + #- /proc/partitions includes partition with type "empty" and a non-null size + #- so add them for comparison + my ($len1, $len2) = (int(@l1) + $hd->{primary}{nb_special_empty}, int(@l2)); + + if ($len1 != $len2 && arch() ne 'ppc') { + die sprintf( + "/proc/partitions does not agree with drakx %d != %d:\n%s\n", $len1, $len2, + "/proc/partitions: " . join(", ", map { "$_->{device} ($_->{rootDevice})" } @l2)); + } + $len2; +} + +sub use_ { + my ($hd) = @_; + + partition_table::raw::zero_MBR($hd); + $hd->{readonly} = 1; + $hd->{getting_rid_of_readonly_allowed} = 1; + $hd->{primary} = { normal => [ grep { $_->{rootDevice} eq $hd->{device} } read([$hd]) ] }; +} diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index a92b670e8..6b10c9503 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -10,8 +10,10 @@ use vars qw(%suggestions); use common; use partition_table; use partition_table::raw; +use fs::get; use fs::type; use fs::loopback; +use fs::proc_partitions; use detect_devices; use devices; use log; @@ -132,7 +134,7 @@ sub get_hds { my $handle_die_and_cdie = sub { if ($hd->{readonly}) { log::l("using /proc/partitions since diskdrake failed :("); - use_proc_partitions($hd); + fs::proc_partitions::use_($hd); 1; } elsif (my $type = fs::type::type_subpart_from_magic($hd)) { #- non partitioned drive? @@ -163,7 +165,7 @@ sub get_hds { if (listlength(partition_table::get_normal_parts($hd)) == 0) { $handled = 1 if $handle_die_and_cdie->(); } else { - compare_with_proc_partitions($hd) if $::isInstall; + fs::proc_partitions::compare($hd) if $::isInstall; } } sub { my $err = $@; @@ -191,7 +193,7 @@ Do you agree to lose all the partitions? } else { #- using it readonly log::l("using /proc/partitions since diskdrake failed :("); - use_proc_partitions($hd); + fs::proc_partitions::use_($hd); } } $hd or next; @@ -242,44 +244,6 @@ Do you agree to lose all the partitions? $all_hds; } -sub read_proc_partitions { - my ($hds) = @_; - - my @all = devices::read_proc_partitions_raw(); - my ($parts, $disks) = partition { $_->{dev} =~ /\d$/ && $_->{dev} !~ /^(sr|scd)/ } @all; - - my $devfs_like = any { $_->{dev} =~ m|/disc$| } @$disks; - - my %devfs2normal = map { - my (undef, $major, $minor) = devices::entry($_->{device}); - my $disk = find { $_->{major} == $major && $_->{minor} == $minor } @$disks; - $disk->{dev} => $_->{device}; - } @$hds; - - my $prev_part; - foreach my $part (@$parts) { - my $dev; - if ($devfs_like) { - $dev = -e "/dev/$part->{dev}" ? $part->{dev} : sprintf("0x%x%02x", $part->{major}, $part->{minor}); - $part->{rootDevice} = $devfs2normal{dirname($part->{dev}) . '/disc'}; - } else { - $dev = $part->{dev}; - if (my $hd = find { $part->{dev} =~ /^\Q$_->{device}\E./ } @$hds) { - put_in_hash($part, partition_table::hd2minimal_part($hd)); - } - } - undef $prev_part if $prev_part && ($prev_part->{rootDevice} || '') ne ($part->{rootDevice} || ''); - - $part->{device} = $dev; - $part->{size} *= 2; # from KB to sectors - $part->{start} = $prev_part ? $prev_part->{start} + $prev_part->{size} : 0; - put_in_hash($part, fs::type::type_subpart_from_magic($part)); - $prev_part = $part; - delete $part->{dev}; # cleanup - } - @$parts; -} - sub is_same_hd { my ($hd1, $hd2) = @_; if ($hd1->{major} && $hd2->{major}) { @@ -540,29 +504,6 @@ sub auto_allocate_vgs { 1; } -sub undo_prepare { - my ($all_hds) = @_; - require Data::Dumper; - $Data::Dumper::Purity = 1; - foreach (@{$all_hds->{hds}}) { - my @h = @$_{@partition_table::fields2save}; - push @{$_->{undo}}, Data::Dumper->Dump([\@h], ['$h']); - } -} -sub undo { - my ($all_hds) = @_; - foreach (@{$all_hds->{hds}}) { - my $code = pop @{$_->{undo}} or next; - my $h; eval $code; - @$_{@partition_table::fields2save} = @$h; - - if ($_->{hasBeenDirty}) { - partition_table::will_tell_kernel($_, 'force_reboot'); #- next action needing write_partitions will force it. We can not do it now since more undo may occur, and we must not needReboot now - } - } - -} - sub change_type { my ($type, $hd, $part) = @_; $type->{pt_type} != $part->{pt_type} || $type->{fs_type} ne $part->{fs_type} or return; @@ -608,31 +549,4 @@ sub rescuept($) { } } -sub compare_with_proc_partitions { - my ($hd) = @_; - - my @l1 = partition_table::get_normal_parts($hd); - my @l2 = grep { $_->{rootDevice} eq $hd->{device} } read_proc_partitions([$hd]); - - #- /proc/partitions includes partition with type "empty" and a non-null size - #- so add them for comparison - my ($len1, $len2) = (int(@l1) + $hd->{primary}{nb_special_empty}, int(@l2)); - - if ($len1 != $len2 && arch() ne 'ppc') { - die sprintf( - "/proc/partitions does not agree with drakx %d != %d:\n%s\n", $len1, $len2, - "/proc/partitions: " . join(", ", map { "$_->{device} ($_->{rootDevice})" } @l2)); - } - $len2; -} - -sub use_proc_partitions { - my ($hd) = @_; - - partition_table::raw::zero_MBR($hd); - $hd->{readonly} = 1; - $hd->{getting_rid_of_readonly_allowed} = 1; - $hd->{primary} = { normal => [ grep { $_->{rootDevice} eq $hd->{device} } read_proc_partitions([$hd]) ] }; -} - 1; diff --git a/perl-install/harddrake/autoconf.pm b/perl-install/harddrake/autoconf.pm index 8cbbb9b4c..7f2c105d9 100644 --- a/perl-install/harddrake/autoconf.pm +++ b/perl-install/harddrake/autoconf.pm @@ -1,7 +1,6 @@ package harddrake::autoconf; use common; -use any; sub xconf { my ($modules_conf, $o) = @_; @@ -9,10 +8,10 @@ sub xconf { log::l('automatic XFree configuration'); require Xconfig::default; + require do_pkgs; $o->{raw_X} = Xconfig::default::configure(do_pkgs_standalone->new); require Xconfig::main; - require do_pkgs; Xconfig::main::configure_everything_auto_install($o->{raw_X}, do_pkgs_standalone->new, {}, { allowFB => 1 }); modules::load_category($modules_conf, 'various/agpgart'); diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm index 2e3506bae..c58b83aca 100644 --- a/perl-install/harddrake/data.pm +++ b/perl-install/harddrake/data.pm @@ -267,7 +267,6 @@ our @tree = configurator => "$sbindir/drakconnect", detector => sub { require list_modules; - require network::ethernet; my @net_modules = list_modules::category2modules(list_modules::ethernet_categories()); f(grep { $_->{media_type} && $_->{media_type} =~ /^NETWORK/ diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index e1651f23c..4adb6e341 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -16,7 +16,6 @@ package harddrake::sound; use strict; use common; -use interactive; use run_program; use modules; use list_modules; diff --git a/perl-install/harddrake/v4l.pm b/perl-install/harddrake/v4l.pm index aa005b664..8e2231a05 100644 --- a/perl-install/harddrake/v4l.pm +++ b/perl-install/harddrake/v4l.pm @@ -3,9 +3,7 @@ package harddrake::v4l; use strict; use common; -use interactive; use detect_devices; -use lang; use log; use modules; diff --git a/perl-install/http.pm b/perl-install/http.pm index dec3773a8..e35d8d221 100644 --- a/perl-install/http.pm +++ b/perl-install/http.pm @@ -1,7 +1,6 @@ package http; # $Id$ use IO::Socket; -use network::network; my $sock; diff --git a/perl-install/modules/interactive.pm b/perl-install/modules/interactive.pm index fb4bcfda2..ead9e7b71 100644 --- a/perl-install/modules/interactive.pm +++ b/perl-install/modules/interactive.pm @@ -1,5 +1,5 @@ -package modules::interactive; -use interactive; +package modules::interactive; # $Id$ + use modules; use common; diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index 65221d0b2..891c20635 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -2,7 +2,6 @@ package mygtk2; use diagnostics; use strict; -use lang; our @ISA = qw(Exporter); our @EXPORT = qw(gtknew gtkset gtkadd gtkval_register gtkval_modify); diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm index 9da5a3f7c..ca0b0e272 100644 --- a/perl-install/network/adsl.pm +++ b/perl-install/network/adsl.pm @@ -3,7 +3,6 @@ package network::adsl; # $Id$ use common; use run_program; use network::tools; -use network::ethernet; use modules; use vars qw(@ISA @EXPORT); diff --git a/perl-install/network/dhcpd.pm b/perl-install/network/dhcpd.pm index d91df441f..8cf30d5fc 100644 --- a/perl-install/network/dhcpd.pm +++ b/perl-install/network/dhcpd.pm @@ -2,7 +2,6 @@ package network::dhcpd; use strict; use common; -use network::network; my $sysconf_dhcpd = "$::prefix/etc/sysconfig/dhcpd"; my $dhcpd_conf_file = "$::prefix/etc/dhcpd.conf"; diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index dcda7b643..29e2b5d10 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -1,13 +1,9 @@ package network::ethernet; # $Id$ use c; -use network::network; -use modules; -use modules::interactive; use detect_devices; use common; use run_program; -use network::tools; our @dhcp_clients = qw(dhclient dhcpcd pump dhcpxd); diff --git a/perl-install/network/ipsec.pm b/perl-install/network/ipsec.pm index c0ee6e2fb..b40e6c79b 100644 --- a/perl-install/network/ipsec.pm +++ b/perl-install/network/ipsec.pm @@ -3,11 +3,9 @@ package network::ipsec; use detect_devices; -use network::netconnect; use run_program; use common; use log; -use Data::Dumper; #- debugg functions ---------- sub recreate_ipsec_conf { diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm index 11068828b..35c287d2c 100644 --- a/perl-install/network/isdn.pm +++ b/perl-install/network/isdn.pm @@ -3,7 +3,6 @@ package network::isdn; # $Id$ use strict; use network::isdn_consts; use common; -use any; use modules; use run_program; use log; diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm index f600db844..8c5adf523 100644 --- a/perl-install/network/modem.pm +++ b/perl-install/network/modem.pm @@ -5,7 +5,7 @@ use common; use any; use modules; use detect_devices; -use mouse; +use network::network; use network::tools; sub get_user_home() { diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index 9eca1b4b4..c702d7a61 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -11,7 +11,6 @@ use common; use detect_devices; use run_program; use network::tools; -use any; use vars qw(@ISA @EXPORT); use log; diff --git a/perl-install/network/nfs.pm b/perl-install/network/nfs.pm index 37dd954e5..194a9c678 100644 --- a/perl-install/network/nfs.pm +++ b/perl-install/network/nfs.pm @@ -4,7 +4,6 @@ use strict; use diagnostics; use common; -use network::network; use network::smbnfs; use log; diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm index ef98f6945..7fca6d65c 100644 --- a/perl-install/network/smb.pm +++ b/perl-install/network/smb.pm @@ -4,7 +4,7 @@ use strict; use diagnostics; use common; -use fs; +use fs::mount_options; use network::network; use network::smbnfs; diff --git a/perl-install/network/smbnfs.pm b/perl-install/network/smbnfs.pm index c38903028..bc5b92b60 100644 --- a/perl-install/network/smbnfs.pm +++ b/perl-install/network/smbnfs.pm @@ -3,7 +3,7 @@ package network::smbnfs; # $Id$ use strict; use diagnostics; -use fs; +use fs::mount_options; sub new { diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm index 8d8109723..90b86b9c2 100644 --- a/perl-install/partition_table/dos.pm +++ b/perl-install/partition_table/dos.pm @@ -9,6 +9,7 @@ use vars qw(@ISA); use common; use partition_table::raw; use partition_table; +use fs::type; use c; my @fields = qw(active start_head start_sec start_cyl pt_type end_head end_sec end_cyl start size); diff --git a/perl-install/raid.pm b/perl-install/raid.pm index c16f82378..68abe51fc 100644 --- a/perl-install/raid.pm +++ b/perl-install/raid.pm @@ -11,7 +11,6 @@ use fs::type; use run_program; use devices; use modules; -use fs; sub max_nb() { 31 } |