diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/common.pm | 10 | ||||
-rw-r--r-- | perl-install/devices.pm | 11 | ||||
-rw-r--r-- | perl-install/fsedit.pm | 24 | ||||
-rw-r--r-- | perl-install/install2.pm | 4 | ||||
-rw-r--r-- | perl-install/partition_table.pm | 8 |
5 files changed, 24 insertions, 33 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm index 77567726a..449efb922 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -116,6 +116,7 @@ sub translate { my ($s) = @_; unless (defined %po::I18N::I18N) { if (my ($lang) = substr($ENV{LC_ALL} || $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LANG} || '', 0, 2)) { + local $@; local $SIG{__DIE__} = 'none'; eval { require "po/$lang.pm" }; } @@ -133,12 +134,13 @@ sub warp_text($;$) { my ($text, $width) = shift; $width ||= 80; - my ($t, @l); foreach (split /(\s+)/, $text) { - if (length "$t$_" > $width) { + my ($t, @l); foreach (split /\s+/, $text) { + if (length "$t $_" > $width) { push @l, $t; - $t = ''; + $t = $_; + } else { + $t = "$t $_"; } - $t .= $_; } @l, $t; } diff --git a/perl-install/devices.pm b/perl-install/devices.pm index ac72bc3ed..7932eb21b 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -38,13 +38,16 @@ sub size($) { sub make($) { local $_ = my $file = $_[0]; my ($type, $major, $minor); - my ($prefix); + my $prefix = ''; - unless (s,^(.*)/(dev|tmp)/,,) { + if (m,^(.*)/(dev|tmp)/(.*),) { $prefix = $1; - $file = -e "$prefix/dev/$file" ? "$prefix/dev/$file" : "$prefix/tmp/$file"; + $_ = $3; + } elsif (m,/,) { + die "can't make device $file"; } - + $file = "$prefix/dev/$_"; + -e $file or $file = "$prefix/tmp/$_"; -e $file and return $file; # assume nobody takes fun at creating files named as device if (/^sd(.)(\d{0,2})/) { diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 8edde60bc..ac2126339 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -29,7 +29,7 @@ my @suggestions_mntpoints = qw(/mnt/dos); sub suggestions_mntpoint($) { my ($hds) = @_; - @suggestions_mntpoints, grep { !/swap/ && !has_mntpoint($_, $hds) } map { $_->{mntpoint} } @suggestions; + sort @suggestions_mntpoints, grep { !/swap/ && !has_mntpoint($_, $hds) } map { $_->{mntpoint} } @suggestions; } sub hds($$) { @@ -228,33 +228,17 @@ sub undo($) { } } -sub verify_room { - my ($part, $hd2, $sector2) = @_; - my $free_sectors = [ 1, $hd2->{totalsectors} ]; # first sector is always occupied by the MBR - my $remove = sub { removeFromList($_[0]->{start}, $_[0]->{start} + $_[0]->{size}, $free_sectors) }; - - $_ eq $part or &$remove($_) foreach get_fstab($hd2); - - for (my $i = 0; $i < @$free_sectors; $i += 2) { - $sector2 < $free_sectors->[$i] && $sector2 < $free_sectors->[$i + 1] or next; - $sector2 + $part->{size} < $free_sectors->[$i + 1] or die -_("Not enough place to move (%dGb, should be %dGb)", ($free_sectors->[$i + 1] - $free_sectors->[$i]), $part->{size} >> 11); - return; - } - die _("There is already a partition there"); -} - sub move { my ($hd, $part, $hd2, $sector2) = @_; my $part2 = { %$part }; $part2->{start} = $sector2; + $part2->{size} += partition_table::cylinder_size($hd2); partition_table::remove($hd, $part); { - local ($part2->{notFormatted}, $part2->{isFormatted}); # do not allow partition::add to change this - partition_table::add($hd2, $part2); + local ($part2->{notFormatted}, $part2->{isFormatted}); # do not allow partition::add to change this + partition_table::add($hd2, $part2); } - verify_room($part, $hd2, $part2->{start}); return if $part2->{notFormatted} && !$part2->{isFormatted} || $::testing; diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 41b4e3a65..5a771acb7 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -221,8 +221,8 @@ sub main { $SIG{__DIE__} = sub { chomp $_[0]; log::l("ERROR: $_[0]") }; # if this fails, it's okay -- it might help with free space though - unlink "/sbin/install"; - unlink "/sbin/insmod"; + unlink "/sbin/install" unless $::testing; + unlink "/sbin/insmod" unless $::testing; print STDERR "in second stage install\n"; log::openLog(($::testing || $o->{localInstall}) && 'debug.log'); diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index a4bb4bbb8..861c657e2 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -118,9 +118,11 @@ sub adjustStart($$) { sub adjustEnd($$) { my ($hd, $part) = @_; my $end = $part->{start} + $part->{size}; - - $end = round_down($end, cylinder_size($hd)); - $part->{size} = $end - $part->{start}; + my $end2 = round_down($end, cylinder_size($hd)); + unless ($part->{start} < $end2) { + $end2 = round_up($end, cylinder_size($hd)); + } + $part->{size} = $end2 - $part->{start}; } sub adjustStartAndEnd($$) { &adjustStart; |