diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-12-03 14:08:15 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-12-03 14:08:15 +0000 |
commit | 64cee0c9b9652b4fc0f497585e6c264614676d25 (patch) | |
tree | 3032bdc638475dc83e7ed49e5de3f76a44632bde | |
parent | 0f0c31cf5c3e5ddba06c1d67aeb9b2a43506a460 (diff) | |
download | drakx-64cee0c9b9652b4fc0f497585e6c264614676d25.tar drakx-64cee0c9b9652b4fc0f497585e6c264614676d25.tar.gz drakx-64cee0c9b9652b4fc0f497585e6c264614676d25.tar.bz2 drakx-64cee0c9b9652b4fc0f497585e6c264614676d25.tar.xz drakx-64cee0c9b9652b4fc0f497585e6c264614676d25.zip |
use output()
-rw-r--r-- | perl-install/raid.pm | 27 |
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 { |