From 24bc2fb8381b20a9d52149df6e609c5dfe5ca0c0 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 19 Sep 2008 10:44:16 +0000 Subject: - diskdrake o handle partitions encrypted with cryptsetup - bug fix: add mandatory new modules for dm-crypt --- perl-install/partition_table/dmcrypt.pm | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 perl-install/partition_table/dmcrypt.pm (limited to 'perl-install/partition_table') diff --git a/perl-install/partition_table/dmcrypt.pm b/perl-install/partition_table/dmcrypt.pm new file mode 100644 index 000000000..3eae783c6 --- /dev/null +++ b/perl-install/partition_table/dmcrypt.pm @@ -0,0 +1,41 @@ +package partition_table::dmcrypt; # $Id: $ + +# dmcrypt on full disk + +use diagnostics; +use strict; + +our @ISA = qw(partition_table::readonly); + +use common; +use partition_table::readonly; +use fs::type; + +sub _parts { + my ($hd) = @_; + + my $part = { size => $hd->{totalsectors}, device => $hd->{device} }; + add2hash($part, fs::type::type_name2subpart('Encrypted')); + + require fs; + fs::get_major_minor([$part]); # to allow is_same_hd() in fs::dmcrypt + + [ $part ]; +} + +sub read_primary { + my ($hd) = @_; + + my $type = fs::type::type_subpart_from_magic($hd); + + $type && $type->{type_name} eq 'Encrypted' or return; + + partition_table::dmcrypt->initialize($hd); + 1; +} + +sub initialize { + my ($class, $hd) = @_; + + partition_table::readonly::initialize($class, $hd, _parts($hd)); +} -- cgit v1.2.1