summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--perl-install/ChangeLog20
-rw-r--r--perl-install/fs.pm29
-rw-r--r--perl-install/install_any.pm64
-rw-r--r--perl-install/install_steps.pm53
-rw-r--r--perl-install/install_steps_gtk.pm12
-rw-r--r--perl-install/resize_fat/main.pm17
-rwxr-xr-xrescue/tree/etc/rc.sysinit3
8 files changed, 148 insertions, 51 deletions
diff --git a/Makefile b/Makefile
index 68d370b8a..726a4dcaa 100644
--- a/Makefile
+++ b/Makefile
@@ -81,7 +81,6 @@ clean:
find . -name "*~" -o -name ".#*" | xargs rm -f
upload: clean install
-# do this on source machine: eval `ssh-agent` ; ssh-add
function upload() { rsync -qSavz --verbose --exclude '*~' -e ssh --delete $(ROOTDEST)/$$1/$$2 mandrake@kenobi:/c/cooker/$$1; } ;\
upload Mandrake/mdkinst '' ;\
upload Mandrake/base {compss*,mdkinst_stage2.gz,rescue_stage2.gz} ;\
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog
index 85d13b581..e2e37708b 100644
--- a/perl-install/ChangeLog
+++ b/perl-install/ChangeLog
@@ -1,5 +1,25 @@
2000-08-06 Pixel <pixel@mandrakesoft.com>
+ * interactive.pm (ask_from_listf): created this GREAT function
+ that should have been created a long time ago.
+ * any.pm, install_any.pm, install_steps_gtk.pm,
+ install_steps_interactive.pm: a lot of rewrite to use the new
+ ask_from_listf, a lot of nice cleanup!
+
+ * fs.pm (df): created, returns the free space of the part. Save it
+ in $part->{free}
+
+ * install_steps_gtk.pm (doPartitionDisks): ensure the closing of
+ the device in case of error
+ * resize_fat/main.pm (new): ensure the closing of the device in
+ case of error
+
+ * install_any.pm (partitionWizard): the great partitioning wizard
+ is created. Not finished yet (nor called from anywhere)
+
+ * install_steps.pm (doPartitionDisksLnx4win): created function out
+ of doPartitionDisks
+
* install_steps_gtk.pm (installPackages): removed the displaying
of size to install (people are bothered cuz not the same size)
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 9d3c38049..3d9628071 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -305,6 +305,35 @@ sub umount_all($;$) {
}
}
+sub df {
+ my ($part, $prefix) = @_;
+ my $dir = "/tmp/tmp_fs_df";
+
+ return $part->{free} if exists $part->{free};
+
+ if ($part->{isMounted}) {
+ $dir = ($prefix || '') . $part->{mntpoint};
+ } elsif ($part->{notFormatted} && !$part->{isFormatted}) {
+ return; #- won't even try!
+ } else {
+ mkdir $dir;
+ eval { mount($part->{device}, $dir, type2fs($part->{type}), 'readonly') };
+ if ($@) {
+ unlink $dir;
+ return;
+ }
+ }
+ my (undef, $free) = common::df($dir);
+
+ if (!$part->{isMounted}) {
+ umount($dir);
+ unlink($dir)
+ }
+
+ $part->{free} = 2 * $free if defined $free;
+ $part->{free};
+}
+
#- do some stuff before calling write_fstab
sub write($$$$) {
my ($prefix, $fstab, $manualFstab, $useSupermount) = @_;
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index e972e8c5a..5bd607909 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -873,27 +873,61 @@ sub generate_ks_cfg {
sub partitionWizard {
my ($o, $hds, $fstab, $readonly) = @_;
+ my $wizlog;
my @solutions;
+ my $min_linux = 500 << 11;
+ my $min_freewin = 100 << 11;
+
# each solutions is a [ text, function ], where the function retunrs true if succeeded
- if (fsedit::free_space(@$hds) > 500 << 11 && !$readonly) {
+ if (fsedit::free_space(@$hds) > $min_linux and !$readonly) {
push @solutions, [ _("Use free space"), sub { fsedit::auto_allocate($hds, $o->{partitions}); 1 } ];
- } elsif (my @l = grep { isTrueFS($_) } @$fstab) {
+ } else {
+ $wizlog .= _("Not enough free space to allocate new partitions");
+ }
+
+ if (my @l = grep { isTrueFS($_) } @$fstab) {
push @solutions, [ _("Use existing partition"), sub { $o->ask_mntpoint_s($o->{fstab}) } ];
- } elsif (@l = grep { isFat($_) } @$fstab) {
+ } else {
+ $wizlog .= _("There is no existing linux partition to use");
+ }
+
+ if (my @l = grep { isFat($_) } @$fstab) {
+ fs::df($_) foreach @l;
+ my @ok_forloopback = sort { $b->{free} <=> $a->{free} } grep { $_->{free} > $min_linux + $min_freewin } @l
+ or $wizlog .= _("There is not enough space left on the FAT partition(s) (or the FAT partition is corrupted)");
+
+ push @solutions, [ _("Use the FAT partition for loopback"),
+ sub { $o->doPartitionDisksLnx4win(@ok_forloopback) } ];
+
+ my @ok_forresizing = grep {
+ !$readonly && eval {
+ my $resize_fat = resize_fat::main->new($_->{device}, devices::make($_->{device}));
+ my $min_win = $resize_fat->min_size;
+ $_->{size} > $min_linux + $min_freewin + $min_win;
+ } && !$@;
+ } @ok_forloopback or $wizlog .= _("The FAT resizer can't find enough space left on the FAT partition(s)");
+ } else {
+ $wizlog .= _("There is no FAT partitions to resize or to use as loopback");
+ }
+
+ if (@$fstab && !$readonly) {
+ require diskdrake;
+ push @solutions,
+ [ _("Take over the hard drive (beware!)"),
+ sub {
+ my $hd = $o->ask_from_listf('', _("You have more than one hard drive, which one do you install linux on?"),
+ \&partition_table_raw::description, @$hds) or return;
+ $o->ask_okcancel('', _("All existing partitions and their data will be lost on drive %s", $hd->{device})) or return;
+ partition_table_raw::zero_MBR($hd);
+ fsedit::auto_allocate($hds, $o->{partitions});
+ 1;
+ } ];
+ }
+ if (!$readonly) {
+ push @solutions,
+ [ _("Use diskdrake"), sub { diskdrake::main($hds, $o->{raid}, interactive_gtk->new, $o->{partitions}); 1 } ];
}
- require diskdrake;
- push @solutions,
- [ _("Take over the hard drive (beware!)"),
- sub {
- my $hd = $o->ask_from_listf('', _("You have more than one hard drive, which one do you install linux on?"),
- \&partition_table_raw::description, @$hds) or return;
- $o->ask_okcancel('', _("All existing partitions and their data will be lost on drive %s", $hd->{device})) or return;
- partition_table_raw::zero_MBR($hd);
- fsedit::auto_allocate($hds, $o->{partitions});
- 1;
- } ],
- [ _("Use diskdrake"), sub { diskdrake::main($hds, $o->{raid}, interactive_gtk->new, $o->{partitions}); 1 } ],
}
1;
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 9b3b9b8db..2b7c44417 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -127,36 +127,43 @@ sub doPartitionDisks {
my ($o, $hds) = @_;
if ($o->{lnx4win}) {
- my @l = sort { $a->{device_windobe} cmp $b->{device_windobe} }
- grep { isFat($_) } fsedit::get_fstab(@{$o->{hds}}) or die "wow, lnx4win with no fat partitions! hard times :(";
- my $real_part = $o->doPartitionDisksLnx4winDev(\@l) || $l[0];
+ my @fat_parts = grep { isFat($_) } fsedit::get_fstab(@$hds) or die "wow, lnx4win with no fat partitions! hard times :(";
+ doPartitionDisksLnx4win($o, @fat_parts);
+ } else {
+ unless ($::testing) {
+ partition_table::write($_) foreach @$hds;
+ }
+ }
+}
+
+#------------------------------------------------------------------------------
+sub doPartitionDisksLnx4win {
+ my ($o, @fat_parts) = @_;
- my $handle = loopback::inspect($real_part, '', 'rw') or die _("This partition can't be used for loopback");
- my $size = loopback::getFree($handle->{dir}, $real_part);
+ my $real_part = $o->doPartitionDisksLnx4winDev(@fat_parts) or return;
- my $max_linux = 1000 << 11; $max_linux *= 10 if $::expert;
- my $min_linux = 300 << 11; $min_linux /= 3 if $::expert;
- my $min_freewin = 100 << 11; $min_freewin /= 10 if $::expert;
+ my $handle = loopback::inspect($real_part, '', 'rw') or die _("This partition can't be used for loopback");
+ my $size = loopback::getFree($handle->{dir}, $real_part);
- my $swap = { type => 0x82, loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => 64 << 11, device => $real_part, notFormatted => 1 };
- my $root = { type => 0x83, loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => 0, device => $real_part, notFormatted => 1 };
- $root->{size} = min($size - $swap->{size} - $min_freewin, $max_linux);
- log::l("lnx4win $root->{size} <= $min_linux (minlinux), $size (minavail) - $swap->{size} (swapsize) - $min_freewin (minfreewin), $max_linux (maxlinux)");
- $root->{size} > $min_linux or die "not enough room on that partition for lnx4win";
+ my $max_linux = 1000 << 11; $max_linux *= 10 if $::expert;
+ my $min_linux = 300 << 11; $min_linux /= 3 if $::expert;
+ my $min_freewin = 100 << 11; $min_freewin /= 10 if $::expert;
+
+ my $swap = { type => 0x82, loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => 64 << 11, device => $real_part, notFormatted => 1 };
+ my $root = { type => 0x83, loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => 0, device => $real_part, notFormatted => 1 };
+ $root->{size} = min($size - $swap->{size} - $min_freewin, $max_linux);
+ log::l("lnx4win $root->{size} <= $min_linux (minlinux), $size (minavail) - $swap->{size} (swapsize) - $min_freewin (minfreewin), $max_linux (maxlinux)");
+ $root->{size} > $min_linux or die "not enough room on that partition for lnx4win";
- $o->doPartitionDisksLnx4winSize(\$root->{size}, \$swap->{size}, $size - 2 * $swap->{size}, 2 * $swap->{size});
+ $o->doPartitionDisksLnx4winSize(\$root->{size}, \$swap->{size}, $size - 2 * $swap->{size}, 2 * $swap->{size}) or return;
- unlink "$handle->{dir}$_" foreach "/lnx4win/swapfile", "/lnx4win/linuxsys.img";
+ unlink "$handle->{dir}$_" foreach "/lnx4win/swapfile", "/lnx4win/linuxsys.img";
- push @{$real_part->{loopback}}, $root, $swap;
- } else {
- unless ($::testing) {
- partition_table::write($_) foreach @$hds;
- }
- }
+ push @{$real_part->{loopback}}, $root, $swap;
+ 1;
}
-sub doPartitionDisksLnx4winDev {}
-sub doPartitionDisksLnx4winSize {}
+sub doPartitionDisksLnx4winDev { my ($o, $fat_part) = @_; $fat_part }
+sub doPartitionDisksLnx4winSize { 1 }
#------------------------------------------------------------------------------
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index 77ad2c850..0e613a620 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -240,6 +240,7 @@ When sure, press Ok."))) {
partition_table::adjust_main_extended($hd);
local *log::l = sub { $w->set(join(' ', @_)) };
+ my $b = before_leaving { close $resize_fat->{fd} };
eval { $resize_fat->resize($part->{size}) };
if ($@) {
$part->{size} = $oldsize;
@@ -269,14 +270,14 @@ When sure, press Ok."))) {
}
sub doPartitionDisksLnx4winDev {
- my ($o, $l) = @_;
- return if $::beginner;
- $o->ask_from_listf('', _("Which partition do you want to use to put Linux4Win?"), \&partition_table_raw::description, @$l);
+ my ($o, @l) = @_;
+ return $l[0] if $::beginner;
+ $o->ask_from_listf('', _("Which partition do you want to use to put Linux4Win?"), \&partition_table_raw::description, \@l);
}
sub doPartitionDisksLnx4winSize {
my ($o, $root_size, $swap_size, $max_root_size, $max_swap_size) = @_;
- return if $::beginner;
+ return 1 if $::beginner;
my $w = my_gtk->new('');
@@ -301,8 +302,7 @@ _("Choose the sizes"),
$w->main(sub {
$$root_size = $root_spin->get_value_as_int << 11;
$$swap_size = $swap_spin->get_value_as_int << 11;
- });
-
+ });
}
#------------------------------------------------------------------------------
diff --git a/perl-install/resize_fat/main.pm b/perl-install/resize_fat/main.pm
index 0c94586ec..c3eee9381 100644
--- a/perl-install/resize_fat/main.pm
+++ b/perl-install/resize_fat/main.pm
@@ -41,12 +41,17 @@ sub new($$$) {
my ($type, $device, $fs_name) = @_;
my $fs = { device => $device, fs_name => $fs_name } ;
- resize_fat::io::open($fs);
- resize_fat::boot_sector::read($fs);
- $resize_fat::isFAT32 and eval { resize_fat::info_sector::read($fs) };
- resize_fat::fat::read($fs);
- resize_fat::any::flag_clusters($fs);
-
+ eval {
+ resize_fat::io::open($fs);
+ resize_fat::boot_sector::read($fs);
+ $resize_fat::isFAT32 and eval { resize_fat::info_sector::read($fs) };
+ resize_fat::fat::read($fs);
+ resize_fat::any::flag_clusters($fs);
+ };
+ if ($@) {
+ close $fs->{fd};
+ die;
+ }
bless $fs, $type;
}
diff --git a/rescue/tree/etc/rc.sysinit b/rescue/tree/etc/rc.sysinit
index 4f81e9e57..8fb6aea63 100755
--- a/rescue/tree/etc/rc.sysinit
+++ b/rescue/tree/etc/rc.sysinit
@@ -17,6 +17,7 @@ mount -f /proc
action "Setting hostname rescue" hostname rescue
echo rescue > /etc/HOSTNAME
+# Loads common modules ( no kerneld :( )
load() { modprobe $* 2>/dev/null; }
load ide-mod
load ide-probe
@@ -24,6 +25,8 @@ load ide-disk
load ide-cd
load af_packet
load isofs
+load vfat
+load reiserfs
grep -q oem /proc/cmdline && exec /etc/oem -f