summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/patch/patch-2006-existing-md.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/perl-install/patch/patch-2006-existing-md.pl b/perl-install/patch/patch-2006-existing-md.pl
new file mode 100644
index 000000000..ab30146d3
--- /dev/null
+++ b/perl-install/patch/patch-2006-existing-md.pl
@@ -0,0 +1,14 @@
+log::l("PATCH: 2006-existing-md");
+
+use raid;
+package raid;
+
+undef *get_md_info;
+*get_md_info = sub {
+ my ($dev) = @_;
+ my $conf = parse_mdadm_conf(scalar run_program::get_stdout('mdadm', '--detail', '--brief', '-v', $dev));
+
+ @{$conf->{ARRAY}} or return;
+ @{$conf->{ARRAY}} == 1 or internal_error("too many answers");
+ $conf->{ARRAY}[0];
+};