package standalone; # $Id$ use c; use strict; use common qw(N N_ if_ backtrace); use Config; BEGIN { unshift @::textdomains, 'libDrakX-standalone' } #- for sanity (if a use standalone is made during install, MANY problems will happen) require 'log.pm'; #- "require log" causes some pb, perl thinking that "log" is the log() function if ($::isInstall) { log::l('ERROR: use standalone made during install :-('); log::l('backtrace: ' . backtrace()); } $::isStandalone = 1; $ENV{SHARE_PATH} ||= "/usr/share"; eval { #- allow standalone.pm to be used in drakxtools-backend without perl-Locale-gettext c::init_setlocale(); Locale::gettext::bindtextdomain('libDrakX', "/usr/share/locale"); }; $::license = N_("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. "); my $progname = common::basename($0); my %usages = ( 'diskdrake' => "[--{" . join(",", qw(hd nfs smb dav removable fileshare)) . "}]", 'drakbackup' => N_("[--config-info] [--daemon] [--debug] [--default] [--show-conf] Backup and Restore application --default : save default directories. --debug : show all debug messages. --show-conf : list of files or directories to backup. --config-info : explain configuration file options (for non-X users). --daemon : use daemon configuration. --help : show this message. --version : show version number. "), 'drakboot' => N_("[--boot] [--splash] OPTIONS: --boot - enable to configure boot loader --splash - enable to configure boot theme default mode: offer to configure autologin feature"), 'drakbug' => N_("[OPTIONS] [PROGRAM_NAME] OPTIONS: --help - print this help message. --report - program should be one of Mandriva Linux tools --incident - program should be one of Mandriva Linux tools"), 'drakconnect' => N_("[--add] --add - \"add a network interface\" wizard --del - \"delete a network interface\" wizard --skip-wizard - manage connections --internet - configure internet --wizard - like --add"), 'drakfont' => N_(" Font Importation and monitoring application OPTIONS: --windows_import : import from all available windows partitions. --xls_fonts : show all fonts that already exist from xls --install : accept any font file and any directory. --uninstall : uninstall any font or any directory of font. --replace : replace all font if already exist --application : 0 none application. : 1 all application available supported. : name_of_application like so for staroffice : and gs for ghostscript for only this one."), 'draksec' => "[--debug] --debug: print debugging information", 'drakTermServ' => N_("[OPTIONS]... Mandriva Linux Terminal Server Configurator --enable : enable MTS --disable : disable MTS --start : start MTS --stop : stop MTS --adduser : add an existing system user to MTS (requires username) --deluser : delete an existing system user from MTS (requires username) --addclient : add a client machine to MTS (requires MAC address, IP, nbi image name) --delclient : delete a client machine from MTS (requires MAC address, IP, nbi image name)"), 'drakxtv' => "[--no-guess]", 'drakupdate_fstab' => " [--add | --del] \n", 'keyboardrake' => N_("[keyboard]"), 'logdrake' => N_("[--file=myfile] [--word=myword] [--explain=regexp] [--alert]"), 'net_monitor' => N_("[OPTIONS] Network & Internet connection and monitoring application --defaultintf interface : show this interface by default --connect : connect to internet if not already connected --disconnect : disconnect to internet if already connected --force : used with (dis)connect : force (dis)connection. --status : returns 1 if connected 0 otherwise, then exit. --quiet : do not be interactive. To be used with (dis)connect."), 'printerdrake' => " [--skiptest] [--cups] [--lprng] [--lpd] [--pdq]", 'rpmdrake' => N_("[OPTION]... --no-confirmation do not ask first confirmation question in Mandriva Update mode --no-verify-rpm do not verify packages signatures --changelog-first display changelog before filelist in the description window --merge-all-rpmnew propose to merge all .rpmnew/.rpmsave files found"), 'scannerdrake' => N_("[--manual] [--device=dev] [--update-sane=sane_source_dir] [--update-usbtable] [--dynamic=dev]"), 'XFdrake' => N_(" [everything] XFdrake [--noauto] monitor XFdrake resolution"), ); $usages{$_} = $usages{rpmdrake} foreach qw(rpmdrake-remove MandrivaUpdate); $usages{Xdrakres} = $usages{XFdrake}; sub exit { explanations('### Program is exiting ###'); CORE::exit(@_); } sub __exit { explanations('### Program is exiting ###'); c::_exit(@_); } sub real_version { return "VER"; # version automatically set from Makefile } sub version() { print 'Drakxtools version ' . real_version() . ' Copyright (C) 1999-2008 Mandriva by ', $::license, "\n"; } if (!$::no_global_argv_parsing) { my ($i, @new_ARGV); foreach (@ARGV) { $i++; if (/^-(-help|h)$/) { version(); print N("\nUsage: %s [--auto] [--beginner] [--expert] [-h|--help] [--noauto] [--testing] [-v|--version] ", $progname), if_($usages{$progname}, common::translate($usages{$progname})), "\n"; # print N("\nUsage: "), $::usage, "\n" if $::usage; CORE::exit(0); } elsif (/^-(-version|v)$/) { version(); CORE::exit(0); } elsif (/^--embedded$/) { $::XID = splice @ARGV, $i, 1; $::isEmbedded = 1; } elsif (/^--expert$/) { $::expert = 1; } elsif (/^--noauto$/) { $::noauto = /-noauto/; } elsif (/^--auto$/) { $::auto = 1; } elsif (/^--testing$/) { $::testing = 1; } elsif (/^--beginner$/) { $::expert = 0; } else { push @new_ARGV, $_; } } @ARGV = @new_ARGV; } ################################################################################ #- stuff will go to special /var/log/explanations file my $standalone_name; sub explanations { log::explanations("@_") } our @common_functs = qw(renamef linkf symlinkf output substInFile mkdir_p rm_rf cp_af touch setVarsInSh setExportedVarsInSh setExportedVarsInCsh update_gnomekderc); our @builtin_functs = qw(chmod chown __exit exit unlink link symlink rename system); our @drakx_modules = qw(Xconfig::card Xconfig::default Xconfig::main Xconfig::monitor Xconfig::parse Xconfig::proprietary Xconfig::resolution_and_depth Xconfig::screen Xconfig::test Xconfig::various Xconfig::xfree any bootloader bootlook c commands crypto detect_devices devices diskdrake diskdrake::hd_gtk diskdrake::interactive diskdrake::removable diskdrake::removable_gtk diskdrake::smbnfs_gtk fs fsedit http keyboard lang log loopback lvm modules::parameters modules mouse my_gtk network network::adsl network::ethernet network::connection network::isdn_consts network::isdn network::modem network::netconnect network::network fs::remote::nfs fs::remote::smb network::tools partition_table partition_table_bsd partition_table::dos partition_table::empty partition_table::gpt partition_table::mac partition_table::raw partition_table::sun printer printerdrake proxy raid run_program scanner services steps swap timezone network::drakfirewall network::shorewall); sub bug_handler { my ($error, $is_signal) = @_; # exceptions in eval are OK: return if $error && $^S ne '0' && !$is_signal; # exceptions with "\n" are normal ways to quit: if (!$is_signal && eval { $error eq MDK::Common::String::formatError($error) }) { warn $error; exit(255); } # we want the full backtrace: $error .= "\n" if $is_signal; $error .= common::backtrace() if $error; my $progname = $0; # do not loop if drakbug crashes and do not complain about wizcancel: if ($progname =~ /drakbug/ || $error =~ /wizcancel/ || !-x '/usr/bin/drakbug') { warn $error; exit(1); } $progname =~ s|.*/||; system('drakbug', if_($error, '--error', $error), '--incident', $progname); c::_exit(1); } if (!$ENV{DISABLE_DRAKBUG}) { $SIG{SEGV} = sub { bug_handler(@_, 1) }; $SIG{__DIE__} = \&bug_handler; } sub import() { ($standalone_name = $0) =~ s|.*/||; c::openlog($standalone_name . "[$$]"); explanations('### Program is starting ###'); eval "*common::$_ = *$_" foreach @common_functs; foreach my $f (@builtin_functs) { eval "*$_" . "::$f = *$f" foreach @drakx_modules; eval "*" . caller() . "::$f = *$f"; } } sub renamef { explanations "moved file $_[0] to $_[1]"; goto &MDK::Common::File::renamef; } sub linkf { explanations "hard linked file $_[0] to $_[1]"; goto &MDK::Common::File::linkf; } sub symlinkf { explanations "symlinked file $_[0] to $_[1]"; goto &MDK::Common::File::symlinkf; } sub output { explanations "created file $_[0]"; goto &MDK::Common::File::output; } sub substInFile(&@) { explanations "modified file $_[1]"; goto &MDK::Common::File::substInFile; } sub mkdir_p { explanations "created directory $_[0] (and parents if necessary)"; goto &MDK::Common::File::mkdir_p; } sub rm_rf { explanations "removed files/directories (recursively) @_"; goto &MDK::Common::File::rm_rf; } sub cp_af { my $retval = MDK::Common::File::cp_af(@_); my $dest = pop @_; explanations "copied recursively @_ to $dest"; return $retval; } sub touch { explanations "touched file @_"; goto &MDK::Common::File::touch; } sub setVarsInSh { explanations "modified file $_[0]"; goto &MDK::Common::System::setVarsInSh; } sub setExportedVarsInSh { explanations "modified file $_[0]"; goto &MDK::Common::System::setExportedVarsInSh; } sub setExportedVarsInCsh { explanations "modified file $_[0]"; goto &MDK::Common::System::setExportedVarsInCsh; } sub update_gnomekderc { explanations "modified file $_[0]"; goto &MDK::Common::System::update_gnomekderc; } sub chmod { my $retval = CORE::chmod(@_); my $mode = shift @_; explanations sprintf("changed mode of %s to %o", $_, $mode) foreach @_; return $retval; } sub chown { my $retval = CORE::chown(@_); my $uid = shift @_; my $gid = shift @_; explanations sprintf("changed owner of $_ to $uid.$gid") foreach @_; return $retval; } sub unlink { explanations "removed files/directories @_"; CORE::unlink(@_); } sub link { explanations "hard linked file $_[0] to $_[1]"; CORE::link($_[0], $_[1]); } sub symlink { explanations "symlinked file $_[0] to $_[1]"; CORE::symlink($_[0], $_[1]); } sub rename { explanations "renamed file $_[0] to $_[1]" if -r $_[0]; CORE::rename($_[0], $_[1]); } sub system { explanations "launched command: @_"; CORE::system(@_); } 1; n168'>168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 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
package install2; # $Id$

use diagnostics;
use strict;
use vars qw($o $version);

#-######################################################################################
#- misc imports
#-######################################################################################
use steps;
use common;
use install_any qw(:all);
use install_steps;
use lang;
use keyboard;
use mouse;
use fsedit;
use devices;
use partition_table qw(:types);
use modules;
use detect_devices;
use run_program;
use any;
use log;
use fs;
#-$::corporate=1;


#-#######################################################################################
#-$O
#-the big struct which contain, well everything (globals + the interactive methods ...)
#-if you want to do a kickstart file, you just have to add all the required fields (see for example
#-the variable $default)
#-#######################################################################################
$o = $::o = {
#    bootloader => { linear => 0, message => 1, timeout => 5, restricted => 0 },
    mkbootdisk => 0, #- no mkbootdisk if 0 or undef, find a floppy with 1, or fd1
#-    packages   => [ qw() ],
    partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0 }, #-, readonly => 0 },
    authentication => { md5 => 1, shadow => 1 },
    lang         => 'en_US',
#-    isUpgrade    => 0,
    toRemove     => [],
    toSave       => [],
#-    simple_themes => 1,

    timezone => {
#-                   timezone => "Europe/Paris",
#-                   UTC      => 1,
                },
#-    superuser => { password => 'a', shell => '/bin/bash', realname => 'God' },
#-    user => { name => 'foo', password => 'bar', home => '/home/foo', shell => '/bin/bash', realname => 'really, it is foo' },

#-    keyboard => 'de',
#-    display => "192.168.1.19:1",
    steps        => \%steps::installSteps,
    orderedSteps => \@steps::orderedInstallSteps,

#- for the list of fields available for user and superuser, see @etc_pass_fields in install_steps.pm
#-    intf => { eth0 => { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } },

#-step : the current one
#-prefix
#-mouse
#-keyboard
#-netc
#-methods
#-packages compss
#-printer haveone entry(cf printer.pm)

};


sub installStepsCall {
    my ($o, $auto, $fun, @args) = @_;
    $fun = "install_steps::$fun" if $auto;
    $o->$fun(@args);
}

#-######################################################################################
#- Steps Functions
#- each step function are called with two arguments : clicked(because if you are a
#- beginner you can force the the step) and the entered number
#-######################################################################################

#------------------------------------------------------------------------------
sub selectLanguage {
    my ($_clicked, $ent_number, $auto) = @_;

    installStepsCall($o, $auto, 'selectLanguage', $ent_number == 1);
}

sub acceptLicense {
    my ($_clicked, $_ent_number, $auto) = @_;
    installStepsCall($o, $auto, 'acceptLicense') if !$o->{useless_thing_accepted};
}

#------------------------------------------------------------------------------
sub selectMouse {
    my ($clicked, $ent_number, $auto) = @_;

    require pkgs;
    my ($first_time) = $ent_number == 1;

    installStepsCall($o, $auto, 'selectMouse', !$first_time || $clicked);

    addToBeDone { mouse::write($o, $o->{mouse}) if !$o->{isUpgrade} || $clicked } 'installPackages';
}

#------------------------------------------------------------------------------
sub setupSCSI {
    my ($clicked, $_ent_number, $auto) = @_;

    if (!$::live && !$::g_auto_install && !$o->{blank} && !$::testing && !$::uml_install) {
	-s modules::cz_file() or die N("Can't access kernel modules corresponding to your kernel (file %s is missing), this generally means your boot floppy in not in sync with the Installation medium (please create a newer boot floppy)", modules::cz_file());
    }

    installStepsCall($o, $auto, 'setupSCSI', $clicked);
}

#------------------------------------------------------------------------------
sub selectKeyboard {
    my ($clicked, $_ent_number, $auto) = @_;

    installStepsCall($o, $auto, 'selectKeyboard', $clicked);

    #- read keyboard ASAP (so that summary displays ok)
    addToBeDone {	
	$o->{keyboard}{unsafe} or return;
	if (my $keyboard = keyboard::read()) {
	    $o->{keyboard} = $keyboard;
	}
    } 'formatPartitions';
}

#------------------------------------------------------------------------------
sub selectInstallClass {
    my ($clicked, $_ent_number, $auto) = @_;

    installStepsCall($o, $auto, 'selectInstallClass', $clicked);

    if ($o->{isUpgrade}) {
	$o->{keepConfiguration} and @{$o->{orderedSteps}} = grep { !/selectMouse|selectKeyboard|miscellaneous|setRootPassword|addUser|configureNetwork|installUpdates|summary|configureServices|configureX/ } @{$o->{orderedSteps}};
	my $s; foreach (@{$o->{orderedSteps}}) {
	    $s->{next} = $_ if $s;
	    $s = $o->{steps}{$_};
	}
    }
}

#------------------------------------------------------------------------------
sub doPartitionDisks {
    my ($_clicked, $_ent_number, $auto) = @_;
    $o->{steps}{formatPartitions}{done} = 0;
    installStepsCall($o, $auto, 'doPartitionDisksBefore');
    installStepsCall($o, $auto, 'doPartitionDisks');
    installStepsCall($o, $auto, 'doPartitionDisksAfter');
}

sub formatPartitions {
    my ($_clicked, $_ent_number, $auto) = @_;

    $o->{steps}{choosePackages}{done} = 0;
    installStepsCall($o, $auto, 'choosePartitionsToFormat', $o->{fstab}) if !$o->{isUpgrade};
    my $want_root_formated = fsedit::get_root($o->{fstab})->{toFormat};
    if ($want_root_formated) {
	foreach ('/usr') {
	    my $part = fsedit::mntpoint2part($_, $o->{fstab}) or next;
	    $part->{toFormat} or die N("You must also format %s", $_);
	}
    }
    installStepsCall($o, $auto, 'formatMountPartitions', $o->{fstab}) if !$::testing;

    if ($want_root_formated) {
	#- we formatted /, ensure /var/lib/rpm is cleaned otherwise bad things can happen
	#- (especially when /var is *not* formatted)
	eval { rm_rf("$o->{prefix}/var/lib/rpm") };
    }

    mkdir "$o->{prefix}/$_", 0755 foreach 
      qw(dev etc etc/profile.d etc/rpm etc/sysconfig etc/sysconfig/console 
	etc/sysconfig/network-scripts etc/sysconfig/console/consolefonts 
	etc/sysconfig/console/consoletrans
	home mnt tmp var var/tmp var/lib var/lib/rpm var/lib/urpmi);
    mkdir "$o->{prefix}/$_", 0700 foreach qw(root root/tmp root/drakx);

    devices::make("$o->{prefix}/dev/null");
    chmod 0666, "$o->{prefix}/dev/null";

    common::screenshot_dir__and_move();

    any::rotate_logs($o->{prefix});

    require raid;
    raid::prepare_prefixed($o->{all_hds}{raids}, $o->{prefix});
}

#------------------------------------------------------------------------------
sub choosePackages {
    my ($_clicked, $ent_number, $auto) = @_;
    require pkgs;

    #- always setPackages as it may have to copy hdlist files and synthesis files.
    installStepsCall($o, $auto, 'setPackages', $o->{isUpgrade} && $ent_number == 1);
    installStepsCall($o, $auto, 'choosePackages', $o->{packages}, $o->{compssUsers}, $ent_number == 1);
    log::l("compssUsersChoice's: ", join(" ", grep { $o->{compssUsersChoice}{$_} } keys %{$o->{compssUsersChoice}}));

    #- check pre-condition where base backage has to be selected.
    pkgs::packageByName($o->{packages}, 'basesystem')->flag_available or die "basesystem package not selected";

    #- check if there are package that need installation.
    $o->{steps}{installPackages}{done} = 0 if $o->{steps}{installPackages}{done} && pkgs::packagesToInstall($o->{packages}) > 0;
}

#------------------------------------------------------------------------------
sub installPackages {
    my ($_clicked, $ent_number, $auto) = @_;

    installStepsCall($o, $auto, 'readBootloaderConfigBeforeInstall') if $ent_number == 1;

    installStepsCall($o, $auto, 'beforeInstallPackages');
    installStepsCall($o, $auto, 'installPackages');
    installStepsCall($o, $auto, 'afterInstallPackages');
}
#------------------------------------------------------------------------------
sub miscellaneous {
    my ($clicked, $_ent_number, $auto) = @_;

    installStepsCall($o, $auto, 'miscellaneousBefore', $clicked);
    installStepsCall($o, $auto, 'miscellaneous', $clicked);
    installStepsCall($o, $auto, 'miscellaneousAfter', $clicked);
}

#------------------------------------------------------------------------------
sub summary {
    my ($_clicked, $ent_number, $auto) = @_;
    installStepsCall($o, $auto, 'summary', $ent_number == 1);
}
#------------------------------------------------------------------------------
sub configureNetwork {
    my ($_clicked, $_ent_number, $auto) = @_;
    #- get current configuration of network device.
    require network;
    eval { network::read_all_conf($o->{prefix}, $o->{netc} ||= {}, $o->{intf} ||= {}) };
    installStepsCall($o, $auto, 'configureNetwork') if !$o->{isUpgrade};
}
#------------------------------------------------------------------------------
sub installUpdates {
    my ($_clicked, $_ent_number, $auto) = @_;
    installStepsCall($o, $auto, 'installUpdates');
}
#------------------------------------------------------------------------------
sub configureServices {
    my ($clicked, $_ent_number, $auto) = @_;
    installStepsCall($o, $auto, 'configureServices', $clicked);
}
#------------------------------------------------------------------------------
sub setRootPassword {
    my ($clicked, $_ent_number, $auto) = @_;
    return if $o->{isUpgrade};

    installStepsCall($o, $auto, 'setRootPassword', $clicked);
    addToBeDone { install_any::setAuthentication($o) } 'installPackages';
}
#------------------------------------------------------------------------------
sub addUser {
    my ($clicked, $_ent_number, $auto) = @_;
    return if $o->{isUpgrade} && !$clicked;

    installStepsCall($o, $auto, 'addUser', $clicked);
}

#------------------------------------------------------------------------------
sub setupBootloader {
    my ($_clicked, $ent_number, $auto) = @_;
    return if $::g_auto_install || $::uml_install;

    modules::write_conf($o->{prefix});

    installStepsCall($o, $auto, 'setupBootloaderBefore') if $ent_number == 1;
    installStepsCall($o, $auto, 'setupBootloader');

    local $ENV{DRAKX_PASSWORD} = $o->{bootloader}{password};
    local $ENV{DURING_INSTALL} = 1;
    run_program::rooted($o->{prefix}, "/usr/sbin/msec", "-o", "run_commands=0", "-o", "log=stderr", $o->{security});
    require security::various;
    security::various::config_libsafe($o->{prefix}, $o->{libsafe});
    security::various::config_security_user($o->{prefix}, $o->{security_user});
}
#------------------------------------------------------------------------------
sub configureX {
    my ($_clicked, $_ent_number, $auto) = @_;

    #- done here and also at the end of install2.pm, just in case...
    install_any::write_fstab($o);
    modules::write_conf($o->{prefix});

    require pkgs;
    installStepsCall($o, $auto, 'configureX') if pkgs::packageByName($o->{packages}, 'XFree86')->flag_installed && !$o->{X}{disabled} || $::testing;
}
#------------------------------------------------------------------------------
sub exitInstall {
    my ($_clicked, $_xent_number, $auto) = @_;
    installStepsCall($o, $auto, 'exitInstall', getNextStep() eq 'exitInstall');
}


sub start_i810fb {

    my ($vga) = cat_('/proc/cmdline') =~ /vga=(\S+)/;
    return if !$vga || listlength(cat_('/proc/fb'));

    my %vga_to_xres = (0x311 => '640', 0x314 => '800', 0x317 => '1024');
    my $xres = $vga_to_xres{$vga} || '800';

    log::l("trying to load i810fb module with xres <$xres> (vga was <$vga>)");
    eval {
	any::ddcxinfos(); # keep the result otherwise ddcxinfos doesn't return good results afterwards
	modules::load([ 'i810fb',
			"xres=$xres", 'hsync1=32', 'hsync2=48', 'vsync1=50', 'vsync2=70',  #- this sucking i810fb does not accept floating point numbers in hsync!
			 'vram=2', 'bpp=16', 'accel=1', 'mtrr=1', 'hwcur=1', 'xcon=4' ]);
    };
}


#-######################################################################################
#- MAIN