summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS4
-rw-r--r--perl-install/common.pm9
-rw-r--r--perl-install/diskdrake/interactive.pm25
-rw-r--r--perl-install/fs/partitioning_wizard.pm32
-rw-r--r--perl-install/fs/type.pm4
-rw-r--r--perl-install/fsedit.pm30
-rw-r--r--perl-install/install/NEWS2
-rw-r--r--perl-install/install/any.pm2
-rw-r--r--perl-install/install/steps_interactive.pm2
9 files changed, 65 insertions, 45 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 6ed0c86cd..fe2836d59 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,4 +1,6 @@
-- diskdrake: add support for "nodiratime" mount option
+- diskdrake:
+ o add support for "nodiratime" mount option
+ o fix range max value >2TB when creating a partition (useful for LVs >2TB)
- drakxservices: describe a few more services (#18612)
Version 10.4.159 - 06 August 2007, by Thierry Vignaud
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 10d762272..5ad572b5b 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -10,7 +10,7 @@ use run_program;
use Exporter;
our @ISA = qw(Exporter);
-our @EXPORT = qw($SECTORSIZE N P N_ check_for_xserver files_exist formatTime formatXiB makedev mandrake_release mandrake_release_info removeXiBSuffix require_root_capability setVirtual set_alternative set_l10n_sort set_permissions translate unmakedev);
+our @EXPORT = qw($SECTORSIZE N P N_ check_for_xserver files_exist formatTime MB formatXiB makedev mandrake_release mandrake_release_info removeXiBSuffix require_root_capability setVirtual set_alternative set_l10n_sort set_permissions translate unmakedev);
# perl_checker: RE-EXPORT-ALL
push @EXPORT, @MDK::Common::EXPORT;
@@ -111,6 +111,13 @@ sub nonblock {
fcntl($F, c::F_SETFL(), fcntl($F, c::F_GETFL(), 0) | c::O_NONBLOCK()) or die "can not fcntl F_SETFL: $!";
}
+#- return a size in sector
+#- ie MB(1) is 2048 sectors, which is 1MB
+sub MB {
+ my ($nb_MB) = @_;
+ $nb_MB * 2048;
+}
+
sub removeXiBSuffix {
local $_ = shift;
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index a98f402b0..6307a3bc5 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -485,7 +485,7 @@ sub Create {
#- one.
my ($primaryOrExtended, $migrate_files);
my $type_name = fs::type::part2type_name($part);
- my $mb_size = $part->{size} >> 11;
+ my $mb_size = to_Mb($part->{size});
my $has_startsector = ($::expert || arch() !~ /i.86/) && !isLVM($hd);
$in->ask_from(N("Create a new partition"), '',
@@ -493,10 +493,10 @@ sub Create {
{ label => N("Create a new partition"), title => 1 },
if_($has_startsector,
{ label => N("Start sector: "), val => \$part->{start}, min => $def_start, max => ($max - min_partition_size($hd)),
- type => 'range', SpinButton => $::expert, changed => sub { $mb_size = min($mb_size, ($max - $part->{start}) >> 11) } },
+ type => 'range', SpinButton => $::expert, changed => sub { $mb_size = min($mb_size, to_Mb($max - $part->{start})) } },
),
- { label => N("Size in MB: "), val => \$mb_size, min => min_partition_size($hd) >> 11, max => $def_size >> 11,
- type => 'range', SpinButton => $::expert, changed => sub { $part->{start} = min($part->{start}, $max - ($mb_size << 11)) } },
+ { label => N("Size in MB: "), val => \$mb_size, min => to_Mb(min_partition_size($hd)), max => to_Mb($def_size),
+ type => 'range', SpinButton => $::expert, changed => sub { $part->{start} = min($part->{start}, $max - $mb_size * 2048) } },
{ label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert) ],
sort => 0, if_($::expert, gtk => { wrap_width => 4 }) },
{ label => N("Mount point: "), val => \$part->{mntpoint}, list => [ fsedit::suggestions_mntpoint($all_hds), '' ],
@@ -751,8 +751,8 @@ sub Resize {
}
}
- my $mb_size = $part->{size} >> 11;
- my ($gmin, $gmax) = ($min >> 11, $max >> 11);
+ my $mb_size = to_Mb($part->{size});
+ my ($gmin, $gmax) = (to_Mb($min), to_Mb($max));
$in->ask_from(N("Resize"), '', [
{ label => N("Choose the new size"), title => 1 },
{ label => N("New size in MB: "), val => \$mb_size, min => $gmin, max => $gmax, type => 'range', SpinButton => $::expert },
@@ -923,10 +923,10 @@ sub Loopback {
delete $part->{mntpoint}; # we do not want the suggested mntpoint
my $type_name = fs::type::part2type_name($part);
- my $mb_size = $part->{size} >> 11;
+ my $mb_size = to_Mb($part->{size});
$in->ask_from(N("Loopback"), '', [
{ label => N("Loopback file name: "), val => \$part->{loopback_file} },
- { label => N("Size in MB: "), val => \$mb_size, min => $min >> 11, max => $max >> 11, type => 'range', SpinButton => $::expert },
+ { label => N("Size in MB: "), val => \$mb_size, min => to_Mb($min), max => to_Mb($max), type => 'range', SpinButton => $::expert },
{ label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert) ], not_edit => !$::expert, sort => 0 },
],
complete => sub {
@@ -1212,11 +1212,16 @@ sub warn_if_renumbered {
#- modified to take into account a true bounding with min and max.
sub from_Mb {
my ($mb, $min, $max) = @_;
- $mb <= $min >> 11 and return $min;
- $mb >= $max >> 11 and return $max;
+ $mb <= to_Mb($min) and return $min;
+ $mb >= to_Mb($max) and return $max;
$mb * 2048;
}
+sub to_Mb {
+ my ($size_sector) = @_;
+ to_int($size_sector / 2048);
+}
+
sub format_part_info {
my ($hd, $part) = @_;
diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm
index d833f5b26..4aff222c7 100644
--- a/perl-install/fs/partitioning_wizard.pm
+++ b/perl-install/fs/partitioning_wizard.pm
@@ -18,9 +18,13 @@ use partition_table::raw;
#- modified to take into account a true bounding with min and max.
sub from_Mb {
my ($mb, $min, $max) = @_;
- $mb <= $min >> 11 and return $min;
- $mb >= $max >> 11 and return $max;
- $mb * 2048;
+ $mb <= to_Mb($min) and return $min;
+ $mb >= to_Mb($max) and return $max;
+ MB($mb);
+}
+sub to_Mb {
+ my ($size_sector) = @_;
+ to_int($size_sector / 2048);
}
sub partition_with_diskdrake {
@@ -66,11 +70,11 @@ sub partitionWizardSolutions {
my @wizlog;
my (%solutions);
- my $min_linux = 400 << 11;
- my $max_linux = 2000 << 11;
- my $min_swap = 50 << 11;
- my $max_swap = 300 << 11;
- my $min_freewin = 100 << 11;
+ my $min_linux = MB(400);
+ my $max_linux = MB(2000);
+ my $min_swap = MB(50);
+ my $max_swap = MB(300);
+ my $min_freewin = MB(100);
# each solution is a [ score, text, function ], where the function retunrs true if succeeded
@@ -102,12 +106,12 @@ sub partitionWizardSolutions {
my $part = $in->ask_from_listf('', N("Which partition do you want to use for Linux4Win?"), \&partition_table::description, \@ok_forloopback) or return;
$max_swap = $min_swap + 1 if $part->{free} - $max_swap < $min_linux;
$in->ask_from('', N("Choose the sizes"), [
- { label => N("Root partition size in MB: "), val => \$s_root, min => $min_linux >> 11, max => min($part->{free} - $max_swap, $max_linux) >> 11, type => 'range' },
- { label => N("Swap partition size in MB: "), val => \$s_swap, min => $min_swap >> 11, max => $max_swap >> 11, type => 'range' },
+ { label => N("Root partition size in MB: "), val => \$s_root, min => to_Mb($min_linux), max => to_Mb(min($part->{free} - $max_swap, $max_linux)), type => 'range' },
+ { label => N("Swap partition size in MB: "), val => \$s_swap, min => to_Mb($min_swap), max => to_Mb($max_swap), type => 'range' },
]) or return;
push @{$part->{loopback}},
- { fs_type => 'ext3', loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => $s_root << 11, loopback_device => $part, notFormatted => 1 },
- { fs_type => 'swap', loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => $s_swap << 11, loopback_device => $part, notFormatted => 1 };
+ { fs_type => 'ext3', loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => $s_root * 2048, loopback_device => $part, notFormatted => 1 },
+ { fs_type => 'swap', loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => $s_swap * 2048, loopback_device => $part, notFormatted => 1 };
fsedit::recompute_loopbacks($all_hds);
1;
} ];
@@ -159,9 +163,9 @@ Be careful: this operation is dangerous. If you have not already done so, you fi
When sure, press %s.", N("Next")))) or return;
- my $mb_size = $part->{size} >> 11;
+ my $mb_size = to_Mb($part->{size});
$in->ask_from('', N("Which size do you want to keep for Microsoft Windows® on partition %s?", partition_table::description($part)), [
- { label => N("Size"), val => \$mb_size, min => $min_win >> 11, max => ($part->{size} - $min_linux - $min_swap) >> 11, type => 'range' },
+ { label => N("Size"), val => \$mb_size, min => to_Mb($min_win), max => to_Mb($part->{size} - $min_linux - $min_swap), type => 'range' },
]) or return;
my $oldsize = $part->{size};
diff --git a/perl-install/fs/type.pm b/perl-install/fs/type.pm
index 2abb61918..63ef3e475 100644
--- a/perl-install/fs/type.pm
+++ b/perl-install/fs/type.pm
@@ -364,8 +364,8 @@ sub set_isFormatted {
#- do this before modifying $part->{fs_type}
sub check {
my ($fs_type, $_hd, $part) = @_;
- $fs_type eq "jfs" && $part->{size} < 16 << 11 and die N("You can not use JFS for partitions smaller than 16MB");
- $fs_type eq "reiserfs" && $part->{size} < 32 << 11 and die N("You can not use ReiserFS for partitions smaller than 32MB");
+ $fs_type eq "jfs" && $part->{size} < MB(16) and die N("You can not use JFS for partitions smaller than 16MB");
+ $fs_type eq "reiserfs" && $part->{size} < MB(32) and die N("You can not use ReiserFS for partitions smaller than 32MB");
}
sub guessed_by_mount() {
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 61951756a..91aee2f0d 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -21,26 +21,26 @@ use fs;
%suggestions = (
N_("simple") => [
- { mntpoint => "/", size => 300 << 11, fs_type => 'ext3', ratio => 5, maxsize => 8000 << 11 },
- { mntpoint => "swap", size => 64 << 11, fs_type => 'swap', ratio => 1, maxsize => 4000 << 11 },
- { mntpoint => "/home", size => 300 << 11, fs_type => 'ext3', ratio => 3 },
+ { mntpoint => "/", size => MB(300), fs_type => 'ext3', ratio => 5, maxsize => MB(8000) },
+ { mntpoint => "swap", size => MB(64), fs_type => 'swap', ratio => 1, maxsize => MB(4000) },
+ { mntpoint => "/home", size => MB(300), fs_type => 'ext3', ratio => 3 },
], N_("with /usr") => [
- { mntpoint => "/", size => 250 << 11, fs_type => 'ext3', ratio => 1, maxsize => 4000 << 11 },
- { mntpoint => "swap", size => 64 << 11, fs_type => 'swap', ratio => 1, maxsize => 4000 << 11 },
- { mntpoint => "/usr", size => 300 << 11, fs_type => 'ext3', ratio => 4, maxsize => 8000 << 11 },
- { mntpoint => "/home", size => 100 << 11, fs_type => 'ext3', ratio => 3 },
+ { mntpoint => "/", size => MB(250), fs_type => 'ext3', ratio => 1, maxsize => MB(4000) },
+ { mntpoint => "swap", size => MB(64), fs_type => 'swap', ratio => 1, maxsize => MB(4000) },
+ { mntpoint => "/usr", size => MB(300), fs_type => 'ext3', ratio => 4, maxsize => MB(8000) },
+ { mntpoint => "/home", size => MB(100), fs_type => 'ext3', ratio => 3 },
], N_("server") => [
- { mntpoint => "/", size => 150 << 11, fs_type => 'ext3', ratio => 1, maxsize => 4000 << 11 },
- { mntpoint => "swap", size => 64 << 11, fs_type => 'swap', ratio => 2, maxsize => 4000 << 11 },
- { mntpoint => "/usr", size => 300 << 11, fs_type => 'ext3', ratio => 4, maxsize => 8000 << 11 },
- { mntpoint => "/var", size => 200 << 11, fs_type => 'ext3', ratio => 3 },
- { mntpoint => "/home", size => 150 << 11, fs_type => 'ext3', ratio => 3 },
- { mntpoint => "/tmp", size => 150 << 11, fs_type => 'ext3', ratio => 2, maxsize => 4000 << 11 },
+ { mntpoint => "/", size => MB(150), fs_type => 'ext3', ratio => 1, maxsize => MB(4000) },
+ { mntpoint => "swap", size => MB(64), fs_type => 'swap', ratio => 2, maxsize => MB(4000) },
+ { mntpoint => "/usr", size => MB(300), fs_type => 'ext3', ratio => 4, maxsize => MB(8000) },
+ { mntpoint => "/var", size => MB(200), fs_type => 'ext3', ratio => 3 },
+ { mntpoint => "/home", size => MB(150), fs_type => 'ext3', ratio => 3 },
+ { mntpoint => "/tmp", size => MB(150), fs_type => 'ext3', ratio => 2, maxsize => MB(4000) },
],
);
foreach (values %suggestions) {
if (arch() =~ /ia64/) {
- @$_ = ({ mntpoint => "/boot/efi", size => 50 << 11, pt_type => 0xef, ratio => 1, maxsize => 150 << 11 }, @$_);
+ @$_ = ({ mntpoint => "/boot/efi", size => MB(50), pt_type => 0xef, ratio => 1, maxsize => MB(150) }, @$_);
}
}
@@ -296,7 +296,7 @@ sub is_one_big_fat_or_NT {
@$hds == 1 or return 0;
my @l = fs::get::hds_fstab(@$hds);
- @l == 1 && isFat_or_NTFS($l[0]) && fs::get::hds_free_space(@$hds) < 10 << 11;
+ @l == 1 && isFat_or_NTFS($l[0]) && fs::get::hds_free_space(@$hds) < MB(10);
}
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index d03d07e3a..647d3bcef 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,3 +1,5 @@
+- fix range max value >2TB when creating a partition (useful for LVs >2TB)
+
Version 10.4.158 - 3 August 2007, by Pascal "Pixel" Rigaux
- configure removable writable media to use "flush" option instead of "sync" (#23042)
diff --git a/perl-install/install/any.pm b/perl-install/install/any.pm
index 956f1adff..6a6bb3d4c 100644
--- a/perl-install/install/any.pm
+++ b/perl-install/install/any.pm
@@ -132,7 +132,7 @@ sub getAvailableSpace_raw {
if ($::testing) {
my $nb = 450;
log::l("taking ${nb}MB for testing");
- return $nb << 11;
+ return MB($nb);
}
die "missing root partition";
}
diff --git a/perl-install/install/steps_interactive.pm b/perl-install/install/steps_interactive.pm
index 5a1deb0b3..3f8e9bd0f 100644
--- a/perl-install/install/steps_interactive.pm
+++ b/perl-install/install/steps_interactive.pm
@@ -212,7 +212,7 @@ sub doPartitionDisks {
log::l("creating bootstrap partition on drive /dev/$freepart->{hd}{device}, block $freepart->{start}");
$partition_table::mac::bootstrap_part = $freepart->{part};
log::l("bootstrap now at $partition_table::mac::bootstrap_part");
- my $p = { start => $freepart->{start}, size => 1 << 11, mntpoint => '' };
+ my $p = { start => $freepart->{start}, size => MB(1), mntpoint => '' };
fs::type::set_pt_type($p, 0x401);
fsedit::add($freepart->{hd}, $p, $o->{all_hds}, { force => 1, primaryOrExtended => 'Primary' });
$partition_table::mac::new_bootstrap = 1;