package fsedit; # $Id$ use diagnostics; use strict; use vars qw(%suggestions); #-###################################################################################### #- misc imports #-###################################################################################### use common; use partition_table; use partition_table::raw; use fs::get; use fs::type; use fs::loopback; use fs::proc_partitions; use detect_devices; use devices; use log; use fs; %suggestions = ( N_("simple") => [ { mntpoint => "/", size => MB(300), fs_type => 'ext3', ratio => 20, maxsize => MB(8000) }, { mntpoint => "swap", size => MB(128), fs_type => 'swap', ratio => 1, maxsize => MB(4000) }, { mntpoint => "/home", size => MB(300), fs_type => 'ext3', ratio => 3, min_hd_size => MB(7000) }, ], N_("with /usr") => [ { mntpoint => "/", size => MB(250), fs_type => 'ext3', ratio => 1, maxsize => MB(8000) }, { 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, min_hd_size => MB(7000) }, ], N_("server") => [ { mntpoint => "/", size => MB(150), fs_type => 'ext3', ratio => 1, maxsize => MB(8000) }, { 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, min_hd_size => MB(7000) }, { mntpoint => "/tmp", size => MB(150), fs_type => 'ext3', ratio => 2, maxsize => MB(4000) }, ], ); foreach (values %suggestions) { if (arch() =~ /ia64/) { @$_ = ({ mntpoint => "/boot/efi", size => MB(50), pt_type => 0xef, ratio => 1, maxsize => MB(150) }, @$_); } } my @suggestions_mntpoints = ( "/var/ftp", "/var/www", "/boot", '/usr/local', '/opt', arch() =~ /sparc/ ? "/mnt/sunos" : arch() =~ /ppc/ ? "/mnt/macos" : "/mnt/windows", ); #-###################################################################################### #- Functions #-###################################################################################### sub recompute_loopbacks { my ($all_hds) = @_; my @fstab = fs::get::fstab($all_hds); @{$all_hds->{loopbacks}} = map { isPartOfLoopback($_) ? @{$_->{loopback}} : () } @fstab; } sub raids { my ($hds) = @_; my @parts = fs::get::hds_fstab(@$hds); my @l = grep { isRawRAID($_) } @parts or return []; log::l("looking for raids in " . join(' ', map { $_->{device} } @l)); require raid; raid::detect_during_install(@l) if $::isInstall; raid::get_existing(@l); } sub lvms { my ($all_hds) = @_; my @pvs = grep { isRawLVM($_) } fs::get::fstab($all_hds) or return; log::l("looking for vgs in " . join(' ', map { $_->{device} } @pvs)); #- otherwise vgscan will not find them devices::make($_->{device}) foreach @pvs; require lvm; my @lvms; foreach (@pvs) { my $name = lvm::pv_to_vg($_) or next; my $lvm = find { $_->{VG_name} eq $name } @lvms; if (!$lvm) { $lvm = new lvm($name); lvm::update_size($lvm); lvm::get_lvs($lvm); push @lvms, $lvm; } $_->{lvm} = $name; push @{$lvm->{disks}}, $_; } @lvms; } sub handle_dmraid { my ($drives, $o_in) = @_; @$drives > 1 or return; devices::make($_->{device}) foreach @$drives; require fs::dmraid; eval { fs::dmraid::init() } or log::l("dmraid::init failed"), return; my @vgs = fs::dmraid::vgs(); log::l(sprintf('dmraid: ' . join(' ', map { "$_->{device} [" . join(' ', @{$_->{disks}}) . "]" } @vgs))); if ($o_in && @vgs && $::isInstall) { @vgs = grep { $o_in->ask_yesorno('', N("BIOS software RAID detected on disks %s. Activate it?", join(' ', @{$_->{disks}})), 1); } @vgs or do { fs::dmraid::call_dmraid('-an'); return; }; } log::l("using dmraid on " . join(' ', map { $_->{device} } @vgs)); my @used_hds = map { my $part = fs::get::device2part($_, $drives) or log::l("handle_dmraid: can't find $_ in known drives"); if_($part, $part); } map { @{$_->{disks}} } @vgs; @$drives = difference2($drives, \@used_hds); push @$drives, @vgs; } sub get_hds { my ($o_flags, $o_in) = @_; my $flags = $o_flags || {}; $flags->{readonly} && ($flags->{clearall} || $flags->{clear}) and die "conflicting flags readonly and clear/clearall"; my @drives = detect_devices::hds(); #- replace drives used in dmraid by the merged name handle_dmraid(\@drives, $o_in) if !$flags->{nodmraid}; foreach my $hd (@drives) { $hd->{file} = devices::make($hd->{device}); } @drives = partition_table::raw::get_geometries(@drives); my (@hds, @raw_hds); foreach my $hd (@drives) { $hd->{readonly} = $flags->{readonly}; eval { partition_table::raw::test_for_bad_drives($hd) if !$flags->{no_bad_drives} }; if (my $err = $@) { log::l("test_for_bad_drives returned $err"); if ($err =~ /write error:/) { log::l("setting $hd->{device} readonly"); $hd->{readonly} = 1; } elsif ($err =~ /read error:/) { next; } else { $o_in and $o_in->ask_warn('', $err); next; } } if ($flags->{clearall} || member($hd->{device}, @{$flags->{clear} || []})) { my $lvms = []; #- temporary one, will be re-created later in get_hds() partition_table_initialize($lvms, $hd, $o_in); } else { my $handle_die_and_cdie = sub { if (my $type = fs::type::type_subpart_from_magic($hd)) { #- non partitioned drive? if (exists $hd->{usb_description} && $type->{fs_type}) { #- USB keys put_in_hash($hd, $type); push @raw_hds, $hd; $hd = ''; 1; } else { 0; } } elsif ($hd->{readonly}) { log::l("using /proc/partitions since diskdrake failed :("); fs::proc_partitions::use_($hd); 1; } else { 0; } }; my $handled; eval { catch_cdie { partition_table::read($hd); if (listlength(partition_table::get_normal_parts($hd)) == 0) { $handled = 1 if $handle_die_and_cdie->(); } elsif ($::isInstall) { if (fs::type::is_dmraid($hd)) { if (my $p = find { ! -e "/dev/$_->{device}" } partition_table::get_normal_parts($hd)) { #- dmraid should have created the device, so it means we don't agree die sprintf(q(bad dmraid (missing partition %s), you may try rebooting install with option "nodmraid"), $p->{device}); } } else { fs::proc_partitions::compare($hd) if !detect_devices::is_xbox() && arch() ne 'ppc'; } } } sub { my $err = $@; if ($handle_die_and_cdie->()) { $handled = 1; 0; #- do not continue, transform cdie into die } else { !$o_in || $o_in->ask_okcancel('', formatError($err)); } }; }; if (my $err = $@) { if ($handled) { #- already handled in cdie handler above } elsif ($handle_die_and_cdie->()) { } elsif ($o_in && $o_in->ask_yesorno(N("Error"), N("I can not read the partition table of device %s, it's too corrupted for me :( I can try to go on, erasing over bad partitions (ALL DATA will be lost!). The other solution is to not allow DrakX to modify the partition table. (the error is %s) Do you agree to lose all the partitions? ", $hd->{device}, formatError($err)))) { partition_table::raw::zero_MBR($hd); } else { #- using it readonly log::l("using /proc/partitions since diskdrake failed :("); fs::proc_partitions::use_($hd); } } $hd or next; member($_->{device}, @{$flags->{clear} || []}) and partition_table::remove($hd, $_) foreach partition_table::get_normal_parts($hd); } my @parts = partition_table::get_normal_parts($hd); # checking the magic of the filesystem, do not rely on pt_type foreach (@parts) { if (my $type = fs::type::type_subpart_from_magic($_)) { $type->{pt_type} = $_->{pt_type}; #- keep {pt_type} put_in_hash($_, $type); } else { $_->{bad_fs_type_magic} = 1; } } if ($hd->{usb_media_type}) { $_->{is_removable} = 1 foreach @parts; } push @hds, $hd; } #- detect raids before LVM allowing LVM on raid my $raids = raids(\@hds); my $all_hds = { %{ fs::get::empty_all_hds() }, hds => \@hds, raw_hds => \@raw_hds, lvms => [], raids => $raids }; $all_hds->{lvms} = [ lvms($all_hds) ]; fs::get_major_minor([ fs::get::fstab($all_hds) ]); $_->{faked_device} = 0 foreach fs::get::fstab($all_hds); $all_hds; } #- are_same_partitions() do not look at the device name since things may have changed sub are_same_partitions { my ($part1, $part2) = @_; foreach ('start', 'size', 'pt_type', 'fs_type', 'rootDevice') { $part1->{$_} eq $part2->{$_} or return 0; } 1; } sub is_one_big_fat_or_NT { my ($hds) = @_; @$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) < MB(10); } sub computeSize { my ($part, $best, $all_hds, $suggestions) = @_; my $max = $part->{maxsize} || $part->{size}; return min($max, $best->{size}) unless $best->{ratio}; my %free_space; $free_space{$_->{rootDevice}} += $_->{size} foreach fs::get::holes($all_hds); my @l = my @L = grep { my @possible = $_->{hd} ? $_->{hd} : keys %free_space; my $size = $_->{size}; if (my $dev = find { $free_space{$_} >= $size } @possible) { $free_space{$dev} -= $size; 1; } else { 0 } } @$suggestions; my $free_space = $best->{hd} && $free_space{$best->{hd}} || sum(values %free_space); my $cylinder_size_maxsize_adjusted; my $tot_ratios = 0; while (1) { my $old_free_space = $free_space; my $old_tot_ratios = $tot_ratios; $tot_ratios = sum(map { $_->{ratio} } @l); last if $tot_ratios == $old_tot_ratios; @l = grep { if ($_->{ratio} && $_->{maxsize} && $tot_ratios && $_->{size} + $_->{ratio} / $tot_ratios * $old_free_space >= $_->{maxsize}) { return min($max, $best->{maxsize}) if $best->{mntpoint} eq $_->{mntpoint}; $free_space -= $_->{maxsize} - $_->{size}; if (!$cylinder_size_maxsize_adjusted++) { eval { $free_space += fs::get::part2hd($part, $all_hds)->cylinder_size - 1 }; } 0; } else { $_->{ratio}; } } @l; } my $size = int min($max, $best->{size} + $free_space * ($tot_ratios && $best->{ratio} / $tot_ratios)); #- verify other entry can fill the hole (any { $_->{size} <= $max - $size } @L) ? $size : $max; } sub suggest_part { my ($part, $all_hds, $o_suggestions) = @_; my $suggestions = $o_suggestions || $suggestions{server} || $suggestions{simple}; #- suggestions now use {fs_type}, but still keep compatibility foreach (@$suggestions) { fs::type::set_pt_type($_, $_->{pt_type}) if !exists $_->{fs_type}; } my $hd = fs::get::part2hd($part, $all_hds); my $hd_size = $hd && $hd->{totalsectors}; # nb: no $hd if $part is /dev/mdX my $has_swap = any { isSwap($_) } fs::get::fstab($all_hds); my @local_suggestions = grep { !$_->{mntpoint} && !$_->{VG_name} || !fs::get::has_mntpoint($_->{mntpoint}, $all_hds) || isSwap($_) && !$has_swap } grep { !$_->{min_hd_size} || !$hd_size || $_->{min_hd_size} <= $hd_size } grep { !$_->{hd} || $_->{hd} eq $part->{rootDevice} } @$suggestions; #- this allows specifying the size using a relative size. #- one should rather use {ratio} instead foreach (@local_suggestions) { if ($_->{percent_size} && $_->{percent_size} =~ /(.+?)%?$/) { $_->{size} = $1 / 100 * $hd_size; log::l("in suggestion, setting size=$_->{size} for percent_size=$_->{percent_size}"); } } my ($best) = grep { !$_->{maxsize} || $part->{size} <= $_->{maxsize} } grep { $_->{size} <= ($part->{maxsize} || $part->{size}) } grep { !$part->{fs_type} || $part->{fs_type} eq $_->{fs_type} || isTrueFS($part) && isTrueFS($_) } @local_suggestions; defined $best or return 0; #- sorry no suggestion :( $part->{mntpoint} = $best->{mntpoint}; fs::type::set_type_subpart($part, $best) if !isTrueFS($best) || !isTrueFS($part); $part->{size} = computeSize($part, $best, $all_hds, \@local_suggestions); foreach ('options', 'lv_name', 'encrypt_key', 'primaryOrExtended', 'device_LABEL', 'prefer_device_LABEL', 'device_UUID', 'prefer_device_UUID', 'prefer_device') { $part->{$_} = $best->{$_} if $best->{$_}; } $best; } sub suggestions_mntpoint { my ($all_hds) = @_; sort grep { !/swap/ && !fs::get::has_mntpoint($_, $all_hds) } (@suggestions_mntpoints, map { $_->{mntpoint} } @{$suggestions{server} || $suggestions{simple}}); } #- you can do this before modifying $part->{mntpoint} #- so $part->{mntpoint} should not be used here, use $mntpoint instead sub check_mntpoint { my ($mntpoint, $part, $all_hds) = @_; $mntpoint eq '' || isSwap($part) || isNonMountable($part) and return 0; $mntpoint =~ m|^/| or die N("Mount points must begin with a leading /"); $mntpoint =~ m|[\x7f-\xff]| and cdie N("Mount points should contain only alphanumerical characters"); fs::get::mntpoint2part($mntpoint, [ grep { $_ ne $part } fs::get::really_all_fstab($all_hds) ]) and die N("There is already a partition with mount point %s\n", $mntpoint); if ($mntpoint eq "/" && isRAID($part) && !fs::get::has_mntpoint("/boot", $all_hds)) { my $md_part = fs::get::device2part($part->{raid}, $all_hds->{raids}); cdie N("You've selected a software RAID partition as root (/). No bootloader is able to handle this without a /boot partition. Please be sure to add a /boot partition") if $md_part->{level} ne '1'; # lilo handles / on RAID1 } #- NB: if the LV doesn't exist, lv_nb_pvs returns 0 die N("You can not use the LVM Logical Volume for mount point %s since it spans physical volumes", $mntpoint) if $mntpoint eq '/boot' && isLVM($part) && lvm::lv_nb_pvs($part) > 1; cdie N("You've selected the LVM Logical Volume as root (/). The bootloader is not able to handle this when the volume spans physical volumes. You should create a /boot partition first") if $mntpoint eq "/" && isLVM($part) && lvm::lv_nb_pvs($part) != 1 && !fs::get::has_mntpoint("/boot", $all_hds); cdie N("This directory should remain within the root filesystem") if member($mntpoint, qw(/root)); die N("This directory should remain within the root filesystem") if member($mntpoint, qw(/bin /dev /etc /lib /sbin /mnt /media)); die N("You need a true filesystem (ext2/ext3, reiserfs, xfs, or jfs) for this mount point\n") if !isTrueLocalFS($part) && $mntpoint eq '/'; die N("You need a true filesystem (ext2/ext3, reiserfs, xfs, or jfs) for this mount point\n") if !isTrueFS($part) && member($mntpoint, '/home', fs::type::directories_needed_to_boot()); die N("You can not use an encrypted file system for mount point %s", $mntpoint) if $part->{options} =~ /encrypted/ && member($mntpoint, qw(/ /usr /var /boot)); local $part->{mntpoint} = $mntpoint; fs::loopback::check_circular_mounts($part, $all_hds); } sub add { my ($hd, $part, $all_hds, $options) = @_; isSwap($part) ? ($part->{mntpoint} = 'swap') : $options->{force} || check_mntpoint($part->{mntpoint}, $part, $all_hds); delete $part->{maxsize}; if (isLVM($hd)) { lvm::lv_create($hd, $part); } else { partition_table::add($hd, $part, $options->{primaryOrExtended}); } } sub allocatePartitions { my ($all_hds, $to_add) = @_; my @to_add = @$to_add; foreach my $part_ (fs::get::holes($all_hds, 'non_readonly')) { my ($start, $size, $dev) = @$part_{"start", "size", "rootDevice"}; my ($part, $suggested); while ($suggested = suggest_part($part = { start => $start, size => 0, maxsize => $size, rootDevice => $dev }, $all_hds, \@to_add)) { my $hd = fs::get::part2hd($part, $all_hds); add($hd, $part, $all_hds, { primaryOrExtended => $part->{primaryOrExtended} }); $size -= $part->{size} + $part->{start} - $start; $start = $part->{start} + $part->{size}; @to_add = grep { $_ != $suggested } @to_add; } } } sub auto_allocate { my ($all_hds, $o_suggestions) = @_; my $before = listlength(fs::get::fstab($all_hds)); my $suggestions = $o_suggestions || $suggestions{simple}; allocatePartitions($all_hds, $suggestions); if ($o_suggestions) { auto_allocate_raids($all_hds, $suggestions); if (auto_allocate_vgs($all_hds, $suggestions)) { #- allocatePartitions needs to be called twice, once for allocating PVs, once for allocating LVs my @vgs = map { $_->{VG_name} } @{$all_hds->{lvms}}; my @suggested_lvs = grep { member($_->{hd}, @vgs) } @$suggestions; allocatePartitions($all_hds, \@suggested_lvs); } } partition_table::assign_device_numbers($_) foreach @{$all_hds->{hds}}; if ($before == listlength(fs::get::fstab($all_hds))) { # find out why auto_allocate failed if (any { !fs::get::has_mntpoint($_->{mntpoint}, $all_hds) } @$suggestions) { die N("Not enough free space for auto-allocating"); } else { die N("Nothing to do"); } } } sub auto_allocate_raids { my ($all_hds, $suggestions) = @_; my @raids = grep { isRawRAID($_) } fs::get::fstab($all_hds) or return; require raid; my @mds = grep { $_->{hd} =~ /md/ } @$suggestions; foreach my $md (@mds) { my @raids_ = grep { !$md->{parts} || $md->{parts} =~ /\Q$_->{mntpoint}/ } @raids; @raids = difference2(\@raids, \@raids_); my %h = %$md; delete @h{'hd', 'parts'}; # keeping mntpoint, level, chunk-size, fs_type/pt_type $h{disks} = \@raids_; my $part = raid::new($all_hds->{raids}, %h); raid::updateSize($part); push @raids, $part; #- we can build raid over raid } } sub auto_allocate_vgs { my ($all_hds, $suggestions) = @_; my @pvs = grep { isRawLVM($_) } fs::get::fstab($all_hds) or return 0; my @vgs = grep { $_->{VG_name} } @$suggestions or return 0; partition_table::write($_) foreach @{$all_hds->{hds}}; require lvm; foreach my $vg (@vgs) { my $lvm = new lvm($vg->{VG_name}); push @{$all_hds->{lvms}}, $lvm; my @pvs_ = grep { !$vg->{parts} || $vg->{parts} =~ /\Q$_->{mntpoint}/ } @pvs; @pvs = difference2(\@pvs, \@pvs_); foreach my $part (@pvs_) { raid::make($all_hds->{raids}, $part) if isRAID($part); $part->{lvm} = $lvm->{VG_name}; delete $part->{mntpoint}; lvm::vg_add($part); push @{$lvm->{disks}}, $part; } lvm::update_size($lvm); } 1; } sub change_type { my ($type, $hd, $part) = @_; $type->{pt_type} != $part->{pt_type} || $type->{fs_type} ne $part->{fs_type} or return; fs::type::check($type->{fs_type}, $hd, $part); $hd->{isDirty} = 1; $part->{mntpoint} = '' if isSwap($part) && $part->{mntpoint} eq "swap"; $part->{mntpoint} = '' if isRawLVM($type) || isRawRAID($type); set_isFormatted($part, 0); fs::type::set_type_subpart($part, $type); fs::mount_options::rationalize($part); 1; } sub partition_table_clear_and_initialize { my ($lvms, $hd, $o_in, $o_type, $b_warn) = @_; $hd->clear_existing; partition_table_initialize($lvms, $hd, $o_in, $o_type, $b_warn); } sub partition_table_initialize { my ($lvms, $hd, $o_in, $b_warn, $o_type) = @_; partition_table::initialize($hd, $o_type); if ($hd->isa('partition_table::lvm')) { if ($b_warn && $o_in) { $o_in->ask_okcancel_('', N("ALL existing partitions and their data will be lost on drive %s", partition_table::description($hd))) or return; } require lvm; lvm::check($o_in ? $o_in->do_pkgs : do_pkgs_standalone->new) if $::isStandalone; lvm::create_singleton_vg($lvms, fs::get::hds_fstab($hd)); } } 1; 408' href='#n408'>408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665
package install_steps_gtk; # $Id$

use diagnostics;
use strict;
use vars qw(@ISA);

@ISA = qw(install_steps_interactive interactive::gtk);

#-######################################################################################
#- misc imports
#-######################################################################################
use pkgs;
use install_steps_interactive;
use interactive::gtk;
use common;
use ugtk2 qw(:helpers :wrappers :create);
use devices;
use modules;
use install_gtk;
use install_any;
use mouse;
use help;
use log;

#-######################################################################################
#- In/Out Steps Functions
#-######################################################################################
sub new($$) {
    my ($type, $o) = @_;

    my $old = $SIG{__DIE__};
    $SIG{__DIE__} = sub { $_[0] !~ /ugtk2\.pm/ and goto $old };

    $ENV{DISPLAY} ||= $o->{display} || ":0";
    my $wanted_DISPLAY = $::testing && -x '/usr/X11R6/bin/Xnest' ? ':9' : $ENV{DISPLAY};

    if ($ENV{DISPLAY} =~ /^:\d/ && !$::testing || $ENV{DISPLAY} ne $wanted_DISPLAY) { #- is the display local or distant?
	my $f = "/tmp/Xconf";
	if (!$::testing) {
	    devices::make("/dev/kbd");
	}
	my $launchX = sub {
	    my ($server, $Driver) = @_;
	    my $ok = 1;
	    my $xpmac_opts = cat_('/proc/cmdline');
	    install_gtk::createXconf($f, @{$o->{mouse}}{"XMOUSETYPE", "device"}, $o->{mouse}{wacom}[0], $Driver);

	    mkdir '/var/log' if !-d '/var/log';
	    local $SIG{CHLD} = sub { $ok = 0 if waitpid(-1, c::WNOHANG()) > 0 };

	    my @options = (
	      if_(arch() !~ /^sparc/ && arch() ne 'ppc' && $server ne 'Xnest', 
		  '-kb', '-allowMouseOpenFail', '-xf86config', $f),
	      ($wanted_DISPLAY, 'tty7', '-dpms', '-s', '240'),
	    );

	    push @options, $xpmac_opts !~ /ofonly/ ? ('-mode', '17', '-depth', '32') : '-mach64' if $server =~ /Xpmac/;
	    push @options, '-fp', '/usr/X11R6/lib/X11/fonts:unscaled' if $server =~ /Xsun|Xpmac/;
	    push @options, '-ac', '-geometry', $o->{vga16} ? '640x480' : '800x600' if $server eq 'Xnest';

	    unless (fork()) {
		exec $server, @options or exit 1;
	    }
	    foreach (1..60) {
		sleep 1;
		log::l("Server died"), return 0 if !$ok;
		if (c::Xtest($wanted_DISPLAY)) {
		    if (-x '/usr/bin/aewm-drakx') {
			fork() || exec("aewm-drakx") || c::_exit(0);
		    }
		    return 1;
		}
	    }
	    log::l("Timeout!!");
	    0;
	};
	my @servers = qw(FBDev VGA16); #-)
	if ($::testing) {
	    @servers = 'Xnest';
	} elsif (arch() eq "alpha") {
	    require Xconfig::card;
	    my ($card) = Xconfig::card::probe();
	    Xconfig::card::add_to_card__using_Cards($card, $card->{type}) if $card && $card->{type};
	    @servers = $card->{server} || "TGA";
	    #-@servers = qw(SVGA 3DLabs TGA) 
	} elsif (arch() =~ /^sparc/) {
	    local $_ = cat_("/proc/fb");
	    if (/Mach64/) {
		@servers = qw(Mach64);
	    } elsif (/Permedia2/) {
		@servers = qw(3DLabs);
	    } else {
		@servers = qw(Xsun24);
	    }
	} elsif (arch() =~ /ia64|x86_64/) {
	    require Xconfig::card;
	    my ($card) = Xconfig::card::probe();
	    @servers = map { if_($_, "Driver:$_") } $card && $card->{Driver}, 'fbdev';
	} elsif (arch() eq "ppc") {
	    @servers = qw(Xpmac);
	}

	foreach (@servers) {
	    log::l("Trying with server $_");
	    my $dir = "/usr/X11R6/bin";
	    my ($prog, $Driver) = /Driver:(.*)/ ? ('XFree86', $1) : /Xsun|Xpmac|Xnest/ ? $_ : "XF86_$_";
	    unless (-x "$dir/$prog") {
		unlink $_ foreach glob_("$dir/X*");
		install_any::getAndSaveFile("Mandrake/mdkinst$dir/$prog", "$dir/$prog") or die "failed to get server $prog: $!";
		chmod 0755, "$dir/$prog";
	    }
	    if (/FB/) {
		!$o->{vga16} && $o->{allowFB} or next;

		$o->{allowFB} = &$launchX($prog, $Driver) #- keep in mind FB is used.
		  and goto OK;
	    } else {
		$o->{vga16} = 1 if /VGA16/;
		&$launchX($prog, $Driver) and goto OK;
	    }
	}
	return undef;
    }
  OK:
    $ENV{DISPLAY} = $wanted_DISPLAY;
    install_gtk::init_gtk();
    install_gtk::init_sizes();
    install_gtk::install_theme($o);
    install_gtk::create_logo_window($o);
    install_gtk::create_steps_window($o);

    $ugtk2::force_center = [ $::rootwidth - $::windowwidth, $::logoheight, $::windowwidth, $::windowheight ];

    $o = (bless {}, ref($type) || $type)->SUPER::new($o);
    $o->interactive::gtk::new;
    $o;
}

sub enteringStep {
    my ($o, $step) = @_;

    printf "Entering step `%s'\n", $o->{steps}{$step}{text};
    $o->SUPER::enteringStep($step);
    install_gtk::update_steps_position($o);
#    install_gtk::create_help_window($o); #- HACK: without this it doesn't work (reaches step doPartitionDisks then fail)
}
sub leavingStep {
    my ($o, $step) = @_;
    $o->SUPER::leavingStep($step);
}


sub charsetChanged {
    my ($o) = @_;
    Gtk2->set_locale;
    install_gtk::load_font($o);
    install_gtk::create_steps_window($o);
}

#-######################################################################################
#- Steps Functions
#-######################################################################################
sub selectLanguage {
    my ($o, $first_time) = @_;
    $o->SUPER::selectLanguage;
  
    $o->ask_warn('',
formatAlaTeX(N("Your system is low on resources. You may have some problem installing
Mandrake Linux. If that occurs, you can try a text install instead. For this,
press `F1' when booting on CDROM, then enter `text'."))) if $first_time && availableRamMB() < 70; # 70MB

}

#------------------------------------------------------------------------------
sub selectMouse {
    my ($o, $force) = @_;
    my %old = %{$o->{mouse}};
    $o->SUPER::selectMouse($force) or return;
    my $mouse = $o->{mouse};
    $mouse->{type} eq 'none' ||
      $old{type}   eq $mouse->{type}   && 
      $old{name}   eq $mouse->{name}   &&
      $old{device} eq $mouse->{device} && !$force and return;

    local $ugtk2::grab = 1; #- unsure a crazy mouse don't go wild clicking everywhere

    while (1) {
	my $xId = mouse::xmouse2xId($mouse->{XMOUSETYPE});
	my $x_protocol_changed = $old{device} ne $mouse->{device} || $xId != mouse::xmouse2xId($old{XMOUSETYPE});
	if ($x_protocol_changed) {
	    log::l("telling X server to use another mouse");
	    eval { modules::load('serial') } if $mouse->{device} =~ /ttyS/;

	    if (!$::testing) {
		devices::make($mouse->{device});
		symlinkf($mouse->{device}, "/dev/mouse");
		c::setMouseLive($ENV{DISPLAY}, $xId, $mouse->{nbuttons} < 3);
	    }
	}
	mouse::test_mouse_install($mouse, $x_protocol_changed) and return;

	%old = %$mouse;
	$o->SUPER::selectMouse(1);
	$mouse = $o->{mouse};
    } 
}

sub reallyChooseGroups {
    my ($o, $size_to_display, $individual, $val) = @_;

    my $w = ugtk2->new('');
    my $tips = Gtk2::Tooltips->new;
    my $w_size = Gtk2::Label->new(&$size_to_display);

    my $entry = sub {
	my ($e) = @_;
	my $text = translate($o->{compssUsers}{$e}{label});
	my $help = translate($o->{compssUsers}{$e}{descr});

	my $check = Gtk2::CheckButton->new($text);
	$check->set_active($val->{$e});
	$check->signal_connect(clicked => sub { 
	    $val->{$e} = $check->get_active;
	    $w_size->set_label(&$size_to_display);
	});
	gtkset_tip($tips, $check, $help);
	#gtkpack_(Gtk2::HBox->new(0, 0), 0, gtkpng($file), 1, $check);
	$check;
    };
    my $entries_in_path = sub {
	my ($path) = @_;
	translate($path), map { $entry->($_) } grep { $o->{compssUsers}{$_}{path} eq $path } @{$o->{compssUsersSorted}};
    };
    gtkadd($w->{window},
	   gtkpack_($w->create_box_with_title(N("Package Group Selection")),
		    1, gtkpack_(Gtk2::VBox->new(0, 0),
			   1, gtkpack_(Gtk2::HBox->new(0, 0),
			        $o->{meta_class} eq 'server' ? (
				   1, gtkpack(Gtk2::VBox->new(0, 0), 
					   $entries_in_path->('Server'),
					  ),
				   1, gtkpack(Gtk2::VBox->new(0, 0), 
					   $entries_in_path->('Graphical Environment'),
					   '',
					   $entries_in_path->('Development'),
					   '',
					   $entries_in_path->('Utilities'),
					  ),
				) : $o->{meta_class} eq 'desktop' ? (
				   1, gtkpack(Gtk2::VBox->new(0, 0), 
					   $entries_in_path->('Workstation'),
					  ),
				) : (
				   1, gtkpack(Gtk2::VBox->new(0, 0), 
					   $entries_in_path->('Workstation'),
					   '',
					   $entry->('Development|Development'),
					   $entry->('Development|Documentation'),
					   $entry->('Development|LSB'),
					  ),
				   0, gtkpack(Gtk2::VBox->new(0, 0), 
					   $entries_in_path->('Server'),
					   '',
					   $entries_in_path->('Graphical Environment'),
					  ),
				),
			   )),
		   1, '',
		   0, gtkadd(Gtk2::HBox->new(0, 0),
			  gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => $o->interactive_help_sub_display_id('choosePackages')),
			  $w_size,
			  if_($individual, do {
			      my $check = Gtk2::CheckButton->new(N("Individual package selection"));
			      $check->set_active($$individual);
			      $check->signal_connect(clicked => sub { $$individual = $check->get_active });
			      $check;
			  }),
			  gtksignal_connect(Gtk2::Button->new(N("Next ->")), clicked => sub { Gtk2->main_quit }),
			 ),
		  ),
	  );
    $w->main;
    1;    
}

sub choosePackagesTree {
    my ($o, $packages, $o_limit_to_medium) = @_;

    my $available = install_any::getAvailableSpace($o);
    my $availableCorrected = pkgs::invCorrectSize($available / sqr(1024)) * sqr(1024);

    my $common;
    my $slow = sub {
        my ($func) = @_;
	gtkset_mousecursor_wait($common->{widgets}{tree}->window);
	ugtk2::flush();
	$func->();
	gtkset_mousecursor_normal($common->{widgets}{tree}->window);
    };
    $common = {             get_status => sub {
				my $size = pkgs::selectedSize($packages);
				N("Total size: %d / %d MB", pkgs::correctSize($size / sqr(1024)), $available / sqr(1024));
			    },
			    node_state => sub {
				my $p = pkgs::packageByName($packages, $_[0]) or return;
				pkgs::packageMedium($packages, $p)->{selected} or return;
				$p->arch eq 'src'                       and return;
				$p->flag_base                           and return 'base';
				$p->flag_installed && !$p->flag_upgrade and return 'installed';
				$p->flag_selected                       and return 'selected';
				return 'unselected';
			    },
			    build_tree => sub {
				my ($add_node, $flat) = @_;
				if ($flat) {
				    foreach (sort map { $_->name } grep { !$o_limit_to_medium || pkgs::packageMedium($packages, $_) == $o_limit_to_medium }
					     @{$packages->{depslist}}) {
					$add_node->($_, undef);
				    }
				} else {
				    foreach my $root (@{$o->{compssUsersSorted}}) {
					my (%fl, @firstchoice, @others);
					#$fl{$_} = $o->{compssUsersChoice}{$_} foreach @{$o->{compssUsers}{$root}{flags}}; #- FEATURE:improve choce of packages...
					$fl{$_} = 1 foreach @{$o->{compssUsers}{$root}{flags}};
					foreach my $p (@{$packages->{depslist}}) {
					    !$o_limit_to_medium || pkgs::packageMedium($packages, $p) == $o_limit_to_medium or next;
					    my @flags = $p->rflags;
					    next if !($p->rate && any { any { !/^!/ && $fl{$_} } split('\|\|') } @flags);
					    $p->rate >= 3 ?
					      push(@firstchoice, $p->name) :
						push(@others,    $p->name);
					}
					my $root2 = join('|', map { translate($_) } split('\|', $root));
					$add_node->($_, $root2)                    foreach sort @firstchoice;
					$add_node->($_, $root2 . '|' . N("Other")) foreach sort @others;
				    }
				}
			    },
			    get_info => sub {
				my $p = pkgs::packageByName($packages, $_[0]) or return '';
				$slow->(sub { pkgs::extractHeaders($o->{prefix}, [$p], $packages->{mediums}) });

				my $imp = translate($pkgs::compssListDesc{$p->flag_base ? 5 : $p->rate});

                                my $tag = { 'foreground' => 'royalblue3' };
				$@ ? N("Bad package") :
				  [ [ N("Name: "), $tag ], [ $p->name . "\n" ],
                                    [ N("Version: "), $tag ], [ $p->version . '-' . $p->release . "\n" ],
                                    [ N("Size: "), $tag ], [ N("%d KB\n", $p->size / 1024) ],
                                    if_($imp, [ N("Importance: "), $tag ], [ "$imp\n" ]),
                                    [ "\n" ], [ formatLines(c::from_utf8($p->description)) ] ];
			    },
			    toggle_nodes => sub {
				my $set_state = shift @_;
				my @n = map { pkgs::packageByName($packages, $_) } @_;
				my %l;
				my $isSelection = !$n[0]->flag_selected;
                                $slow->(sub {
                                    foreach (@n) {
                                        #pkgs::togglePackageSelection($packages, $_, my $l = {});
                                        #@l{grep {$l->{$_}} keys %$l} = ();
                                        pkgs::togglePackageSelection($packages, $_, \%l);
                                    }
                                });
				if (my @l = map { $packages->{depslist}[$_]->name } keys %l) {
				    #- check for size before trying to select.
				    my $size = pkgs::selectedSize($packages);
				    foreach (@l) {
					my $p = pkgs::packageByName($packages, $_);
					$p->flag_selected or $size += $p->size;
				    }
				    if (pkgs::correctSize($size / sqr(1024)) > $available / sqr(1024)) {
					return $o->ask_warn('', N("You can't select this package as there is not enough space left to install it"));
				    }

				    @l > @n && $common->{state}{auto_deps} and
				      $o->ask_okcancel('', [ $isSelection ? 
							     N("The following packages are going to be installed") :
							     N("The following packages are going to be removed"),
							     common::formatList(20, sort @l) ], 1) || return;
				    if ($isSelection) {
					pkgs::selectPackage($packages, $_) foreach @n;
				    } else {
					pkgs::unselectPackage($packages, $_) foreach @n;
				    }
				    foreach (@l) {
					my $p = pkgs::packageByName($packages, $_);
					$set_state->($_, $p->flag_selected ? 'selected' : 'unselected');
				    }
				} else {
				    $o->ask_warn('', N("You can't select/unselect this package"));
				}
			    },
			    grep_allowed_to_toggle => sub {
				grep { my $p = pkgs::packageByName($packages, $_); $p && !$p->flag_base } @_;
			    },
			    grep_unselected => sub {
				grep { !pkgs::packageByName($packages, $_)->flag_selected } @_;
			    },
			    check_interactive_to_toggle => sub {
				my $p = pkgs::packageByName($packages, $_[0]) or return;
				if ($p->flag_base) {
				    $o->ask_warn('', N("This is a mandatory package, it can't be unselected"));
				} elsif ($p->flag_installed && !$p->flag_upgrade) {
				    $o->ask_warn('', N("You can't unselect this package. It is already installed"));
				} elsif ($p->flag_selected && $p->flag_installed) {
				    if ($::expert) {
					$o->ask_yesorno('', N("This package must be upgraded.\nAre you sure you want to deselect it?")) or return;
					return 1;
				    } else {
					$o->ask_warn('', N("You can't unselect this package. It must be upgraded"));
				    }
				} else { return 1 }
				return;
			    },
			    auto_deps => N("Show automatically selected packages"),
			    interactive_help_id => 'choosePackagesTree',
			    ok => N("Install"),
			    cancel => N("<- Previous"),
			    icons => [ { icon         => 'floppy',
					 help         => N("Load/Save on floppy"),
					 wait_message => N("Updating package selection"),
					 code         => sub { $o->loadSavePackagesOnFloppy($packages); 1 },
				       }, 
				       if_(0, 
				       { icon         => 'feather',
					 help         => N("Minimal install"),
					 code         => sub {
					     
					     install_any::unselectMostPackages($o);
					     pkgs::setSelectedFromCompssList($packages, { SYSTEM => 1 }, 4, $availableCorrected);
					     1;
					 } }),
				     ],
			    state => {
				      auto_deps => 1,
				      flat      => $o_limit_to_medium,
				     },
			  };

    $o->ask_browse_tree_info('', N("Choose the packages you want to install"), $common);
}

#------------------------------------------------------------------------------
sub beforeInstallPackages {
    my ($o) = @_;    
    $o->SUPER::beforeInstallPackages;
    install_any::copy_advertising($o);
}

#------------------------------------------------------------------------------
sub installPackages {
    my ($o, $packages) = @_;

    my ($current_total_size, $last_size, $nb, $total_size, $start_time, $last_dtime, $_trans_progress_total);

    my $w = ugtk2->new(N("Installing"));
    $w->sync;
    my $text = Gtk2::Label->new;
    my ($advertising, $change_time, $i);
    my $show_advertising if 0;
    $show_advertising = to_bool(@install_any::advertising_images) if !defined $show_advertising;
    my $detail_or_not = sub { $show_advertising ? N("Details") : N("No details") };
    my ($msg, $msg_time_remaining, $msg_time_total) = map { Gtk2::Label->new($_) } '', (N("Estimating")) x 2;
    my ($progress, $progress_total) = map { Gtk2::ProgressBar->new } (1..2);
    gtkadd($w->{window}, my $box = Gtk2::VBox->new(0,10));
    $box->pack_end(gtkshow(gtkpack(Gtk2::VBox->new(0,5),
			   $msg, $progress,
			   create_packtable({},
					    [N("Time remaining "), $msg_time_remaining],
#					    [N("Total time "), $msg_time_total],
					   ),
			   $text,
			   $progress_total,
			   gtkadd(create_hbox(),
				  my $cancel = Gtk2::Button->new(N("Cancel")),
				  my $details = Gtk2::Button->new($detail_or_not->()),
				  ),
			  )), 0, 1, 0);
    $details->hide if !@install_any::advertising_images;
    $w->sync;
    $msg->set_label(N("Please wait, preparing installation..."));
    gtkset_mousecursor_normal($cancel->window);
    gtkset_mousecursor_normal($details->window);
    my $advertize = sub {
	@install_any::advertising_images or return;
	$show_advertising ? $_->hide : $_->show foreach $msg, $progress, $text;
	gtkdestroy($advertising) if $advertising;
	if ($show_advertising && $_[0]) {
	    $change_time = time();
	    my $f = $install_any::advertising_images[$i++ % @install_any::advertising_images];
	    log::l("advertising $f");
	    my $pl = $f; $pl =~ s/\.png$/.pl/;
	    my $icon_name = $f; $icon_name =~ s/\.png$/_icon.png/;
	    my ($draw_text, $width, $height, $y_start, $title, @text);
	    -e $pl and $draw_text = 1;
	    eval(cat_($pl)) if $draw_text;
	    my $pix = gtkcreate_pixbuf($f);
	    my $dbl_area;
	    my $darea = Gtk2::DrawingArea->new;
	    gtkpack($box, $advertising = !$draw_text ?
		    gtkcreate_img($f) :
		    gtksignal_connect(gtkset_size_request($darea, $width, $height), expose_event => sub {
			       my (undef, undef, $dx, $dy) = $darea->allocation->values;
			       if (!defined($dbl_area)) {
				   $darea->window->draw_rectangle($darea->style->bg_gc('active'), 1, 0, 0, $dx, $dy);
				   $pix->render_to_drawable($darea->window, $darea->style->bg_gc('normal'), 0, 0,
							    ($dx-$width)/2, 0, $width, $height, 'none', 0, 0);

                                   my ($width, $lines, $widths, $heights) = wrap_paragraph([ $title, '', @text ], $darea, 520);
                                   my $i = 0;
                                   foreach (@$lines) {
                                       my $layout = $darea->create_pango_layout($_);
                                       my $draw_lay = sub {
                                           my ($gc, $decx) = @_;
                                           $darea->window->draw_layout($gc,
                                                                       ($dx-$width)/2 + $widths->[$i] + $decx,
                                                                       $y_start + $heights->[$i],
                                                                       $layout);
                                       };
                                       $draw_lay->($darea->style->black_gc, 0);
                                       $i == 0 and $draw_lay->($darea->style->black_gc, 1);
                                       $i++;
                                   }
			       }
			   }));
	} else {
	    $advertising = undef;
	}
    };

    $cancel->signal_connect(clicked => sub { $pkgs::cancel_install = 1 });
    $details->signal_connect(clicked => sub {
	invbool \$show_advertising;
	$details->set_label($detail_or_not->());
	$advertize->(1);
    });
    $advertize->();

    my $oldInstallCallback = \&pkgs::installCallback;
    local *pkgs::installCallback = sub {
	my ($data, $type, $id, $subtype, $amount, $total) = @_;
	if ($type eq 'user' && $subtype eq 'install') {
	    #- $amount and $total are used to return number of package and total size.
	    $nb = $amount;
	    $total_size = $total; $current_total_size = 0;
	    $start_time = time();
	    $msg->set_label(N("%d packages", $nb));
	    $w->flush;
	} elsif ($type eq 'inst' && $subtype eq 'start') {
	    $progress->set_fraction(0);
	    my $p = $data->{depslist}[$id];
	    $msg->set_label(N("Installing package %s", $p->name));
	    $current_total_size += $last_size;
	    $last_size = $p->size;
	    $text->set_label((split /\n/, c::from_utf8($p->summary))[0] || '');
	    $advertize->(1) if $show_advertising && $total_size > 20_000_000 && time() - $change_time > 20;
	    $w->flush;
	} elsif ($type eq 'inst' && $subtype eq 'progress') {
	    $progress->set_fraction($total ? $amount / $total : 0);

	    my $dtime = time() - $start_time;
	    my $ratio = 
	      $total_size == 0 ? 0 :
		pkgs::size2time($current_total_size + $amount, $total_size) / pkgs::size2time($total_size, $total_size);
	    $ratio >= 1 and $ratio = 1;
	    my $total_time = $ratio ? $dtime / $ratio : time();

	    $progress_total->set_fraction($ratio);
	    if ($dtime != $last_dtime && $current_total_size > 80_000_000) {
		$msg_time_total->set_label(formatTime(10 * round($total_time / 10) + 10));
#-		$msg_time_total->set_label(formatTimeRaw($total_time) . "  " . formatTimeRaw($dtime / $ratio2));
		$msg_time_remaining->set_label(formatTime(10 * round(max($total_time - $dtime, 0) / 10) + 10));
		$last_dtime = $dtime;
	    }
	    $w->flush;
	} else { goto $oldInstallCallback }
    };
    #- the modification is not local as the box should be living for other package installation.
    undef *install_any::changeMedium;
    *install_any::changeMedium = sub {
	my ($method, $medium) = @_;

	#- if not using a cdrom medium, always abort.
	if ($method eq 'cdrom' && !$::oem) {
	    local $ugtk2::grab = 1;
	    my $name = pkgs::mediumDescr($o->{packages}, $medium);
	    local $| = 1; print "\a";
	    my $time = time();
	    my $r = $name !~ /commercial/i || ($o->{useless_thing_accepted2} ||= $o->ask_from_list_('', formatAlaTeX(install_messages::com_license()), [ N_("Accept"), N_("Refuse") ], "Accept") eq "Accept");
            $r &&= $o->ask_okcancel('', N("Change your Cd-Rom!

Please insert the Cd-Rom labelled \"%s\" in your drive and press Ok when done.
If you don't have it, press Cancel to avoid installation from this Cd-Rom.", $name), 1);
            #- add the elapsed time (otherwise the predicted time will be rubbish)
            $start_time += time() - $time;
            return $r;
	}
    };
    my $install_result;
    catch_cdie { $install_result = $o->install_steps::installPackages($packages) }
      sub {
	  if ($@ =~ /^error ordering package list: (.*)/) {
	      $o->ask_yesorno('', [
N("There was an error ordering packages:"), $1, N("Go on anyway?") ], 1) and return 1;
	      ${$_[0]} = "already displayed";
	  } elsif ($@ =~ /^error installing package list: (.*)/) {
	      $o->ask_yesorno('', [
N("There was an error installing packages:"), $1, N("Go on anyway?") ], 1) and return 1;
	      ${$_[0]} = "already displayed";
	  }
	  0;
      };
    if ($pkgs::cancel_install) {
	$pkgs::cancel_install = 0;
	die 'already displayed';
    }
    $w->destroy;
    $install_result;
}

sub summary_prompt {
    my ($o, $l, $check_complete) = @_;

    my $w = ugtk2->new('');

    my $set_entry_labels;
    my @table;
    my %group;
    foreach my $e (@$l) {
	$group{$e->{group}} ||= do {
	    push @table, [ gtkpack__(Gtk2::HBox->new(0, 0), $e->{group}), '' ];
	};
	$e->{widget} = Gtk2::Label->new;
	$e->{widget}->set_property(wrap => 1);
	$e->{widget}->set_size_request($::windowwidth * 0.65, -1);
	push @table, [], [ gtkpack__(Gtk2::HBox->new(0, 30), '', $e->{widget}),
			   gtksignal_connect(Gtk2::Button->new(N("Configure")), clicked => sub { 
						 $w->{rwindow}->hide;
						 $e->{clicked}(); 
						 $w->{rwindow}->show;
						 $set_entry_labels->();
					     }) ];
    }

    $set_entry_labels = sub {
	foreach (@$l) {
	    my $t = $_->{val}() || '<span foreground="red">' . N("not configured") . '</span>';
	    $_->{widget}->set_markup($_->{label} . ' - ' . $t);
	}
    };
    $set_entry_labels->();

    my $help_sub = $o->interactive_help_sub_display_id('summary');

    gtkadd($w->{window},
	   gtkpack_(Gtk2::VBox->new(0,5),
		    1, create_scrolled_window(create_packtable({ mcc => 1 }, @table)),
		    0, $w->create_okcancel(undef, '', '', if_($help_sub, [ N("Help"), $help_sub, 1 ]))
		  ));

    $w->main($check_complete);
}

1;