summaryrefslogtreecommitdiffstats
path: root/perl-install/fs/dmcrypt.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2013-04-19 17:17:06 +0000
committerThierry Vignaud <tv@mageia.org>2013-04-19 17:17:06 +0000
commitb5cd68029b40c6a92ba67f35d05a30853119c075 (patch)
tree38fbf56468ae2dcbb386a356d56ea7b774e5d44d /perl-install/fs/dmcrypt.pm
parent4e6d45b47e12123c72b0d0b9b513252e5db6750d (diff)
downloaddrakx-b5cd68029b40c6a92ba67f35d05a30853119c075.tar
drakx-b5cd68029b40c6a92ba67f35d05a30853119c075.tar.gz
drakx-b5cd68029b40c6a92ba67f35d05a30853119c075.tar.bz2
drakx-b5cd68029b40c6a92ba67f35d05a30853119c075.tar.xz
drakx-b5cd68029b40c6a92ba67f35d05a30853119c075.zip
(save_crypttab_,read_crypttab_) split them out of (read|save)_crypttab_()
thus enabling to choose to/from which crypttab file read/write-ing needed for next changes (mga#5661)
Diffstat (limited to 'perl-install/fs/dmcrypt.pm')
-rw-r--r--perl-install/fs/dmcrypt.pm22
1 files changed, 16 insertions, 6 deletions
diff --git a/perl-install/fs/dmcrypt.pm b/perl-install/fs/dmcrypt.pm
index bc611455e..0926ed87a 100644
--- a/perl-install/fs/dmcrypt.pm
+++ b/perl-install/fs/dmcrypt.pm
@@ -25,14 +25,14 @@ sub _ensure_initialized() {
$initialized++ or init();
}
-sub read_crypttab {
- my ($all_hds) = @_;
+sub read_crypttab_ {
+ my ($all_hds, $crypttab) = @_;
- -e _crypttab() or return;
+ -e $crypttab or return;
my @raw_parts = grep { fs::type::isRawLUKS($_) } fs::get::really_all_fstab($all_hds);
- foreach (cat_(_crypttab())) {
+ foreach (cat_($crypttab)) {
my ($dm_name, $dev) = split;
my $raw_part = fs::get::device2part($dev, \@raw_parts)
@@ -42,8 +42,13 @@ sub read_crypttab {
}
}
-sub save_crypttab {
+sub read_crypttab {
my ($all_hds) = @_;
+ read_crypttab_($all_hds, _crypttab());
+}
+
+sub save_crypttab_ {
+ my ($all_hds, $crypttab) = @_;
my @raw_parts = grep { $_->{dm_name} } fs::get::really_all_fstab($all_hds) or return;
@@ -57,7 +62,12 @@ sub save_crypttab {
if (eof) {
$_ .= join('', map { "$_ $names{$_}\n" } sort keys %names);
}
- } _crypttab();
+ } $crypttab;
+}
+
+sub save_crypttab {
+ my ($all_hds) = @_;
+ save_crypttab_($all_hds, _crypttab());
}
sub format_part {