summaryrefslogtreecommitdiffstats
path: root/docs
ModeNameSize
-rw-r--r--.cvsignore9logstatsplain
-rw-r--r--9.0_errata.txt3152logstatsplain
-rw-r--r--9.1_errata.txt1826logstatsplain
-rw-r--r--BUGS420logstatsplain
-rw-r--r--COPYING18007logstatsplain
-rw-r--r--HACKING4815logstatsplain
-rw-r--r--Partition-ends-after-end-of-disk.txt2547logstatsplain
-rw-r--r--README17012logstatsplain
-rw-r--r--README.devel9857logstatsplain
-rw-r--r--README.pxe5512logstatsplain
-rw-r--r--SHORTCUTS1499logstatsplain
-rw-r--r--TODO17444logstatsplain
-rw-r--r--advocacy3122logstatsplain
-rw-r--r--advocacy-interactive1752logstatsplain
-rw-r--r--comparisons10587logstatsplain
-rw-r--r--diskdrake.TODO1127logstatsplain
d---------drakfont288logstatsplain
-rw-r--r--draknet_advanced_doc.txt7633logstatsplain
d---------interactive204logstatsplain
-rw-r--r--mdk-9.25676logstatsplain
-rw-r--r--mdk-vs-redhat1381logstatsplain
-rw-r--r--net_object_class.fig2684logstatsplain
-rw-r--r--object_class.fig1026logstatsplain
-rwxr-xr-xporting-ugtk2039logstatsplain
-rw-r--r--spec-DrakX-8.0.html29315logstatsplain
-rw-r--r--wizard.doc1082logstatsplain
438' href='#n438'>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 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941
package install::steps; # $Id: steps.pm 268013 2010-04-29 15:02:04Z pterjan $

use diagnostics;
use strict;
use vars qw(@filesToSaveForUpgrade @filesNewerToUseAfterUpgrade);

#-######################################################################################
#- misc imports
#-######################################################################################
use common;
use install::any 'addToBeDone';
use partition_table;
use detect_devices;
use fs::any;
use fs::type;
use fs::partitioning;
use modules;
use run_program;
use lang;
use keyboard;
use fsedit;
use do_pkgs;
use install::pkgs;
use any;
use log;

our @ISA = qw(do_pkgs);

@filesToSaveForUpgrade = qw(
/etc/ld.so.conf /etc/fstab /etc/hosts /etc/conf.modules /etc/modules.conf
);

@filesNewerToUseAfterUpgrade = qw(
/etc/profile
);

#-######################################################################################
#- OO Stuff
#-######################################################################################
sub new($$) {
    my ($type, $o) = @_;

    bless $o, ref($type) || $type;
    return $o;
}

sub charsetChanged {
    my ($_o) = @_;
}

#-######################################################################################
#- In/Out Steps Functions
#-######################################################################################
sub enteringStep {
    my ($_o, $step) = @_;
    log::l("starting step `$step'");
}
sub leavingStep {
    my ($o, $step) = @_;
    log::l("step `$step' finished");

    if (-d "$::prefix/root/drakx") {
	eval { cp_af("/tmp/ddebug.log", "$::prefix/root/drakx") };
	output(install::any::auto_inst_file(), install::any::g_auto_install(1));
    }

    foreach my $s (@{$o->{orderedSteps}}) {
	#- the reachability property must be recomputed each time to take
	#- into account failed step.
	next if $o->{steps}{$s}{done} && !$o->{steps}{$s}{redoable};

	my $reachable = 1;
	if (my $needs = $o->{steps}{$s}{needs}) {
	    my @l = ref($needs) ? @$needs : $needs;
	    $reachable = min(map { $o->{steps}{$_}{done} || 0 } @l);
	}
	$o->{steps}{$s}{reachable} = 1 if $reachable;
    }
    $o->{steps}{$step}{reachable} = $o->{steps}{$step}{redoable};

    while (my $f = shift @{$o->{steps}{$step}{toBeDone} || []}) {
	eval { &$f() };
	if (my $err = $@) {
	    $o->ask_warn(N("Error"), [
N("An error occurred, but I do not know how to handle it nicely.
Continue at your own risk."), formatError($err) || $err ]);
	}
    }
}

sub errorInStep { 
    my ($_o, $err) = @_;
    print "error :(\n"; 
    print "$err\n\n";
    c::_exit(1);
}
sub kill_action {}

#-######################################################################################
#- Steps Functions
#-######################################################################################
#------------------------------------------------------------------------------
sub selectLanguage {
    my ($o) = @_;

    $o->{locale}{langs} ||= { $o->{locale}{lang} => 1 };

    if (!exists $o->{locale}{country}) {
	lang::lang_changed($o->{locale});
    }

    add2hash_($o->{locale}, { utf8 => lang::utf8_should_be_needed($o->{locale}) });
    lang::set($o->{locale}, !$o->isa('interactive::gtk'));

    log::l("selectLanguage: pack_langs: ", lang::pack_langs($o->{locale}{langs}), " utf8-flag: ", to_bool($o->{locale}{utf8}));

    #- for auto_install compatibility with old $o->{keyboard} containing directly $o->{keyboard}{KEYBOARD}
    $o->{keyboard} = { KEYBOARD => $o->{keyboard} } if $o->{keyboard} && !ref($o->{keyboard});

    if (!$o->{keyboard} || $o->{keyboard}{unsafe}) {
	$o->{keyboard} = keyboard::default($o->{locale});
	$o->{keyboard}{unsafe} = 1;
	keyboard::setup_install($o->{keyboard});
    }

    $o->charsetChanged;

    addToBeDone {
	lang::write_langs($o->{locale}{langs});
    } 'formatPartitions';
    addToBeDone {
	lang::write_and_install($o->{locale}, $o->do_pkgs);
    } 'installPackages';
}
#------------------------------------------------------------------------------
sub selectKeyboard {
    my ($o) = @_;
    keyboard::setup_install($o->{keyboard});

    addToBeDone {
	#- the bkmap keymaps in installer are deficient, we need to load the real one before keyboard::write which will generate /etc/sysconfig/console/default.kmap
	run_program::rooted($::prefix, 'loadkeys', keyboard::keyboard2kmap($o->{keyboard}))
	    or log::l("loadkeys failed");
	keyboard::write($o->{keyboard});
    } 'installPackages' if !$o->{isUpgrade} || !$o->{keyboard}{unsafe};
}
#------------------------------------------------------------------------------
sub acceptLicense {}

#------------------------------------------------------------------------------
sub setupSCSI {
    my ($o) = @_;
    install::any::configure_pcmcia($o);
    modules::load(modules::category2modules('disk/cdrom'));
    modules::load_category($o->{modules_conf}, 'bus/firewire');
    modules::load_category($o->{modules_conf}, 'disk/scsi');
    #- load disk/scsi before disk/ide since libata is now the default
    #- (to prevent modules::load_category from loading ide-generic too early)
    modules::load_category($o->{modules_conf}, 'disk/ide|hardware_raid|sata|firewire');

    install::any::getHds($o);
}

#------------------------------------------------------------------------------
sub selectInstallClass {
    my ($o) = @_;

    if ($o->{partitioning}{use_existing_root} || $o->{isUpgrade}) {
	# either one root is defined (and all is ok), or we take the first one we find
	my $p = fs::get::root_($o->{fstab}) || (first(install::any::find_root_parts($o->{fstab}, $::prefix)) || die)->{part};
	$o->{migrate_device_names} = install::any::use_root_part($o->{all_hds}, $p);
	$o->{previous_release} = $p if $o->{isUpgrade};
    } 
}

#------------------------------------------------------------------------------
sub doPartitionDisksBefore {
    my ($o) = @_;
    eval { 
	eval { fs::mount::umount("$::prefix/sys") };
	eval { fs::mount::umount("$::prefix/proc/bus/usb") };
	eval { fs::mount::umount("$::prefix/proc") };
	eval {          fs::mount::umount_all($o->{fstab}) };
	eval { sleep 1; fs::mount::umount_all($o->{fstab}) } if $@; #- HACK
    } if $o->{fstab} && !$::testing;
}

#------------------------------------------------------------------------------
sub doPartitionDisksAfter {
    my ($o) = @_;

    fs::any::write_hds($o->{all_hds}, $o->{fstab}, !$o->{isUpgrade}, sub { $o->rebootNeeded }, $o);

    if ($::local_install) {
	my $p = fs::get::mntpoint2part($::prefix, [ fs::read_fstab('', '/proc/mounts') ]);
	my $part = find { fs::get::is_same_hd($p, $_) } @{$o->{fstab}};
	$part ||= $o->{fstab}[0];
	$part->{mntpoint} = '/';
	$part->{isMounted} = 1;
    }

    fs::any::check_hds_boot_and_root($o->{all_hds}, $o->{fstab});

    if ($o->{partitioning}{use_existing_root}) {
	#- ensure those partitions are mounted so that they are not proposed in choosePartitionsToFormat
	fs::mount::part($_) foreach sort { $a->{mntpoint} cmp $b->{mntpoint} }
				    grep { $_->{mntpoint} && maybeFormatted($_) } @{$o->{fstab}};
    }
}

#------------------------------------------------------------------------------
sub doPartitionDisks {
    my ($o) = @_;

    if ($o->{partitioning}{auto_allocate}) {
	catch_cdie { fsedit::auto_allocate($o->{all_hds}, $o->{partitions}) } sub { 1 };
    }
}

#------------------------------------------------------------------------------

sub rebootNeeded($) {
    my ($_o) = @_;
    log::l("Rebooting...");
    c::_exit(0);
}

sub choosePartitionsToFormat {
    my ($o) = @_;
    fs::partitioning::guess_partitions_to_format($o->{fstab});
}

sub formatMountPartitions {
    my ($o) = @_;
    fs::format::formatMount_all($o->{all_hds}, $o->{fstab}, undef);
}

#------------------------------------------------------------------------------
sub setPackages {
    my ($o) = @_;

    install::any::setPackages($o);
}

sub ask_deselect_media__copy_on_disk {
    my (undef, $_hdlists, $_copy_rpms_on_disk) = @_;
    0;
}

sub ask_change_cd {
    my (undef, $phys_m) = @_;
    log::l("change to medium $phys_m refused (it can't be done automatically)");
    0;
}

sub selectSupplMedia { '' }

sub choosePackages {
    my ($o, $o_compssListLevel) = @_;

    #- clear the mirror cache before upgrading:
    eval { rm_rf("$::prefix/var/cache/urpmi/mirrors.cache") };
 
    #- now for upgrade, package that must be upgraded are
    #- selected first, after is used the same scheme as install.

    #- make sure we kept some space left for available else the system may
    #- not be able to start
    my $available = install::any::getAvailableSpace($o);
    my $availableCorrected = install::pkgs::invCorrectSize($available / sqr(1024)) * sqr(1024);
    log::l(sprintf "available size %s (corrected %s)", formatXiB($available), formatXiB($availableCorrected));

    #- !! destroying user selection of packages (they may have done individual selection before)
    exists $o->{compssListLevel} || defined $o_compssListLevel
	  and install::pkgs::setSelectedFromCompssList($o->{packages}, $o->{rpmsrate_flags_chosen}, $o_compssListLevel || $o->{compssListLevel}, $availableCorrected);

    $availableCorrected;
}

sub upgrading_redhat() {
    #- remove weird config files that bother Xconfig::* too much
    unlink "$::prefix/etc/X11/XF86Config";
    unlink "$::prefix/etc/X11/XF86Config-4";

    sub prefering_mdv {
	my ($lpkg, $rpkg_ver, $c) = @_;
	my $lpkg_ver = $lpkg->version . '-' . $lpkg->release;
	log::l($lpkg->name . ' ' . ': prefering ' . ($c == 1 ? "$lpkg_ver over $rpkg_ver" : "$rpkg_ver over $lpkg_ver"));
    }

    my $old_compare_pkg = \&URPM::Package::compare_pkg;
    undef *URPM::Package::compare_pkg;
    *URPM::Package::compare_pkg = sub {
	my ($lpkg, $rpkg) = @_;
	my $c = ($lpkg->release =~ /mdv|mnb|mga/ ? 1 : 0) - ($rpkg->release =~ /mdv|mnb|mga/ ? 1 : 0);
	if ($c) {
	    prefering_mdv($lpkg, $rpkg->version . '-' . $rpkg->release, $c);
	    $c;
	} else {
	    &$old_compare_pkg;
	}
    };

    my $old_compare = \&URPM::Package::compare;
    undef *URPM::Package::compare;
    *URPM::Package::compare = sub {
	my ($lpkg, $rpkg_ver) = @_;
	my $c = ($lpkg->release =~ /mdv|mnb|mga/ ? 1 : 0) - ($rpkg_ver =~ /mdv|mnb|mga/ ? 1 : 0);
	if ($c) {
	    prefering_mdv($lpkg, $rpkg_ver, $c);
	    return $c;
	}
	&$old_compare;
    };
}

sub beforeInstallPackages {
    my ($o) = @_;

    read_bootloader_config($o);

    if ($o->{isUpgrade}) {
	$o->{modules_conf}->merge_into(modules::any_conf->read);
    }

    #- save these files in case of upgrade failure.
    if ($o->{isUpgrade}) {
	foreach (@filesToSaveForUpgrade) {
	    unlink "$::prefix/$_.mdkgisave";
	    if (-e "$::prefix/$_") {
		eval { cp_af("$::prefix/$_", "$::prefix/$_.mdkgisave") };
	    }
	}
	foreach (@filesNewerToUseAfterUpgrade) {
	    unlink "$::prefix/$_.rpmnew";
	}
    }

    #- mainly for upgrading redhat packages, but it can help other
    my @should_not_be_dirs = qw(/usr/share/locale/zh_TW/LC_TIME /usr/include/GL);
    my @should_be_dirs = qw(/etc/X11/xkb);
    my @to_remove = (
		     (grep { !-l $_ && -d $_          } map { "$::prefix$_" } @should_not_be_dirs),
		     (grep { -l $_ || !-d $_ && -e $_ } map { "$::prefix$_" } @should_be_dirs),
		    );
    rm_rf(@to_remove);

    if ($o->{isUpgrade} eq 'redhat') {
	upgrading_redhat();
    }

    if ($o->{isUpgrade} =~ /redhat|conectiva/) {
	#- to ensure supermount is removed (???)
	fs::mount_options::set_all_default($o->{all_hds}, %$o, lang::fs_options($o->{locale}));
    }
	

    #- some packages need such files for proper installation.
    install::any::write_fstab($o);

    require network::network;
    network::network::add2hosts("localhost", "127.0.0.1");

    #- resolv.conf will be modified at boot time
    #- the following will ensure we have a working DNS during install
    if (-e "/etc/resolv.conf" && ! -e "$::prefix/etc/resolv.conf") {
	cp_af("/etc/resolv.conf", "$::prefix/etc");
    }

    if (-e '/tmp/.X11-unix') {
	mkdir "$::prefix/tmp/.X11-unix";
	run_program::run('mount', '--bind', '/tmp/.X11-unix', "$::prefix/tmp/.X11-unix");
    }

    log::l("setting excludedocs to $o->{excludedocs}");
    substInFile { s/%_excludedocs.*//; $_ .= "%_excludedocs yes\n" if eof && $o->{excludedocs} } "$::prefix/etc/rpm/macros";

    #- add oem theme if the files exists.
    mkdir_p("$::prefix/usr/share");
    install::media::getAndSaveFile_($o->{stage2_phys_medium}, "install/oem-theme.rpm", "$::prefix/usr/share/oem-theme.rpm");

    system("sh", "-c", $o->{preInstallNonRooted}) if $o->{preInstallNonRooted};
}

#- returns number of packages installed, 0 if none were selected.
sub pkg_install {
    my ($o, @l) = @_;
    log::l("selecting packages " . join(" ", @l));

    install::pkgs::select_by_package_names($o->{packages}, \@l);

    my @toInstall = install::pkgs::packagesToInstall($o->{packages});
    if (@toInstall) {