-URGENT--------------------------------------------------------------------------------- check for fpons/pixel BOTH that resize_fat is clean for current version relative to 7.0-2. heavy testing of diskdrake to avoid corrupting partition table, current version should be available to fix bogus partition table, writing enabled only when partition is Ok (fixme? allow primary partition inside extended one, but with warning on diskdrake startup, made them as warning ?). -features------------------------------------------------------------------------------- add rpmdrake in menu (7.1 or later) clean SCSI CDROM autoboot. (done,gc,8.0) stage1 & cdrom: add ability in expert to choose the scsi cdrom drive to use (7.1)better help for partitioning in newbie (7.1)Improved network configuration (PPP and/or Ethernet) PPPoE install and configuration (SuSE includes it, DHCP-like) (7.1)standalone applications for configuration (netdrake, timetool, authentificationconf, soundcard) ---- (7.2) replace normal with standard (in the installClass's) (7.2 or later)horizontal sub-steps (7.2 or later)diskdrake in text mode ask "do you have SCSI?" before asking "probe PCI or not" (?) paride in stage1 (done,gc,8.0) stage1 & network: add ability to choose the network interface to use (?) msec custom (?)firewall configuration (instant firewalling?) (?)widget for displaying fdisk (dindinx) add fdisk using the zvt widget (taken in gnome-libs) (?)help in some configuration files. ability to add nfs/weird_fs entries in fstab size of packages in crypto -to test-------------------------------------------------------------------------------- what's lseek64? ensure installClass is set to something in auto install. for axp, swriteboot -f1 if swriteboot failed. axp with swap part sigsegv tree for choosing monitors (buggy?) what happens if a module fails to insmod (scsi step), in beginner/normal/expert fstab must be sorted (/usr/local after /usr) RAID upgrades add choice clean /tmp or not in expert kernel chosen by default must be the one according to supermount/secure bug if ide-scsi, no more hdX, but scd0 (aka sr0) (and add alias block-major-11 ide-scsi ?) check on update for conf.modules and modules.conf ! with /usr, /usr/local and /usr/local/e mount points i get an error at step mounting local filesystems -easy fixes----------------------------------------------------------------------------- rpmdrake proposition for cdrom labels use option nocheck to mount for upgrades -fixes needing thinking----------------------------------------------------------------- bug: changing mem= in miscellaneous doesn't modify lilo conf if you backtrack ask network configuration only if NIC found? configure DHCP for newbies if ethernet & DHCP card available xvidtune like screen configuration (see SuSE's yast) live cdrom for alpha (sparc?) network boot get the error when getting/reading .rpm files fail better timeout handling for network installs handle not enough room for update (fpons)verify the free space is big enough. the XFdrake test does not handle the fontset > Here I go into the printer configuration select 'HP Deskjet 722C Colour', > print a test ASCII page, pressing 'No' when prompted to indicate the page did > not print OK and then hitting cancel when prompted to choose a printer type > again. > ask_from_list cancel at /usr/lib/libDrakX/my_gtk.pm line 504. diskdrake: take from parted mklabel, hide(?) bug in kde desktop if keeps home but not an upgrade bug in users: mandrake user is added twice in strange installs (mixed of security 0 + ???) bugs rpmdrake: - just after installing a package, switch to `Installed', the package has wrong name - refresh the kde desktop after package installation in rpmdrake (restart kpanel) - rpmdrake and same name packages urpmi: pb if XXX-devel requires XXX = 1.2.3 and we updgrade XXX-1.2.3 bug in defcfg in with lang=fr_FR, display is buggy bug keyboard focus: after switch in console at Xconfig step -to look at-------------------------------------------------------------------------- adduserdrake to remove/update users (???)free provider auto configuration facility (to be discussed). auto ppp-configure with free provider (?)on laptop, configure the MMU to use swap not very often (?)checkboxes in groups based on compssList (and availableSpace?) (?)see what can be done with nvram (50 bytes to save information) better wacom support (fpons)bug: CANON BJC 4X00 do not work with current rhs-printfilters (work with magicfilters (debian)) (should be handled by ghostscript BJC600's driver) (pix)install text on mem=8M, mem=16M? (pix)kickstart partitioning? raid? X configuration and bootloader in kickstart XFdrake chooseResolutions with ask_from_list do not permit ``Show all'' (?) options in mkfs, progress bar when formatting (?) when some error occurs, partition must be unset isFormatted -hardware------------------------------------------------------------------------------- - with no floppy drive, mkbootdisk step fails badly - with bad floppy or write protected, mkbootdisk doesn't say anything - try detect_devices::floppies (and how are scsi floppies handled?) maybe: do a iotcl FDGETPRM to detect fd1, fd0. need a simple solution to precise mouse type (syslinux option?) ELSA Gloria has bad ddc info token ring is tr0 not eth0 I have Mandrake 6.1 installed and working on a ThinkPad 770. To enable the PCMCIA Token ring I have to append the following line to /etc/pcmcia/config.opts module "ibmtr_cs" opts "mmiobase=0xd2000 srambase=0xd4000" smp not detected (mhoward@memphisonline.com on cooker, bios=BP6PW) UDMA66 (ultra66.o for promise) aha152x needs "insmod aha152x.o aha152x=0x140,11,7" (obsolete) usb module not removed if no mouse found (fpons)handle dat drives hibernation on laptop -> clock not restored # in 2.3.15 "Silicon Integrated Systems [SiS]|SiS900 10/100 Ethernet" is handled (?)enable the testing of the mouse type (under X) (wheel) possibility to specify the mouse -(?)--------------------------------------------------------------------------------- (?) handle NT (add entry for it in lilo, put it in fstab) (?) lilo-0.22-19mdk is buggy with boot=/dev/hde & root=/dev/sda13, it needs disk=/dev/hde bios=0x80 & disk=/dev/sda bios=0x81 (?)using setxkb, enable the testing of the keyboard (?)XFdrake does not handle fbdev (?) Je viens de faire une installation sur une machine où seul Be était installé. Je l'ai supprimé et installé (mode recommandé) Oxygen. Au redémarrage, le boot manager de Be apparaît et il est impossible de démarrer Linux. Pourquoi ne pas installer LILO si on supprime toutes les partitions ? (?)initrd in bzip2 (?)smaller zsh (or ash in initrd) (?)is configureNetworkNet needed with dhcp/bootp? (?)bug in upgrade: install from hda1:/usr/local/blah with hda1:/ (?)mandrake_desk was not installed while kdebase it there on upgrade (?)when clicking on X configuration, installation of packages is not displayed (?)maybe remove commented lines in /usr/lib/perl5/... files (?)timezone using a picture (pb: how to delimit zones) when asking GMT or not, display the time for each possibility the list is too big for USA (?)ability to select the type of install when booting of cdrom (?)use the ability of el torito to handle 2.88MB or more (obsolete)lilo-deinstallation in case of lilo auto-installation for beginners (?)loadFont sucks (obsolete)trash on the screen when X first starts (?)remove the gray line surrounding the logo (?)cleanup /etc/services & /etc/protocols (?)strange: no scsi of type 'fd', only 'tape' (?)remount ro before X test. (?)remove every << and >> (doesn't handle > 32bits) -done--------------------------------------------------------------------------------- (7.1,done,fpons) improve printerdrake to at least have the same functionalities as printtool. (done,fpons)diskdrake can olverlap partitions (resize lower, resize original typically after clear all and auto allocate, try maximal size available). (done,fpons)rewrite mouseconfig in perl? (done,pix)kudzu or not in miscellaneous (done,pix)warn the user if not enough ram to fulfill install (done,fpons)test after printer config (done,pix)ask for more than the memory size detected (done,fpons)modem config (done,pix)call kudzu in batch to initialize its list (done,pix)standalone generator of mdkinst_stage2.gz (done,pix)text install (done,pix) if u choose mouse usb != found mouse, it fails at X config (done,pix) diskdrake bug: saved information on floppy contains isMounted. (done,pix) update devices.c from modules.pm (done,pix) in lilo.conf, put disk=/dev/hdb bios=0x80 (done,pix) diskdrake auto_partitions suggested partition tables must be better foreach installClass (done,pix) update the list of modules (in update_kernel) (done,pix) language support: only choose the right locales and upmark the packages requiring it (done,pix) move security question before isntallation of packages (done,pix) install ssh (done,fpons,pix) change the boot message of syslinux (have something different from RedHat) (done,pix) install_steps.pm: 569 (128M + 3) (done,pix) bug: mouse freeze just before network configuration (mouse primax) (was kudzu) (done,pix) signal 11 in stage1 nfs kickstart mount failed (done,pix) ask supermount or not, no supermount with kernel-secure (done,pix) fix bug in g_auto_install (can't go through all) (done,pix) bug: install from ciril.fr fails (done,pix)wizard for partitioning in case of one full vfat (done,dindinx)app for choosing drakxtools (drakxconf) (done,pix)verify being root (done,pix)log::l -> initlog (done,pix)install apmd for laptops (maybe not start apmd though) (done,pix)icewm apm (sh icewm_apm) (done,pix)kde apm (put Kapm.kdelnk in ~/Desktop/Autostart) (done,pix)bug in adduserdrake: missing pwconv in md5 (done,pix)correct the default value of draksec (cp draksec) (done,pix)in draksec, (and maybe others) have --expert as default if /etc/sysconfig/system has TYPE=expert (done,pix)bug in XFdrake in install, cancel in choose Card do not close the window (done,pix)in XFdrake, testing should not overwrite /etc/X11/XF86Config (done,pix) hwiz and supermount and eject :( (done(replaced by msec's),pix) bug: usermod -G urpmi a not done (full install) (done,pix)perl and .ph's (done,pix) BUG bootp in network install sigsegv (done,pix) move the last done stuff before Xconfiguration if possible (done,pix)draksec is buggy, don't try security >= 4 (done,pix)install apmd on laptops?? (maybe ask emcweb@btinernet.com (see alix)) (done,pix)missing alias ll for root (done,pix)urpmi.addmedia: |gzip instead of doing it afterwards (done,pix)locale (and fonts?) buggy in case ramdisk is used (done,pix)rpmdrake: Installed packages not in hdlist should be there (done)in ftp install, locale not installed properly (done,pix)pcmcia.img does not handle hd/cdrom (done,pix)cyrillic font buggy in DrakX (done,fred)remove xfs user from kdm (done,pix)bug with 2 cdrom drives (.kdelnk to there for 1st drive) (done,pix(works))test ramdisk stage2 and romanian (done,pix)kfmrc (done,pix)on laptop, default to 1024x768 (done,pix)mkinitrd and deps (done,fred(removed the call))XFdrake and mousedrake freeze if lothar launches them (done,pix)crypto message (done,pix)test bug with lilo and windows (if not on mbr) (done,pix)removed icons come back later (kde desktop) (done,pix(was bug in upgrade reading old config)) segfault in linuxconf (adapter 1 empty) (test with the sysconfig sent) (done,fpons)bug: Lrosqu'on effectue une mise à jour et que /etc/lilo.conf contient la variable « default » positionnée sur autre chose que « linux » ou « windows », DrakX est incapable de générer LILO. (done,fpons)bug: GeForce and hd.img? (done,fpons)for upgrade in expert, give choice of packages to install choosing packages available in upgrade? (done,pix)rpmdrake: pb uninstalling package with dependencies (rpmdrake is killed?!) (as root too) (done,pix)noatime option for ext2 fs on laptops (do not wake up the hd) Do not update inode access times on this file system (e.g, for faster access on the news spool to speed up news servers). (done,pix)kde's icons: 28 horiz and 25 vert grid for big icons (done,pix)bug: DrakConf don't follow the charset -> add setlocale(LC_ALL, "") (done,pix)for ko|ja|zh, gnome-terminal should point to rxvt (-CLE) (done,pix)group cdrom in /etc/group (gid=22) (done,pix)drakxtools should require urpmi (done,pix)bug: gdm unset LANG (done,pix) zip with automount -> ppa not autoloaded (done,pix)when you set the kde icons to Large, maybe it'd be good to chown the .kderc (done,pix)lilo in russian/japaneese is horrible (ok,pix)test ide burners (ok)test check bad blocks optional for mke2fs (done,pix)hd install: no umount is done at the end of install :( just before release: (done,pix)- mandrake_doc-xx, the symlink is no good in /usr/doc/mandrake as (done,pix)- crypto dependencies to update (done,pix)- update kudzu's pcitable (done,pix)- update pcitable for 86C368 if 3.3.6 (and other S3 3D's) ("ATI|3D Rage P/M Mobility AGP 2x" -> changed to Server:Mach64) (done,pix)with 2MB of video ram, chooses 8bpp instead of 16bpp (done,pix) replace { device => "loop7", type => 0x83, size => ((cat_('/dos/lnx4win/size.txt'))[0]*2048), mntpoint => "/", isFormatted => 1, isMounted => 1 }, by { device => "loop7", type => 0x83, size => cat_('/dos/lnx4win/size.txt') * 2048, mntpoint => "/", isFormatted => 1, isMounted => 1 }, (done,fpons)in ftp install, bug with X server install with wu-ftpd 2.6 (see http://www.wu-ftpd.org/broken-clients.html) (done,pix)ask package installation languages (must be put in RPM_INSTALL_LANG) (done,pix)bug (by dadou): Si la partition racine est trop petite pour installer le système, un message d'erreur apparaît pour signaler le problème (bien) mais on ne peut en sortir. La seule solution est de redémarrer. (obsolete)bug when selecting compssUsers, do not deselect after (if u deselect) (done,pix)detect ide burners and then add hdX=ide-scsi to kernel cmdline (done,pix)urpmi: handle many args on cmd-line (done,pix)fix any // in path to ftp server otherwise windobe server bug :( (done,pix)diskdrake and auto partitioning, may have the last creation of partition rejected, try to figure why? (done,pix)in chooseResolutions: display the graphic card found (done,pix)with pcmcia, need ONBOOT=no (fpons,done) XFree: handle by card options eg: SIS6326 needs "no_bitblt" "no_bltimage" and 24bpp instead of 32bpp (done,pix) Xconfiguration: if "can't open fixed font", relaunch xfs. (obsolete) pb with dependencies ``missing'': icewm do not require XFree86 and so you can have icewm but no X server (obsolete) bug in ext2resizing (no sparse superbloc, don't finish properly) (done,pix,7.1)manage a lot of language (ergonomic issue as it already exists) (done,pix,7.1)tree for choosing things like timezone, monitors, graphic cards, modules, mice, keyboard? ... (done,pix,7.1)sound config, although very simple, no dedicated steps and only PCI (or maybe ISA-PNP if time left ?) (done,pix,7.1)partitioning, keyboard shortcut. (done,fpons,7.1)index/compress hdlist? (for multi-cd) ! for multi-cd live is mandatory, small transaction are mandatory too. (done,pix,7.1?)loopback partitions (even root one) (done,pix)in ok_cancel, focus has 3 states, should be 2 (ask dindinx) (done,pix,7.1)Generally improved package selection /ergonmic issue. Tree -> CTree, ``all'' branch with all packages show the value associated (100->a must, 90->great, 80->nice, ... 10->useless, 0->do not install) (done,pix)let diskdrake have dos/win partition automatically set up with mount point, this will help loopback too. (done,pix,7.1)grub (done,pix,7.1)feature missing: cancel installation (obsolete) bug in diskdrake: can in strange cases create a primary partition at sector #0 (done,pix(partly, protection against bugging))bug in diskdrake: in expert: blank, create hda5 at beginning, create hda6 at the end, create hda7 in the middle, remove the first one. Result hda5 at the end and bug. (obsolete) have a better time estimation of the remaining time in install packages (done,dindinx+pix)ask_many_from_list can't keyboard scroll (done,pix,7.1)individual package selection: double click is tiring... (done,fpons,7.1) sparc ehancement, avoid V7+ machine target (div and mul not in v7 standard) (done,fpons,7.1)syslinux in graphical mode to be improved for heavily bogus BIOSes. (done,pix)missing feature in lilo configuration: can't give hda2 with /boot/vmlinuz if already hda1 with /boot/vmlinuz (done,pix)in 640x480 install box is to small (cuz of 'Cancel' button beeing added) (done,pix)chooseGroup with individual alone (done)(7.1) rewrite crypto stuff (done)crypto: add a cancel & progress bar while downloading (done)error handling (like reading hdlist) (done)(7.1)progression bar on crypto. (done, daouda&pix,7.1, other persons)rescue: - small modification for stage1 to get the rescue stage2 - create a stage2 with many tools (fdisk, bash...) the rescue could be on another cd (if multi-cd) ! care must be taken about modules (if ide is in module...) (done,7.1)install in 800x600 - need handling of both 640x480 (mostly for VGA16) and 800x600 (done,NEED 7.1) auto-install for corporate, very important (need consolidation). f='#n355'>355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 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 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691
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) = @_;

    $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) = @_;

	    mkdir '/var/log' if !-d '/var/log';

	    my @options = $wanted_DISPLAY;
	    if ($server eq 'Xnest') {
		push @options, '-ac', '-geometry', $o->{vga16} ? '640x480' : '800x600';
	    } elsif (!$::move) {
		install_gtk::createXconf($f, @{$o->{mouse}}{"XMOUSETYPE", "device"}, $o->{mouse}{wacom}[0], $Driver);

		push @options, '-kb', '-allowMouseOpenFail', '-xf86config', $f if arch() !~ /^sparc/ && arch() ne 'ppc';
		push @options, 'tty7', '-dpms', '-s', '240';

		#- old weird servers: Xpmac and Xsun
		push @options, cat_('/proc/cmdline') !~ /ofonly/ ? ('-mode', '17', '-depth', '32') : '-mach64' if $server =~ /Xpmac/;
		push @options, '-fp', '/usr/X11R6/lib/X11/fonts:unscaled' if $server =~ /Xsun|Xpmac/;
	    }

	    if (!fork()) {
		c::setsid();
		exec $server, @options or c::_exit(1);
	    }
	    my $nb;
	    foreach (1..60) {
		sleep 1;
		log::l("Server died"), return 0 if !fuzzy_pidofs(qr/\b$server\b/);
		$nb++ if c::Xtest($wanted_DISPLAY);
		if ($nb > 2) { #- one succeeded test is not enough :-(
		    $ugtk2::force_focus = 1;
		    log::l("AFAIK X server is up");
		    return 1;
		}
	    }
	    log::l("Timeout!!");
	    0;
	};
	my @servers = qw(Driver:fbdev); #-)
	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);
        }

        if ($::move && !$::testing) {
            require move;
            require run_program;
            move::automatic_xconf($o);
            run_program::run('/sbin/service', 'xfs', 'start');
            @servers = qw(X_move);
	}

	foreach (@servers) {
	    log::l("Trying with server $_");
	    my $dir = "/usr/X11R6/bin";
	    my ($prog, $Driver) = /Driver:(.*)/ ? ('XFree86', $1) : /Xsun|Xpmac|Xnest|^X_move$/ ? $_ : "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;
	    }
            $::move and print("can't launch graphical mode :(\n"), c::_exit(1);
	}
	return undef;
    }
  OK:
    $ENV{DISPLAY} = $wanted_DISPLAY;
    install_gtk::init_gtk($o);
    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 ($mouse->{XMOUSETYPE}, $xId)");
	    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_medium) = @_;

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

    my $common;
    $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_medium || pkgs::packageMedium($packages, $_) == $o_limit_medium }
					     grep { $_ && $_->arch ne 'src' }
					     @{$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_medium || pkgs::packageMedium($packages, $p) == $o_limit_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 '';
				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 $isSelection = 0;
				my %l = map { my $p = pkgs::packageByName($packages, $_);
					      $p->flag_selected or ++$isSelection;
					      $p->id => 1 } @_;
				my $state = $packages->{state} ||= {};
				my @l = $isSelection ? $packages->resolve_requested($packages->{rpmdb}, $state, \%l,
										    callback_choices => \&pkgs::packageCallbackChoices) :
						       $packages->disable_selected($packages->{rpmdb}, $state,
										   map { $packages->{depslist}[$_] } keys %l);
				my $size = pkgs::selectedSize($packages);
				my $error;

				if (!@l) {
				    #- no package can be selected or unselected.
				    my @ask_unselect = grep { $state->{rejected}{$_}{backtrack} &&
								exists $l{$packages->search($_, strict_fullname => 1)->id} }
				      keys %{$state->{rejected} || {}};
				    #- extend to closure (to given more detailed and not absurd reason).
				    my %ask_unselect;
				    while (@ask_unselect > keys %ask_unselect) {
					@ask_unselect{@ask_unselect} = ();
					foreach (keys %ask_unselect) {
					    foreach (keys %{$state->{rejected}{$_}{backtrack}{closure} || {}}) {
						next if exists $ask_unselect{$_};
						push @ask_unselect, $_;
					    }
					}
				    }
				    $error = [ N("You can't select/unselect this package"),
					       formatList(20, map { my $rb = $state->{rejected}{$_}{backtrack};
									    my @froms = keys %{$rb->{closure} || {}};
									    my @unsatisfied = @{$rb->{unsatisfied} || []};
									    my $s = join ", ", ((map { N("due to missing %s", $_) } @froms),
												(map { N("due to unsatisfied %s", $_) } @unsatisfied),
												$rb->{promote} && !$rb->{keep} ? N("trying to promote %s", join(", ", @{$rb->{promote}})) : @{[]},
												$rb->{keep} ? N("in order to keep %s", join(", ", @{$rb->{keep}})) : @{[]},
											       );
									    $_ . ($s ? " ($s)" : '');
									} sort @ask_unselect) ];
				} elsif (pkgs::correctSize($size / sqr(1024)) > $available / sqr(1024)) {
				    $error = N("You can't select this package as there is not enough space left to install it");
				} elsif (@l > @_ && $common->{state}{auto_deps}) {
				    $o->ask_okcancel('', [ $isSelection ? 
							   N("The following packages are going to be installed") :
							   N("The following packages are going to be removed"),
							       formatList(20, sort(map { $_->name } @l)) ], 1) or $error = ''; #- defined
				}
				$error and $o->ask_warn('', $error);
				if (defined $error) {
				    #- disable selection (or unselection).
				    $isSelection ? $packages->disable_selected($packages->{rpmdb}, $state, @l) :
				                   $packages->resolve_requested($packages->{rpmdb}, $state, \%l,
										callback_choices => \&pkgs::packageCallbackChoices);
				} else {
				    #- keep the changes, update visible state.
				    foreach (@l) {
					$set_state->($_->name, $_->flag_selected ? 'selected' : 'unselected');
				    }
				}
			    },
			    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) {