summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/bootloader.pm2
-rw-r--r--perl-install/common.pm11
-rw-r--r--perl-install/fsedit.pm17
3 files changed, 25 insertions, 5 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index ab4dbcc69..fb52af824 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -770,7 +770,7 @@ sub write_grub_config {
}
my $bootIsReiser = isThisFs("reiserfs", fsedit::get_root($fstab, 'boot'));
my $file2grub = sub {
- my ($part, $file) = fsedit::file2part($prefix, $fstab, $_[0]);
+ my ($part, $file) = fsedit::file2part($prefix, $fstab, $_[0], 'keep_simple_symlinks');
dev2grub($part->{device}, \%dev2bios) . $file;
};
{
diff --git a/perl-install/common.pm b/perl-install/common.pm
index e08f754ee..8d8ab40dd 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -116,6 +116,17 @@ sub formatTime {
sub usingRamdisk { scalar(grep { /ram3/ } cat_("/proc/mounts")) }
+sub expand_symlinks_but_simple {
+ my ($f) = @_;
+ my $link = readlink($f);
+ my $f2 = expand_symlinks($f);
+ if ($link && $link !~ m|/|) {
+ # put back the last simple symlink
+ $f2 =~ s|\Q$link\E$|basename($f)|e;
+ }
+ $f2
+}
+
sub sync { &MDK::Common::System::sync }
#-######################################################################################
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 2c96c39fc..e0b3f3d0d 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -312,10 +312,10 @@ sub is_one_big_fat {
}
sub file2part {
- my ($prefix, $fstab, $file) = @_;
+ my ($prefix, $fstab, $file, $keep_simple_symlinks) = @_;
my $part;
- $file = expand_symlinks "$prefix$file";
+ $file = $keep_simple_symlinks ? common::expand_symlinks_but_simple("$prefix$file") : expand_symlinks("$prefix$file");
unless ($file =~ s/^$prefix//) {
my ($part) = grep { loopback::carryRootLoopback($_) } @$fstab or die;
log::l("found $part->{mntpoint}");
@@ -324,7 +324,7 @@ sub file2part {
foreach (@$fstab) {
my $m = $_->{mntpoint};
$part = $_ if
- $file =~ /^$m/ &&
+ $file =~ /^\Q$m/ &&
(!$part || length $part->{mntpoint} < length $m);
}
$part or die "file2part: not found $file";
@@ -664,7 +664,16 @@ sub verifyHds {
}
my @parts = readProcPartitions($hds);
- $ok &&= @parts == listlength(get_fstab(@$hds)) unless arch() eq "ppc";
+ foreach my $hd (@$hds) {
+ my @l1 = partition_table::get_normal_parts($hd);
+ my @l2 = grep { $_->{rootDevice} eq $hd->{device} } @parts;
+ if (int(@l1) != int(@l2) && arch() ne 'ppc') {
+ log::l(sprintf
+ "/proc/partitions doesn't agree with drakx %d != %d:\n%s\n", int(@l1), int(@l2),
+ "/proc/partitions: " . join(", ", map { "$_->{device} ($_->{rootDevice})" } @parts));
+ $ok = 0;
+ }
+ }
if ($readonly && !$ok) {
log::l("using /proc/partitions as diskdrake failed :(");