summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-11-25 10:03:19 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-11-25 10:03:19 +0000
commit72fcfbeaf426f128db816990078cb1608ca86521 (patch)
tree5d44535ccc474cf2ace0d2375cba1ef9b5ce9087 /perl-install
parent995cdef0083d0ab36b4fd3c14a6c4403c74fccd0 (diff)
downloaddrakx-72fcfbeaf426f128db816990078cb1608ca86521.tar
drakx-72fcfbeaf426f128db816990078cb1608ca86521.tar.gz
drakx-72fcfbeaf426f128db816990078cb1608ca86521.tar.bz2
drakx-72fcfbeaf426f128db816990078cb1608ca86521.tar.xz
drakx-72fcfbeaf426f128db816990078cb1608ca86521.zip
more intelligent sort of fstab to handle loopback files or bind directory (bug anthil #1198)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/fs.pm25
1 files changed, 22 insertions, 3 deletions
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index ea5bc8222..47b290fd5 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -167,7 +167,7 @@ sub subpart_from_wild_device_name {
}
return \%part;
} elsif ($dev =~ m!^/! && -f "$::prefix$dev") {
- #- loopback file
+ #- loopback file or directory to bind
} else {
log::l("part_from_wild_device_name: unknown device $dev");
}
@@ -307,13 +307,32 @@ sub prepare_write_fstab {
$fs_type = 'auto' if $fs_type =~ /:/;
}
- [ $mntpoint, $_->{comment} . join(' ', $dev, $mntpoint, $fs_type, $options || 'defaults', $freq, $passno) . "\n" ];
+ my $file_dep = $options =~ /\b(loop|bind)\b/ ? $dev : '';
+
+ [ $file_dep, $mntpoint, $_->{comment} . join(' ', $dev, $mntpoint, $fs_type, $options || 'defaults', $freq, $passno) . "\n" ];
} else {
();
}
} grep { $_->{device} && ($_->{mntpoint} || $_->{real_mntpoint}) && $_->{fs_type} && ($_->{isFormatted} || !$_->{notFormatted}) } @$fstab;
- join('', map { $_->[1] } sort { $a->[0] cmp $b->[0] } @l), \@smb_credentials;
+ sub sort_it {
+ my (@l) = @_;
+
+ if (my $file_based = find { $_->[0] } @l) {
+ my ($before, $other) = partition { $file_based->[0] =~ /^\Q$_->[1]/ } @l;
+ $file_based->[0] = ''; #- all dependencies are now in before
+ if (@$other && @$before) {
+ sort_it(@$before), sort_it(@$other);
+ } else {
+ sort_it(@l);
+ }
+ } else {
+ sort { $a->[1] cmp $b->[1] } @l;
+ }
+ }
+ @l = sort_it(@l);
+
+ join('', map { $_->[2] } @l), \@smb_credentials;
}
sub fstab_to_string {