summaryrefslogtreecommitdiffstats
path: root/perl-install/fs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-02-22 14:16:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-02-22 14:16:14 +0000
commit53678cd608bbb325166f0af1affdbf0288b6d8e9 (patch)
tree0df4eaef1bf6c2cf625cae83dbf5ff666be7a0bb /perl-install/fs.pm
parentd98b056a1e6b58d598364089dd1c4660468c36a0 (diff)
downloaddrakx-53678cd608bbb325166f0af1affdbf0288b6d8e9.tar
drakx-53678cd608bbb325166f0af1affdbf0288b6d8e9.tar.gz
drakx-53678cd608bbb325166f0af1affdbf0288b6d8e9.tar.bz2
drakx-53678cd608bbb325166f0af1affdbf0288b6d8e9.tar.xz
drakx-53678cd608bbb325166f0af1affdbf0288b6d8e9.zip
(write_fstab): clean-up, $fstab takes precedence over @to_add, but not
over existing /etc/fstab. Fix some stupid stuff
Diffstat (limited to 'perl-install/fs.pm')
-rw-r--r--perl-install/fs.pm83
1 files changed, 40 insertions, 43 deletions
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index ee35ceb8d..5f4e1ce95 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -375,49 +375,46 @@ sub write_fstab($;$$) {
my ($fstab, $prefix, @to_add) = @_;
$prefix ||= '';
- #- get the list of devices and mntpoint to remove existing entries
- #- and @to_add take precedence over $fstab to handle removable device
- #- if they are mounted OR NOT during install.
- my @new = grep { $_ ne 'none' } map { @$_[0,1] } @to_add;
- my %new; @new{@new} = undef;
-
- unshift @to_add,
- grep {
- my $b = !exists $new{$_->[0]} && !exists $new{$_->[1]};
- #- keep in mind the new line for fstab.
- @new{@$_[0,1]} = undef;
- $b
- } map {
- my ($dir, $options, $freq, $passno) = qw(/dev/ defaults 0 0);
- $options = $_->{options} || $options;
-
- isTrueFS($_) and ($freq, $passno) = (1, ($_->{mntpoint} eq '/') ? 1 : 2);
- isNfs($_) and $dir = '', $options = $_->{options} || 'ro,nosuid,rsize=8192,wsize=8192';
- isFat($_) and $options = $_->{options} || "user,exec,umask=0";
-
- isReiserfs($_) && $_ == fsedit::get_root($fstab, 'boot') and add_options($options, "notail");
-
- my $dev = isLoopback($_) ?
- ($_->{mntpoint} eq '/' ? "/initrd/loopfs$_->{loopback_file}" : loopback::file($_)) :
- ($_->{device} =~ /^\// ? $_->{device} : "$dir$_->{device}");
-
- local $_->{mntpoint} = do {
- $passno = 0;
- "/initrd/loopfs";
- } if loopback::carryRootLoopback($_);
-
- add_options($options, "loop") if isLoopback($_) && !isSwap($_); #- no need for loop option for swap files
-
- eval { devices::make("$prefix/$dev") } if $dir && !isLoopback($_);
- mkdir "$prefix/$_->{mntpoint}", 0755 if $_->{mntpoint} && !isSwap($_);
-
- [ $dev, $_->{mntpoint}, type2fs($_->{type}), $options, $freq, $passno ];
-
- } grep { $_->{mntpoint} && type2fs($_->{type}) } @$fstab;
-
- push @to_add,
- grep { !exists $new{$_->[0]} && !exists $new{$_->[1]} }
- map { [ split ] } cat_("$prefix/etc/fstab");
+ unshift @to_add, map {
+ my ($dir, $options, $freq, $passno) = qw(/dev/ defaults 0 0);
+ $options = $_->{options} || $options;
+
+ isTrueFS($_) and ($freq, $passno) = (1, ($_->{mntpoint} eq '/') ? 1 : 2);
+ isNfs($_) and $dir = '', $options = $_->{options} || 'ro,nosuid,rsize=8192,wsize=8192';
+ isFat($_) and $options = $_->{options} || "user,exec,umask=0";
+
+ isReiserfs($_) && $_ == fsedit::get_root($fstab, 'boot') and add_options($options, "notail");
+
+ my $dev = isLoopback($_) ?
+ ($_->{mntpoint} eq '/' ? "/initrd/loopfs$_->{loopback_file}" : loopback::file($_)) :
+ ($_->{device} =~ /^\// ? $_->{device} : "$dir$_->{device}");
+
+ local $_->{mntpoint} = do {
+ $passno = 0;
+ "/initrd/loopfs";
+ } if loopback::carryRootLoopback($_);
+
+ add_options($options, "loop") if isLoopback($_) && !isSwap($_); #- no need for loop option for swap files
+
+ eval { devices::make("$prefix/$dev") } if $dir && !isLoopback($_);
+ mkdir "$prefix/$_->{mntpoint}", 0755 if $_->{mntpoint} && !isSwap($_);
+
+ [ $dev, $_->{mntpoint}, type2fs($_->{type}), $options, $freq, $passno ];
+
+ } grep { $_->{mntpoint} && type2fs($_->{type}) } @$fstab;
+
+ push @to_add, map { [ split ] } cat_("$prefix/etc/fstab");
+
+ my %new;
+ @to_add = grep {
+ if (!$new{$_->[0]} && !$new{$_->[1]}) {
+ #- keep in mind the new line for fstab.
+ @new{$_->[0], $_->[1]} = (1, 1);
+ 1;
+ } else {
+ 0;
+ }
+ } @to_add;
log::l("writing $prefix/etc/fstab");
local *F;