summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-18 12:47:50 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-18 12:47:50 +0000
commit65ace13dc9c5de248e0d75d6e2076f640793528e (patch)
tree44b281e4a4b16f06834d72e7482e3cf38ebe3e9b /perl-install
parent157c064c16a05e562cc865788faa9848f3c31d53 (diff)
downloaddrakx-65ace13dc9c5de248e0d75d6e2076f640793528e.tar
drakx-65ace13dc9c5de248e0d75d6e2076f640793528e.tar.gz
drakx-65ace13dc9c5de248e0d75d6e2076f640793528e.tar.bz2
drakx-65ace13dc9c5de248e0d75d6e2076f640793528e.tar.xz
drakx-65ace13dc9c5de248e0d75d6e2076f640793528e.zip
create partition_table::readonly and use it
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/fs/proc_partitions.pm8
-rw-r--r--perl-install/partition_table/lvm.pm16
-rw-r--r--perl-install/partition_table/readonly.pm20
3 files changed, 30 insertions, 14 deletions
diff --git a/perl-install/fs/proc_partitions.pm b/perl-install/fs/proc_partitions.pm
index 84d686c45..731797a19 100644
--- a/perl-install/fs/proc_partitions.pm
+++ b/perl-install/fs/proc_partitions.pm
@@ -63,11 +63,9 @@ sub compare {
sub use_ {
my ($hd) = @_;
-
- partition_table::raw::clear($hd);
- $hd->{readonly} = 1;
- $hd->{getting_rid_of_readonly_allowed} = 1;
- $hd->{primary} = { normal => [ grep { $_->{rootDevice} eq $hd->{device} } &read([$hd]) ] };
+
+ require partition_table::readonly;
+ partition_table::readonly->initialize($hd, [ grep { $_->{rootDevice} eq $hd->{device} } &read([$hd]) ]);
}
1;
diff --git a/perl-install/partition_table/lvm.pm b/perl-install/partition_table/lvm.pm
index 0e8090772..e82d026e1 100644
--- a/perl-install/partition_table/lvm.pm
+++ b/perl-install/partition_table/lvm.pm
@@ -5,23 +5,19 @@ package partition_table::lvm; # $Id: $
use diagnostics;
use strict;
-our @ISA = qw(partition_table::raw);
+1;
use common;
-use partition_table::raw;
use fs::type;
use lvm;
-sub initialize {
- my ($class, $hd) = @_;
+sub _parts {
+ my ($hd) = @_;
my $part = { size => $hd->{totalsectors}, device => $hd->{device} };
add2hash($part, fs::type::type_name2subpart('Linux Logical Volume Manager'));
- $hd->{readonly} = $hd->{getting_rid_of_readonly_allowed} = 1;
- $hd->{primary}{normal} = [ $part ];
-
- bless $hd, $class;
+ [ $part ];
}
sub read_primary {
@@ -32,6 +28,8 @@ sub read_primary {
$type && $type->{pt_type} == $wanted->{pt_type} or return;
- partition_table::lvm->initialize($hd);
+ require partition_table::readonly;
+ partition_table::readonly->initialize($hd, _parts($hd));
+
1;
}
diff --git a/perl-install/partition_table/readonly.pm b/perl-install/partition_table/readonly.pm
new file mode 100644
index 000000000..c0d483aaf
--- /dev/null
+++ b/perl-install/partition_table/readonly.pm
@@ -0,0 +1,20 @@
+package partition_table::readonly; # $Id: $
+
+use diagnostics;
+use strict;
+
+our @ISA = qw(partition_table::raw);
+
+use common;
+use partition_table::raw;
+use fs::type;
+use lvm;
+
+sub initialize {
+ my ($class, $hd, $parts) = @_;
+
+ $hd->{readonly} = $hd->{getting_rid_of_readonly_allowed} = 1;
+ $hd->{primary}{normal} = $parts;
+
+ bless $hd, $class;
+}