summaryrefslogtreecommitdiffstats
path: root/perl-install/raid.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-12-03 14:08:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-12-03 14:08:15 +0000
commit64cee0c9b9652b4fc0f497585e6c264614676d25 (patch)
tree3032bdc638475dc83e7ed49e5de3f76a44632bde /perl-install/raid.pm
parent0f0c31cf5c3e5ddba06c1d67aeb9b2a43506a460 (diff)
downloaddrakx-backup-do-not-use-64cee0c9b9652b4fc0f497585e6c264614676d25.tar
drakx-backup-do-not-use-64cee0c9b9652b4fc0f497585e6c264614676d25.tar.gz
drakx-backup-do-not-use-64cee0c9b9652b4fc0f497585e6c264614676d25.tar.bz2
drakx-backup-do-not-use-64cee0c9b9652b4fc0f497585e6c264614676d25.tar.xz
drakx-backup-do-not-use-64cee0c9b9652b4fc0f497585e6c264614676d25.zip
use output()
Diffstat (limited to 'perl-install/raid.pm')
-rw-r--r--perl-install/raid.pm27
1 files changed, 13 insertions, 14 deletions
diff --git a/perl-install/raid.pm b/perl-install/raid.pm
index 55c542e31..3f4488ad8 100644
--- a/perl-install/raid.pm
+++ b/perl-install/raid.pm
@@ -104,23 +104,22 @@ sub update {
sub write {
my ($raids, $file) = @_;
return if $::testing;
- local $\ = "\n";
- local *F;
- open F, ">$file" or die N("Can't write file %s", $file);
- foreach (grep { $_ } @$raids) {
- print F <<EOF;
-raiddev /dev/$_->{device}
-raid-level $_->{level}
-chunk-size $_->{'chunk-size'}
+ output($file,
+ map {
+ my $s = sprintf(<<EOF, $_->{device}, $_->{level}, $_->{'chunk-size'}, int @{$_->{disks}});
+raiddev /dev/%s
+raid-level %s
+chunk-size %s
persistent-superblock 1
+nr-raid-disks %d
EOF
- print F "nr-raid-disks ", int @{$_->{disks}};
- each_index {
- print F " device ", devices::make($_->{device});
- print F " raid-disk $::i";
- } @{$_->{disks}};
- }
+ my @devs = map_index {
+ " device " . devices::make($_->{device}) . "\n raid-disk $::i\n";
+ } @{$_->{disks}};
+
+ $s, @devs
+ } grep { $_ } @$raids);
}
sub make {