summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-20 01:18:59 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-20 01:18:59 +0000
commite3d14963955b8e25f449bd1eb145115b20947dfd (patch)
tree19941ed8b80479a984fe54b5db685748f8442529
parentaa03c614d14d73e9cb71bd07066d3a5cb9808cc4 (diff)
downloaddraklive-install-e3d14963955b8e25f449bd1eb145115b20947dfd.tar
draklive-install-e3d14963955b8e25f449bd1eb145115b20947dfd.tar.gz
draklive-install-e3d14963955b8e25f449bd1eb145115b20947dfd.tar.bz2
draklive-install-e3d14963955b8e25f449bd1eb145115b20947dfd.tar.xz
draklive-install-e3d14963955b8e25f449bd1eb145115b20947dfd.zip
check available space before formatting and installing (#22764)
-rwxr-xr-xdraklive-install13
1 files changed, 10 insertions, 3 deletions
diff --git a/draklive-install b/draklive-install
index 7c2ab5a..ef23741 100755
--- a/draklive-install
+++ b/draklive-install
@@ -48,7 +48,7 @@ sub install_live() {
display_start_message();
init_hds($in, $all_hds, $fstab);
- ask_partitions_loop($in, $all_hds, $fstab);
+ ask_partitions_loop($in, $all_hds, $fstab, $copy_source);
prepare_root($in, $all_hds);
copy_root($in, $copy_source);
complete_install($in, $all_hds);
@@ -111,7 +111,7 @@ sub init_hds {
}
sub ask_partitions_loop {
- my ($in, $all_hds, $fstab) = @_;
+ my ($in, $all_hds, $fstab, $copy_source) = @_;
while (1) {
eval { ask_partitions($in, $all_hds, $fstab) };
@@ -122,7 +122,7 @@ sub ask_partitions_loop {
}
sub ask_partitions {
- my ($in, $all_hds, $fstab) = @_;
+ my ($in, $all_hds, $fstab, $copy_source) = @_;
fs::partitioning_wizard::main($in, $all_hds, $fstab, [], undef, {}, 'skip_mtab');
mkdir_p($::prefix) or die "unable to create $::prefix";
@@ -131,6 +131,13 @@ sub ask_partitions {
fs::any::check_hds_boot_and_root($all_hds, $fstab);
fs::partitioning::choose_partitions_to_format($in, $fstab);
umount_all($fstab);
+
+ my $total = get_total_size($in, $copy_source);
+ my $available = fs::any::getAvailableSpace($fstab, 'skip_mounted');
+ die N("Not enough space available (%s available while %s are needed)",
+ formatXiB($available), formatXiB($total)) . "\n"
+ if $total > $available;
+
fs::partitioning::format_mount_partitions($in, $all_hds, $fstab);
}