From 66138cdc6bbd973426a9345c78c8120d9b446670 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 11 Aug 2000 00:27:27 +0000 Subject: no_comment --- docs/README | 2 +- perl-install/ChangeLog | 27 ++++++ perl-install/Xconfigurator.pm | 10 ++- perl-install/Xconfigurator_consts.pm | 2 + perl-install/install2.pm | 43 ++------- perl-install/install_any.pm | 144 ++++++++++++++++++++++++------ perl-install/install_steps.pm | 61 ++++++------- perl-install/install_steps_gtk.pm | 106 ---------------------- perl-install/install_steps_interactive.pm | 27 +++++- perl-install/install_steps_newt.pm | 18 ---- perl-install/interactive_gtk.pm | 66 +++++++------- perl-install/modules.pm | 1 + perl-install/partition_table.pm | 1 + perl-install/pkgs.pm | 4 +- perl-install/resize_fat/main.pm | 6 +- perl-install/share/compssList | 4 +- 16 files changed, 256 insertions(+), 266 deletions(-) diff --git a/docs/README b/docs/README index 70daaaa61..aaf339ced 100644 --- a/docs/README +++ b/docs/README @@ -26,7 +26,7 @@ Instead, changing some .pm files is quite easy (nice interpreted language) ******************************************************************************** If you have your own rpms you want to add, or make your own updated cdrom, you just have to update: -- Mandrake/base/hdlist: use ``misc/genhdlists --distrib .'' +- Mandrake/base/hdlist.cz2: use ``misc/genhdlists --distrib .'' - Mandrake/base/depslist: use ``misc/gendepslist2 -o Mandrake/base/depslist Mandrake/base/hdlist.cz2'' Optionnally, you can modify Mandrake/base/compssList and compssUsers. diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 721763378..60457b904 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,30 @@ +2000-08-11 Pixel + + * install_steps_interactive.pm (selectInstallClass): yet a bigger + warning so that people don't choose expert installs. Also set the + focus on "Custom" by default. + + * install_steps_interactive.pm (doPartitionDisks): created, calls + the wizard. + * install_steps.pm (doPartitionDisksBefore, + doPartitionDisksAfter): created (was mainly in + install2::doPartitionDisks) + * install2.pm (doPartitionDisks): much cleanup + * install_any.pm (partitionWizard): working state (still rough) + +2000-08-08 Pixel + + * standalone/rpmdrake (AddMedia): fix the ftp addmedia, fix the + cdrom addmedia + +2000-08-07 Pixel + + * diskdrake.pm (Resize): + * install_steps_gtk.pm (doPartitionDisks): remove the + before_leaving ensuring the filehandle is closed + * resize_fat/main.pm (DESTROY): use a better solution for ensuring + the filehandle is closed + 2000-08-07 François Pons * Xconfigurator.pm: added SiS6326 in the list of chipset that diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 47bff9b69..4fd969ef4 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -2,7 +2,7 @@ package Xconfigurator; use diagnostics; use strict; -use vars qw($in $install $isLaptop @window_managers @depths @monitorSize2resolution @hsyncranges %min_hsync4wres @vsyncranges %depths @resolutions %serversdriver @svgaservers @accelservers @allbutfbservers @allservers %vgamodes %videomemory @ramdac_name @ramdac_id @clockchip_name @clockchip_id %keymap_translate %standard_monitors $XF86firstchunk_text $keyboardsection_start $keyboardsection_start_v4 $keyboardsection_part2 $keyboardsection_part3 $keyboardsection_part3_v4 $keyboardsection_end $pointersection_text $pointersection_text_v4 $monitorsection_text1 $monitorsection_text2 $monitorsection_text3 $monitorsection_text4 $modelines_text_Trident_TG_96xx $modelines_text $devicesection_text $devicesection_text_v4 $screensection_text1 %lines @options %xkb_options $default_monitor $layoutsection_v4); +use vars qw($in $install $isLaptop @window_managers @depths @monitorSize2resolution @hsyncranges %min_hsync4wres @vsyncranges %depths @resolutions %serversdriver @svgaservers @accelservers @allbutfbservers @allservers %vgamodes %videomemory @ramdac_name @ramdac_id @clockchip_name @clockchip_id %keymap_translate %standard_monitors $XF86firstchunk_text $XF86firstchunk_text2 $keyboardsection_start $keyboardsection_start_v4 $keyboardsection_part2 $keyboardsection_part3 $keyboardsection_part3_v4 $keyboardsection_end $pointersection_text $pointersection_text_v4 $monitorsection_text1 $monitorsection_text2 $monitorsection_text3 $monitorsection_text4 $modelines_text_Trident_TG_96xx $modelines_text $devicesection_text $devicesection_text_v4 $screensection_text1 %lines @options %xkb_options $default_monitor $layoutsection_v4); use common qw(:common :file :functional :system); use log; @@ -225,7 +225,7 @@ Do You want to use XFree 3.3 instead of XFree 4.0?"), 1) and $card->{driver} = ' unless ($card->{type}) { $card->{flags}{noclockprobe} = member($card->{server}, qw(I128 S3 S3V Mach64)); } - $card->{options}{power_saver} = 1; + $card->{options}{DPMS} = 1; $card->{flags}{needVideoRam} and $card->{memory} ||= @@ -298,7 +298,7 @@ that is beyond the capabilities of your monitor: you may damage your monitor. } else { add2hash($monitor, $monitors{$monitor->{type}}); } - add2hash($monitor, { type => "Unknown", vendor => "Unknown", model => "Unknown" }); + add2hash($monitor, { type => "Unknown", vendor => "Unknown", model => "Unknown", manual => 1 }); } sub testConfig($) { @@ -680,8 +680,10 @@ sub write_XF86Config { open F, ">$file" or die "can't write XF86Config in $file: $!"; open G, ">$file-4" or die "can't write XF86Config in $file-4: $!"; - print F $XF86firstchunk_text; + print F $XF86firstchunk_text, $XF86firstchunk_text2; print G $XF86firstchunk_text; + print G qq( Option "Pixmap" "24"\n) if $o->{card}{type} eq "SiS 6326"; + print G $XF86firstchunk_text2; #- Write keyboard section. $O = $o->{keyboard}; diff --git a/perl-install/Xconfigurator_consts.pm b/perl-install/Xconfigurator_consts.pm index 3fe7f8112..3ff43ae09 100644 --- a/perl-install/Xconfigurator_consts.pm +++ b/perl-install/Xconfigurator_consts.pm @@ -376,7 +376,9 @@ Section "ServerFlags" # This allows the server to start up even if the # mouse device can't be opened/initialised. AllowMouseOpenFail +); +$XF86firstchunk_text2 = q( EndSection # ********************************************************************** diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 30b3fedcc..853c62635 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -297,43 +297,10 @@ sub selectInstallClass { sub doPartitionDisks { return install_any::searchAndMount4Upgrade($o) if $o->{isUpgrade}; - my $stage1_hd; - if (cat_("/proc/mounts") =~ m|/\w+/(\S+)\s+/tmp/hdimage\s+(\S+)|) { - $stage1_hd = { dev => $1, fs => $2 }; - install_any::getFile("XXX"); #- close still opened filehandle - eval { fs::umount("/tmp/hdimage") }; - } - $::o->{steps}{formatPartitions}{done} = 0; - eval { fs::umount_all($o->{fstab}, $o->{prefix}) } if $o->{fstab} && !$::testing; - - my $ok = fsedit::get_root($o->{fstab} || []) ? 1 : install_any::getHds($o); - my $auto = $ok && !$o->{partitioning}{readonly} && !$o->{lnx4win} && - ($o->{partitioning}{auto_allocate} || $::beginner && fsedit::get_fstab(@{$o->{hds}}) < 3); - - eval { fsedit::auto_allocate($o->{hds}, $o->{partitions}) } if $auto; - - if ($auto && fsedit::get_root_($o->{hds}) && $_[1] == 1) { - #- we have a root partition, that's enough :) - $o->install_steps::doPartitionDisks($o->{hds}); - } elsif ($o->{partitioning}{readonly}) { - $o->ask_mntpoint_s($o->{fstab}); - } else { - $o->doPartitionDisks($o->{hds}, $o->{raid} ||= {}); - } - unless ($::testing) { - $o->rebootNeeded foreach grep { $_->{rebootNeeded} } @{$o->{hds}}; - } - eval { fs::mount($stage1_hd->{dev}, "/tmp/hdimage", $stage1_hd->{fs}) } if $stage1_hd; - - $o->{fstab} = [ fsedit::get_fstab(@{$o->{hds}}, $o->{raid}) ]; - fsedit::get_root($o->{fstab}) or die -_("You must have a root partition. -For this, create a partition (or click on an existing one). -Then choose action ``Mount point'' and set it to `/'"); - - cat_("/proc/mounts") =~ m|(\S+)\s+/tmp/rhimage nfs| && - !grep { $_->{mntpoint} eq "/mnt/nfs" } @{$o->{manualFstab} || []} and - push @{$o->{manualFstab}}, { type => "nfs", mntpoint => "/mnt/nfs", device => $1, options => "noauto,ro,nosuid,rsize=8192,wsize=8192" }; + $o->{steps}{formatPartitions}{done} = 0; + $o->doPartitionDisksBefore; + $o->doPartitionDisks; + $o->doPartitionDisksAfter; } sub formatPartitions { @@ -506,7 +473,7 @@ sub configureX { fs::write($o->{prefix}, $o->{fstab}, $o->{manualFstab}, $o->{useSupermount}); modules::write_conf($o->{prefix}); - $o->configureX if pkgs::packageFlagInstalled(pkgs::packageByName($o->{packages}, 'XFree86')) || $clicked; + $o->configureX if pkgs::packageFlagInstalled(pkgs::packageByName($o->{packages}, 'XFree86')) && !$o->{X}{disabled} || $clicked; } #------------------------------------------------------------------------------ sub generateAutoInstFloppy { diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 5bd607909..6e9984f2a 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -584,6 +584,7 @@ sub g_auto_install(;$) { if ($o->{X}{default_depth} and my $depth = $card->{depth}{$o->{X}{default_depth}}) { $depth ||= []; $o->{X}{resolution_wanted} ||= join "x", @{$depth->[0]} unless is_empty_array_ref($depth->[0]); + $o->{X}{monitor} = $::o->{X}{monitor} if $::o->{X}{monitor}{manual}; } } @@ -873,61 +874,146 @@ sub generate_ks_cfg { sub partitionWizard { my ($o, $hds, $fstab, $readonly) = @_; - my $wizlog; - my @solutions; + my @wizlog; + my (@solutions, %solutions); my $min_linux = 500 << 11; + my $max_linux = 2500 << 11; + my $min_swap = 50 << 11; + my $max_swap = 300 << 11; my $min_freewin = 100 << 11; - # each solutions is a [ text, function ], where the function retunrs true if succeeded + # each solution is a [ score, text, function ], where the function retunrs true if succeeded + if (fsedit::free_space(@$hds) > $min_linux and !$readonly) { - push @solutions, [ _("Use free space"), sub { fsedit::auto_allocate($hds, $o->{partitions}); 1 } ]; + $solutions{free_space} = [ 20, _("Use free space"), sub { fsedit::auto_allocate($hds, $o->{partitions}); 1 } ] } else { - $wizlog .= _("Not enough free space to allocate new partitions"); + push @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}) } ]; + if (@$fstab) { + my $truefs = grep { isTrueFS($_) } @$fstab; + #- value twice the ext2 partitions + $solutions{existing_part} = [ 6 + $truefs + @$fstab, _("Use existing partition"), sub { $o->ask_mntpoint_s($fstab) } ] } else { - $wizlog .= _("There is no existing linux partition to use"); + push @wizlog, _("There is no existing 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 @fats = grep { isFat($_) } @$fstab; + fs::df($_) foreach @fats; + if (my @ok_forloopback = sort { $b->{free} <=> $a->{free} } grep { $_->{free} > $min_linux + $min_freewin } @fats) { + $solutions{loopback} = + [ 5 - @fats, _("Use the FAT partition for loopback"), + sub { + my ($s_root, $s_swap); + my $part = $o->ask_from_listf('', _("Which partition do you want to use to put Linux4Win?"), \&partition_table_raw::description, \@ok_forloopback) or return; + $o->ask_from_entries_refH('', _("Choose the sizes"), [ + _("Root partition size in MB: ") => { val => \$s_root, min => 1 + ($min_linux >> 11), max => min($part->{free} - 2 * $max_swap - $min_freewin, $max_linux) >> 11, type => 'range' }, + _("Swap partition size in MB: ") => { val => \$s_swap, min => 1 + ($min_swap >> 11), max => 2 * $max_swap >> 11, type => 'range' }, + ]) or return; + push @{$part->{loopback}}, + { type => 0x83, loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => $s_root << 11, device => $part, notFormatted => 1 }, + { type => 0x82, loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => $s_swap << 11, device => $part, notFormatted => 1 }; + 1; + } ]; + $solutions{resize_fat} = + [ 6 - @fats, _("Use the free space on the FAT partition"), + sub { + my $part = $o->ask_from_listf('', _("Which partition do you want to resize?"), \&partition_table_raw::description, \@ok_forloopback) or return; + my $w = $o->wait_message(_("Resizing"), _("Computing FAT filesystem bounds")); + my $resize_fat = eval { resize_fat::main->new($part->{device}, devices::make($part->{device})) }; + $@ and die _("The FAT resizer is unable to handle your partition, +the following error occured: %s", $@); 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)"); + $part->{size} > $min_linux + $min_freewin + $min_win or die _("Your windows partition is too fragmented, please run ``defrag'' first"); + $o->ask_okcancel('', _("WARNING! + +DrakX will now resize your Windows partition. Be careful: this operation is +dangerous. If you have not already done so, you should first exit the +installation, run scandisk under Windows (and optionally run defrag), then +restart the installation. You should also backup your data. +When sure, press Ok.")) or return; + + my $size = $part->{size}; + $o->ask_from_entries_refH('', _("Which size do you want to keep for windows on"), [ + _("partition %s", partition_table_raw::description($part)) => { val => \$size, min => 1 + ($min_win >> 11), max => ($part->{size} - $min_linux) >> 11, type => 'range' }, + ]) or return; + $size <<= 11; + + local *log::l = sub { $w->set(join(' ', @_)) }; + eval { $resize_fat->resize($size) }; + $@ and die _("FAT resizing failed: %s", $@); + + $part->{size} = $size; + $part->{isFormatted} = 1; + + my ($hd) = grep { $_->{device} eq $part->{rootDevice} } @$hds; + $hd->{isDirty} = $hd->{needKernelReread} = 1; + $hd->adjustEnd($part); + partition_table::adjust_local_extended($hd, $part); + partition_table::adjust_main_extended($hd); + + fsedit::auto_allocate($hds, $o->{partitions}); + 1; + } ] if !$readonly; } else { - $wizlog .= _("There is no FAT partitions to resize or to use as loopback"); + push @wizlog, _("There is no FAT partitions to resize or to use as loopback (or not enough space left)"); } if (@$fstab && !$readonly) { require diskdrake; - push @solutions, - [ _("Take over the hard drive (beware!)"), + $solutions{wipe_drive} = + [ 10, fsedit::is_one_big_fat($hds) ? _("Remove Windows(TM)") : _("Take over the hard drive"), 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; + \&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 } ]; + + if (!$readonly && ref($o) =~ /gtk/) { #- diskdrake only available in gtk for now + $solutions{diskdrake} = + [ 0, _("Use diskdrake"), sub { + my $ok = 1; + do { + diskdrake::main($hds, $o->{raid}, interactive_gtk->new, $o->{partitions}); + my @fstab = fsedit::get_fstab(@$hds); + + unless (fsedit::get_root(\@fstab)) { + $ok = 0; + $o->ask_okcancel('', _("You must have a root partition. +For this, create a partition (or click on an existing one). +Then choose action ``Mount point'' and set it to `/'"), 1) or return; + } + if (!grep { isSwap($_) } @fstab) { + $o->ask_warn('', _("You must have a swap partition")), $ok=0 if $::beginner; + $ok &&= $::expert || $o->ask_okcancel('', _("You don't have a swap partition\n\nContinue anyway?")); + } + } until $ok; + 1; + } ]; + } + + if (!$readonly) { #- diskdrake only available in gtk for now + $solutions{fdisk} = + [ -10, _("Use fdisk"), sub { + $o->suspend; + foreach (@$hds) { + print "\n" x 10, _("You can now partition %s. +When you are done, don't forget to save using `w'", partition_table_raw::description($_)); + print "\n\n"; + my $pid = fork or exec "fdisk", devices::make($_->{device}); + waitpid($pid, 0); + } + $o->resume; + 0; + } ]; } + log::l("partitioning wizard log:\n", (map { ">>wizlog>>$_\n" } @wizlog)); + %solutions; } 1; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 58e15fde7..72734f5b3 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -123,47 +123,43 @@ sub setupSCSI { modules::load_thiskind('scsi|raid'); } #------------------------------------------------------------------------------ -sub doPartitionDisks { - my ($o, $hds) = @_; +sub doPartitionDisksBefore { + my ($o) = @_; - if ($o->{lnx4win}) { - 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; - } + if (cat_("/proc/mounts") =~ m|/\w+/(\S+)\s+/tmp/hdimage\s+(\S+)|) { + $o->{stage1_hd} = { dev => $1, fs => $2 }; + install_any::getFile("XXX"); #- close still opened filehandle + eval { fs::umount("/tmp/hdimage") }; } + eval { fs::umount_all($o->{fstab}, $o->{prefix}) } if $o->{fstab} && !$::testing; + + $o->{raid} ||= {}; + install_any::getHds($o); } #------------------------------------------------------------------------------ -sub doPartitionDisksLnx4win { - my ($o, @fat_parts) = @_; - - my $real_part = $o->doPartitionDisksLnx4winDev(@fat_parts) or return; - - 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 $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"; +sub doPartitionDisksAfter { + my ($o) = @_; + unless ($::testing) { + partition_table::write($_) foreach @{$o->{hds}}; + $_->{rebootNeeded} and $o->rebootNeeded foreach @{$o->{hds}}; + } + if (my $s = delete $o->{stage1_hd}) { + eval { fs::mount($s->{dev}, "/tmp/hdimage", $s->{fs}) }; + } - $o->doPartitionDisksLnx4winSize(\$root->{size}, \$swap->{size}, $size - 2 * $swap->{size}, 2 * $swap->{size}) or return; + $o->{fstab} = [ fsedit::get_fstab(@{$o->{hds}}, $o->{raid}) ]; + fsedit::get_root($o->{fstab}) or die "Oops, no root partition"; - unlink "$handle->{dir}$_" foreach "/lnx4win/swapfile", "/lnx4win/linuxsys.img"; + cat_("/proc/mounts") =~ m|(\S+)\s+/tmp/rhimage nfs| && + !grep { $_->{mntpoint} eq "/mnt/nfs" } @{$o->{manualFstab} || []} and + push @{$o->{manualFstab}}, { type => "nfs", mntpoint => "/mnt/nfs", device => $1, options => "noauto,ro,nosuid,rsize=8192,wsize=8192" }; +} - push @{$real_part->{loopback}}, $root, $swap; - 1; +#------------------------------------------------------------------------------ +sub doPartitionDisks { + my ($o, $hds) = @_; } -sub doPartitionDisksLnx4winDev { my ($o, $fat_part) = @_; $fat_part } -sub doPartitionDisksLnx4winSize { 1 } #------------------------------------------------------------------------------ @@ -186,6 +182,7 @@ sub ask_mntpoint_s { #- in case the type does not correspond, force it to ext2 $_->{type} = 0x83 if $m =~ m|^/| && !isFat($_); } + 1; } diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 0e613a620..ac8188d8a 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -199,112 +199,6 @@ sub selectMouse { } } -#------------------------------------------------------------------------------ -sub doPartitionDisks { - my ($o, $hds, $raid) = @_; - - if ($o->{lnx4win}) { - eval { install_steps::doPartitionDisks(@_) }; - if ($@ =~ /no fat/) { - $o->ask_warn('', _("You don't have any windows partitions!")); - } elsif ($@ =~ /not enough room/) { - $o->ask_warn('', _("You don't have any enough room for Lnx4win")); - } else { return } -#- delete $o->{lnx4win}; - } - if ($::beginner && fsedit::is_one_big_fat($hds)) { - #- wizard - my $min_linux = 600 << 11; - my $max_linux = 1500 << 11; - my $min_freewin = 300 << 11; - - my ($part) = fsedit::get_fstab(@{$o->{hds}}); - my $w = $o->wait_message(_("Resizing"), _("Computing FAT filesystem bounds")); - my $resize_fat = eval { resize_fat::main->new($part->{device}, devices::make($part->{device})) }; - $@ and goto diskdrake; - my $min_win = $resize_fat->min_size; - if (!$@ && $part->{size} > $min_linux + $min_freewin + $min_win && $o->ask_okcancel('', -_("WARNING! - -DrakX now needs to resize your Windows partition. Be careful: this operation is -dangerous. If you have not already done so, you should first exit the -installation, run scandisk under Windows (and optionally run defrag), then -restart the installation. You should also backup your data. -When sure, press Ok."))) { - my $hd = $hds->[0]; - my $oldsize = $part->{size}; - $hd->{isDirty} = $hd->{needKernelReread} = 1; - $part->{size} -= min($max_linux, $part->{size} - $min_win); - $hd->adjustEnd($part); - partition_table::adjust_local_extended($hd, $part); - 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; - $o->ask_warn('', _("Automatic resizing failed")); - } else { - $part->{isFormatted} = 1; - eval { fsedit::auto_allocate($hds, $o->{partitions}) }; - if (!$@) { - partition_table::write($hd) unless $::testing; - return; - } - } - } - } - - diskdrake: - while (1) { - diskdrake::main($hds, $raid, interactive_gtk->new, $o->{partitions}); - if (!grep { isSwap($_) } fsedit::get_fstab(@{$o->{hds}})) { - if ($::beginner) { - $o->ask_warn('', _("You must have a swap partition")); - } elsif (!$::expert) { - $o->ask_okcancel('', _("You don't have a swap partition\n\nContinue anyway?")) and last; - } else { last } - } else { last } - } -} - -sub doPartitionDisksLnx4winDev { - 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 1 if $::beginner; - - my $w = my_gtk->new(''); - - my $root_adj = create_adjustment($max_root_size >> 11, 250, $$root_size >> 11); - my $swap_adj = create_adjustment($max_swap_size >> 11, 32, $$swap_size >> 11); - my $root_spin = new Gtk::SpinButton($root_adj, 0, 0); - my $swap_spin = new Gtk::SpinButton($swap_adj, 0, 0); - - gtkadd($w->{window}, - gtkpack(new Gtk::VBox(0,20), -_("Choose the sizes"), - create_packtable({}, - [ _("Root partition size in MB: "), $root_spin ], - [ undef, new Gtk::HScrollbar($root_adj) ], - [ _("Swap partition size in MB: "), $swap_spin ], - [ undef, new Gtk::HScrollbar($swap_adj) ], - ), - create_okcancel($w) - ), - ); - $w->{ok}->grab_focus; - $w->main(sub { - $$root_size = $root_spin->get_value_as_int << 11; - $$swap_size = $swap_spin->get_value_as_int << 11; - }); -} - #------------------------------------------------------------------------------ sub chooseSizeToInstall { my ($o, $packages, $min_size, $max_size_, $availableC, $individual) = @_; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index c47c442b3..71b4993b8 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -120,8 +120,11 @@ sub selectInstallClass($@) { $::expert = $c{$_[0]} eq "expert" && $o->ask_from_list_('', _("Are you sure you are an expert? -You will be allowed to make powerful but dangerous things here."), - [ _("Expert"), _("Customized") ]) ne "Customized"; +You will be allowed to make powerful but dangerous things here. + +You will be asked questions such as: ``Use shadow file for passwords?'', +are you ready to answer that kind of questions?"), + [ _("Customized"), _("Expert") ]) ne "Customized"; }; $o->{isUpgrade} = $o->selectInstallClass1($verifInstallClass, @@ -208,6 +211,24 @@ sub ask_mntpoint_s { $o->SUPER::ask_mntpoint_s($fstab); } +#------------------------------------------------------------------------------ +sub doPartitionDisks { + my ($o) = @_; + my %solutions = install_any::partitionWizard($o, $o->{hds}, $o->{fstab}, $o->{partitioning}{readonly}); + my @solutions = sort { $b->[0] <=> $a->[0] } values %solutions; + + my $level = $::beginner ? 2 : -9999; + my @sol = grep { $_->[0] >= $level } @solutions; + @solutions = @sol if @sol > 1; + + my $ok; while (!$ok) { + my $sol = $o->ask_from_listf('', _("The DrakX Partitioning wizard found the following solutions:"), sub { $_->[1] }, \@solutions) or redo; + eval { $ok = $sol->[2]->() }; + $ok &&= !$@; + $@ and $o->ask_warn('', _("Partitioning failed: %s", $@)); + } +} + #------------------------------------------------------------------------------ sub rebootNeeded($) { my ($o) = @_; @@ -935,7 +956,7 @@ sub configureX { Xconfig::getinfoFromXF86Config($o->{X}, $o->{prefix}); } } - $::force_xf3 = $::force_xf3; ; #- for no warning + $::force_xf3 = $::force_xf3; #- for no warning $::force_xf3 = $o->ask_yesorno('', _("DrakX will generate config files for both XFree 3.3 and XFree 4.0. By default, the 4.0 server is used unless your card is not supported. diff --git a/perl-install/install_steps_newt.pm b/perl-install/install_steps_newt.pm index 015de1c05..62db5486b 100644 --- a/perl-install/install_steps_newt.pm +++ b/perl-install/install_steps_newt.pm @@ -34,24 +34,6 @@ sub new($$) { (bless {}, ref $type || $type)->SUPER::new($o); } -sub doPartitionDisks($$) { - my ($o, $hds, $raid) = @_; - - Newt::Suspend(); - foreach (@$hds) { - print -_("You can now partition your %s hard drive -When you are done, don't forget to save using `w'", $_->{device}); - print "\n\n"; - my $pid = fork or exec "fdisk", devices::make($_->{device}); - waitpid($pid, 0); - } - Newt::Resume(); - - install_any::getHds($o); - $o->ask_mntpoint_s($o->{fstab}); -} - sub enteringStep { my ($o, $step) = @_; $o->SUPER::enteringStep($step); diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index dffcca5cd..d4de36eb6 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -16,13 +16,8 @@ sub new { $::windowheight ||= 400 if $::isStandalone; goto &interactive::new; } - -#-#- redefine ask_warn -#-sub ask_warn { -#- my $o = shift; -#- local $my_gtk::grab = 1; -#- $o->SUPER::ask_warn(@_); -#-} +sub suspend { my ($o) = @_; $o->{suspended} = common::setVirtual(1) } +sub resume { my ($o) = @_; common::setVirtual(delete $o->{suspended}) } sub exit { c::_exit($_[0]) #- workaround @@ -182,17 +177,24 @@ sub ask_from_entries_refW { my $w = my_gtk->new($title_, %$o); #-the widgets my @widgets = map { - if ($_->{type} eq "list") { + my $i = $_; + if ($i->{type} eq "list") { my $w = new Gtk::Combo; $w->set_use_arrows_always(1); - $w->entry->set_editable(!$_->{not_edit}); - $w->set_popdown_strings(@{$_->{list}}); + $w->entry->set_editable(!$i->{not_edit}); + $w->set_popdown_strings(@{$i->{list}}); $w->disable_activate; $w; - } elsif ($_->{type} eq "bool") { - my $w = Gtk::CheckButton->new($_->{text}); - $w->set_active(${$_->{val}}); - my $i = $_; $w->signal_connect(clicked => sub { $ignore or invbool \${$i->{val}} }); + } elsif ($i->{type} eq "bool") { + my $w = Gtk::CheckButton->new($i->{text}); + $w->set_active(${$i->{val}}); + $w->signal_connect(clicked => sub { $ignore or invbool \${$i->{val}} }); + $w; + } elsif ($i->{type} eq "range") { + my $adj = create_adjustment(${$i->{val}}, $i->{min}, $i->{max}); + $adj->signal_connect(value_changed => sub { ${$i->{val}} = $adj->get_value }); + my $w = new Gtk::HScale($adj); + $w->set_digits(0); $w; } else { new Gtk::Entry; @@ -207,7 +209,7 @@ sub ask_from_entries_refW { my @updates = mapn { my ($w, $ref) = @_; sub { - $ref->{type} eq "bool" and return; + $ref->{type} =~ /bool|range/ and return; ${$ref->{val}} = widget($w, $ref)->get_text; }; } \@widgets, $val; @@ -215,8 +217,10 @@ sub ask_from_entries_refW { my @updates_inv = mapn { my ($w, $ref) = @_; sub { - $ref->{type} eq "bool" ? + $ref->{type} eq "bool" ? $w->set_active(${$ref->{val}}) : + $ref->{type} eq "bool" ? + $w->get_adjustment->set_value(${$ref->{val}}) : widget($w, $ref)->set_text(${$ref->{val}}) }; } \@widgets, $val; @@ -236,6 +240,18 @@ sub ask_from_entries_refW { $ignore = 0; }; }; + my $may_go_to_next = sub { + my ($W, $e) = @_; + if (($e->{keyval} & 0x7f) == 0xd) { + $W->signal_emit_stop("key_press_event"); + if ($ind == $#$l) { + @$l == 1 ? $w->{ok}->clicked : $w->{ok}->grab_focus; + } else { + widget($widgets[$ind+1],$val->[$ind+1])->grab_focus; + } + } + }; + if ($hcallback{focus_out}) { my $focusout_callback = sub { return if $ignore; @@ -247,22 +263,12 @@ sub ask_from_entries_refW { }; $widget->signal_connect(focus_out_event => $focusout_callback); } + if (ref $widget eq "Gtk::HScale") { + $widget->signal_connect(key_press_event => $may_go_to_next); + } if (ref $widget eq "Gtk::Entry") { $widget->signal_connect(changed => $changed_callback); - my $go_to_next = sub { - if ($ind == $#$l) { - @$l == 1 ? $w->{ok}->clicked : $w->{ok}->grab_focus(); - } else { - widget($widgets[$ind+1],$val->[$ind+1])->grab_focus(); - } - }; - $widget->signal_connect(activate => $go_to_next); - $widget->signal_connect(key_press_event => sub { - my ($w, $e) = @_; - #-don't know why it works, i believe that - #-i must say before &$go_to_next, but with it doen't work HACK! - $w->signal_emit_stop("key_press_event") if chr($e->{keyval} & 0xff) eq "\x8d"; - }); + $widget->signal_connect(key_press_event => $may_go_to_next); $widget->set_text(${$val->[$i]{val}}); $widget->set_visibility(0) if $val->[$i]{hidden}; } diff --git a/perl-install/modules.pm b/perl-install/modules.pm index bb0ec41d4..24e4e1291 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -148,6 +148,7 @@ arch() =~ /^sparc/ ? ( "DAC960" => "Mylex DAC960", # "dpt" => "Distributed Tech SmartCache/Raid I-IV Controller", # not there anymore? "megaraid" => "AMI MegaRAID", + "aacraid" => "AACxxx Raid Controller", "cpqarray" => "Compaq Smart-2/P RAID Controller", "gdth" => "ICP Disk Array Controller", "ips" => "IBM ServeRAID controller", diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index c0d45d437..bcfc81e14 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -450,6 +450,7 @@ sub read_extended { # write the partition table sub write($) { my ($hd) = @_; + $hd->{isDirty} or return; #- set first primary partition active if no primary partitions are marked as active. for ($hd->{primary}{raw}) { diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index ed15573f7..df2953a37 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -468,7 +468,7 @@ sub psUsingHdlist { #- extract filename from archive, this take advantage of verifying #- the archive too. - open F, "extract_archive $newf |" or die "unable to parse $newf"; + open F, "extract_archive $newf |"; foreach () { chomp; /^[dlf]\s+/ or next; @@ -501,7 +501,7 @@ sub psUsingHdlist { die "bad hdlist file: $newf"; } } - close F; + close F or die "unable to parse $newf"; #- update maximal index. $m->{max} = scalar(keys %{$packages->[0]}) - 1; diff --git a/perl-install/resize_fat/main.pm b/perl-install/resize_fat/main.pm index c3eee9381..256031228 100644 --- a/perl-install/resize_fat/main.pm +++ b/perl-install/resize_fat/main.pm @@ -55,7 +55,11 @@ sub new($$$) { bless $fs, $type; } -sub DESTROY { resize_fat::c_rewritten::free_all() } +sub DESTROY { + my ($fs) = @_; + close $fs->{fd}; + resize_fat::c_rewritten::free_all(); +} #- copy all clusters >= to a new place on the partition, less #- than . Only copies files, not directories. diff --git a/perl-install/share/compssList b/perl-install/share/compssList index d362571c3..574f49917 100644 --- a/perl-install/share/compssList +++ b/perl-install/share/compssList @@ -303,7 +303,7 @@ gawk-doc 10 35 50 gcc 50 40 90 gcc-c++ 15 0 84 gcc-chill 20 0 65 -gcc-colorgcc 10 0 84 +gcc-colorgcc 0 0 0 gcc-cpp 47 0 82 gcc-fr 0 0 0 gcc-g77 15 0 67 @@ -451,7 +451,7 @@ hylafax-common 20 0 0 hylafax-server 20 15 0 ibtk 20 0 13 ical 40 0 27 -iceconf 50 0 54 +icepref 50 0 54 icewm 50 0 78 icewm-light 87 0 80 imap 0 80 6 -- cgit v1.2.1