summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-20 01:17:08 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-20 01:17:08 +0000
commit440ffe22ded3de7604e00d6c98e24e1069ebf378 (patch)
tree169acc31381d5d8f8fbb216a42aa3148d0d52d59 /perl-install
parent4f441032f26c8334c49969ac7eaa37752c1250ee (diff)
downloaddrakx-backup-do-not-use-440ffe22ded3de7604e00d6c98e24e1069ebf378.tar
drakx-backup-do-not-use-440ffe22ded3de7604e00d6c98e24e1069ebf378.tar.gz
drakx-backup-do-not-use-440ffe22ded3de7604e00d6c98e24e1069ebf378.tar.bz2
drakx-backup-do-not-use-440ffe22ded3de7604e00d6c98e24e1069ebf378.tar.xz
drakx-backup-do-not-use-440ffe22ded3de7604e00d6c98e24e1069ebf378.zip
move functions to get available space from installer to drakxtools (to be used in draklive-install)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS2
-rw-r--r--perl-install/fs/any.pm35
-rw-r--r--perl-install/install/any.pm32
-rw-r--r--perl-install/install/media.pm2
4 files changed, 39 insertions, 32 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 9488b9252..611434e3f 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -4,6 +4,8 @@
o do not configure network if already up
o allow to use a simplified time step
(no timezone selection, ntp settings as advanced)
+- move functions to get available space from installer
+ (to be used in draklive-install)
Version 10.16.1 - 18 March 2008
diff --git a/perl-install/fs/any.pm b/perl-install/fs/any.pm
index d523a6943..730252b40 100644
--- a/perl-install/fs/any.pm
+++ b/perl-install/fs/any.pm
@@ -104,4 +104,39 @@ sub prepare_minimal_root {
}
}
+sub getAvailableSpace {
+ my ($fstab) = @_;
+
+ #- make sure of this place to be available for installation, this could help a lot.
+ #- currently doing a very small install use 36Mb of postinstall-rpm, but installing
+ #- these packages may eat up to 90Mb (of course not all the server may be installed!).
+ #- 65mb may be a good choice to avoid almost all problem of insuficient space left...
+ my $minAvailableSize = 65 * sqr(1024);
+
+ my $n = !$::testing && getAvailableSpace_mounted($::prefix) ||
+ getAvailableSpace_raw($fstab) * 512 / 1.07;
+ $n - max(0.1 * $n, $minAvailableSize);
+}
+
+sub getAvailableSpace_mounted {
+ my ($prefix) = @_;
+ my $dir = -d "$prefix/usr" ? "$prefix/usr" : $prefix;
+ my (undef, $free) = MDK::Common::System::df($dir) or return;
+ log::l("getAvailableSpace_mounted $free KB");
+ $free * 1024 || 1;
+}
+sub getAvailableSpace_raw {
+ my ($fstab) = @_;
+
+ do { $_->{mntpoint} eq '/usr' and return $_->{size} } foreach @$fstab;
+ do { $_->{mntpoint} eq '/' and return $_->{size} } foreach @$fstab;
+
+ if ($::testing) {
+ my $nb = 450;
+ log::l("taking ${nb}MB for testing");
+ return MB($nb);
+ }
+ die "missing root partition";
+}
+
1;
diff --git a/perl-install/install/any.pm b/perl-install/install/any.pm
index a663d30f3..fce0e0274 100644
--- a/perl-install/install/any.pm
+++ b/perl-install/install/any.pm
@@ -84,37 +84,7 @@ cant_spawn:
sub getAvailableSpace {
my ($o) = @_;
-
- #- make sure of this place to be available for installation, this could help a lot.
- #- currently doing a very small install use 36Mb of postinstall-rpm, but installing
- #- these packages may eat up to 90Mb (of course not all the server may be installed!).
- #- 65mb may be a good choice to avoid almost all problem of insuficient space left...
- my $minAvailableSize = 65 * sqr(1024);
-
- my $n = !$::testing && getAvailableSpace_mounted($::prefix) ||
- getAvailableSpace_raw($o->{fstab}) * 512 / 1.07;
- $n - max(0.1 * $n, $minAvailableSize);
-}
-
-sub getAvailableSpace_mounted {
- my ($prefix) = @_;
- my $dir = -d "$prefix/usr" ? "$prefix/usr" : $prefix;
- my (undef, $free) = MDK::Common::System::df($dir) or return;
- log::l("getAvailableSpace_mounted $free KB");
- $free * 1024 || 1;
-}
-sub getAvailableSpace_raw {
- my ($fstab) = @_;
-
- do { $_->{mntpoint} eq '/usr' and return $_->{size} } foreach @$fstab;
- do { $_->{mntpoint} eq '/' and return $_->{size} } foreach @$fstab;
-
- if ($::testing) {
- my $nb = 450;
- log::l("taking ${nb}MB for testing");
- return MB($nb);
- }
- die "missing root partition";
+ fs::any::getAvailableSpace($o->{fstab});
}
sub preConfigureTimezone {
diff --git a/perl-install/install/media.pm b/perl-install/install/media.pm
index cc3f79ee3..09837c3b1 100644
--- a/perl-install/install/media.pm
+++ b/perl-install/install/media.pm
@@ -462,7 +462,7 @@ sub allow_copy_rpms_on_disk {
my $totalsize = sum(map { $_->{size} } @$hdlists) || -1; #- don't check size, total medium size unknown
if ($totalsize >= 0) {
- my $availvar = install::any::getAvailableSpace_mounted("$::prefix/var");
+ my $availvar = fs::any::getAvailableSpace_mounted("$::prefix/var");
$availvar /= 1024 * 1024; #- Mo
log::l("totalsize=$totalsize, avail on $::prefix/var=$availvar");
$totalsize < $availvar * 0.6;