package install_messages; # $Id$ use diagnostics; use strict; use common; sub main_license() { #-PO: keep the double empty lines between sections, this is formatted a la LaTeX N("Introduction The operating system and the different components available in the Mandriva Linux distribution shall be called the \"Software Products\" hereafter. The Software Products include, but are not restricted to, the set of programs, methods, rules and documentation related to the operating system and the different components of the Mandriva Linux distribution. 1. License Agreement Please read this document carefully. This document is a license agreement between you and Mandriva S.A. which applies to the Software Products. By installing, duplicating or using the Software Products in any manner, you explicitly accept and fully agree to conform to the terms and conditions of this License. If you disagree with any portion of the License, you are not allowed to install, duplicate or use the Software Products. Any attempt to install, duplicate or use the Software Products in a manner which does not comply with the terms and conditions of this License is void and will terminate your rights under this License. Upon termination of the License, you must immediately destroy all copies of the Software Products. 2. Limited Warranty The Software Products and attached documentation are provided \"as is\", with no warranty, to the extent permitted by law. Mandriva S.A. will, in no circumstances and to the extent permitted by law, be liable for any special, incidental, direct or indirect damages whatsoever (including without limitation damages for loss of business, interruption of business, financial loss, legal fees and penalties resulting from a court judgment, or any other consequential loss) arising out of the use or inability to use the Software Products, even if Mandriva S.A. has been advised of the possibility or occurrence of such damages. LIMITED LIABILITY LINKED TO POSSESSING OR USING PROHIBITED SOFTWARE IN SOME COUNTRIES To the extent permitted by law, Mandriva S.A. or its distributors will, in no circumstances, be liable for any special, incidental, direct or indirect damages whatsoever (including without limitation damages for loss of business, interruption of business, financial loss, legal fees and penalties resulting from a court judgment, or any other consequential loss) arising out of the possession and use of software components or arising out of downloading software components from one of Mandriva Linux sites which are prohibited or restricted in some countries by local laws. This limited liability applies to, but is not restricted to, the strong cryptography components included in the Software Products. 3. The GPL License and Related Licenses The Software Products consist of components created by different persons or entities. Most of these components are governed under the terms and conditions of the GNU General Public Licence, hereafter called \"GPL\", or of similar licenses. Most of these licenses allow you to use, duplicate, adapt or redistribute the components which they cover. Please read carefully the terms and conditions of the license agreement for each component before using any component. Any question on a component license should be addressed to the component author and not to Mandriva. The programs developed by Mandriva S.A. are governed by the GPL License. Documentation written by Mandriva S.A. is governed by a specific license. Please refer to the documentation for further details. 4. Intellectual Property Rights All rights to the components of the Software Products belong to their respective authors and are protected by intellectual property and copyright laws applicable to software programs. Mandriva S.A. reserves its rights to modify or adapt the Software Products, as a whole or in parts, by all means and for all purposes. \"Mandriva\", \"Mandriva Linux\" and associated logos are trademarks of Mandriva S.A. 5. Governing Laws If any portion of this agreement is held void, illegal or inapplicable by a court judgment, this portion is excluded from this contract. You remain bound by the other applicable sections of the agreement. The terms and conditions of this License are governed by the Laws of France. All disputes on the terms of this license will preferably be settled out of court. As a last resort, the dispute will be referred to the appropriate Courts of Law of Paris - France. For any question on this document, please contact Mandriva S.A. "); } sub warning_about_patents() { N("Warning: Free Software may not necessarily be patent free, and some Free Software included may be covered by patents in your country. For example, the MP3 decoders included may require a licence for further usage (see http://www.mp3licensing.com for more details). If you are unsure if a patent may be applicable to you, check your local laws."); } sub com_license() { #-PO: keep the double empty lines between sections, this is formatted a la LaTeX N(" Warning Please read carefully the terms below. If you disagree with any portion, you are not allowed to install the next CD media. Press 'Refuse' to continue the installation without using these media. Some components contained in the next CD media are not governed by the GPL License or similar agreements. Each such component is then governed by the terms and conditions of its own specific license. Please read carefully and comply with such specific licenses before you use or redistribute the said components. Such licenses will in general prevent the transfer, duplication (except for backup purposes), redistribution, reverse engineering, de-assembly, de-compilation or modification of the component. Any breach of agreement will immediately terminate your rights under the specific license. Unless the specific license terms grant you such rights, you usually cannot install the programs on more than one system, or adapt it to be used on a network. In doubt, please contact directly the distributor or editor of the component. Transfer to third parties or copying of such components including the documentation is usually forbidden. All rights to the components of the next CD media belong to their respective authors and are protected by intellectual property and copyright laws applicable to software programs. "); } sub install_completed() { #-PO: keep the double empty lines between sections, this is formatted a la LaTeX N("Congratulations, installation is complete. Remove the boot media and press return to reboot. For information on fixes which are available for this release of Mandriva Linux, consult the Errata available from: %s Information on configuring your system is available in the post install chapter of the Official Mandriva Linux User's Guide.", N("http://www.mandrivalinux.com/en/errata.php3")); } 1; n20'>20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 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 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 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017
package install_steps; # $Id$
use diagnostics;
use strict;
use vars qw(@filesToSaveForUpgrade @filesNewerToUseAfterUpgrade);
#-######################################################################################
#- misc imports
#-######################################################################################
use common;
use install_any qw(:all);
use partition_table qw(:types);
use detect_devices;
use modules;
use run_program;
use lang;
use keyboard;
use fsedit;
use loopback;
use do_pkgs;
use pkgs;
use any;
use log;
use fs;
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 "$o->{prefix}/root/drakx") {
eval { cp_af("/tmp/ddebug.log", "$o->{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() };
$o->ask_warn(N("Error"), [
N("An error occurred, but I don't know how to handle it nicely.
Continue at your own risk."), formatError($@) ]) if $@;
}
}
sub errorInStep {
my ($_o, $_err) = @_;
print "error :(\n";
c::_exit(1);
}
sub kill_action {}
#-######################################################################################
#- Steps Functions
#-######################################################################################
#------------------------------------------------------------------------------
sub selectLanguage {
my ($o) = @_;
#- for auto_install compatibility with old $o->{lang}
$o->{locale} = lang::system_locales_to_ourlocale($o->{lang}, $o->{lang}) if $o->{lang};
$o->{locale}{langs} ||= { $o->{locale}{lang} => 1 };
if (!exists $o->{locale}{country}) {
my $h = lang::analyse_locale_name(lang::l2locale($o->{locale}{lang}));
$o->{locale}{country} = $h->{country} if $h->{country};
}
lang::set($o->{locale}, !$o->isa('interactive::gtk'));
add2hash_($o->{locale}, { utf8 => lang::utf8_should_be_needed($o->{locale}) });
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::from_usb() || keyboard::lang2keyboard($o->{locale}{lang});
$o->{keyboard}{unsafe} = 1;
keyboard::setup($o->{keyboard});
}
$o->charsetChanged;
addToBeDone {
lang::write_langs($o->{locale}{langs});
} 'formatPartitions';
addToBeDone {
lang::write($o->{prefix}, $o->{locale});
} 'installPackages';
}
#------------------------------------------------------------------------------
sub selectKeyboard {
my ($o) = @_;
$o->{keyboard}{KBCHARSET} = lang::l2charset($o->{locale}{lang});
keyboard::setup($o->{keyboard});
addToBeDone {
keyboard::write($o->{keyboard});
} 'installPackages' if !$o->{isUpgrade} || !$o->{keyboard}{unsafe};
if ($o->{raw_X}) {
require Xconfig::default;
Xconfig::default::config_keyboard($o->{raw_X}, $o->{keyboard});
$o->{raw_X}->write;
}
}
#------------------------------------------------------------------------------
sub acceptLicense {}
#------------------------------------------------------------------------------
sub setupSCSI {
my ($o) = @_;
install_any::configure_pcmcia($o->{modules_conf}, $o->{pcmcia}) if $o->{pcmcia};
modules::load(modules::category2modules('disk/cdrom'));
modules::load_category($o->{modules_conf}, 'bus/firewire');
modules::load_category($o->{modules_conf}, 'disk/scsi|hardware_raid|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 = fsedit::get_root_($o->{fstab}) || (first(install_any::find_root_parts($o->{fstab}, $o->{prefix})) || die)->{part};
install_any::use_root_part($o->{all_hds}, $p, $o->{prefix});
}
}
#------------------------------------------------------------------------------
sub doPartitionDisksBefore {
my ($o) = @_;
eval {
eval { fs::umount("$o->{prefix}/proc") };
eval { fs::umount_all($o->{fstab}, $o->{prefix}) };
eval { sleep 1; fs::umount_all($o->{fstab}, $o->{prefix}) } if $@; #- HACK
} if $o->{fstab} && !$::testing;
}
#------------------------------------------------------------------------------
sub doPartitionDisksAfter {
my ($o) = @_;
if (!$::testing) {
my $hds = $o->{all_hds}{hds};
partition_table::write($_) foreach @$hds;
$_->{rebootNeeded} and $o->rebootNeeded foreach @$hds;
}
fs::set_removable_mntpoints($o->{all_hds});
fs::set_all_default_options($o->{all_hds}, %$o, lang::fs_options($o->{locale}))
if !$o->{isUpgrade};
$o->{fstab} = [ fsedit::get_all_fstab($o->{all_hds}) ];
fsedit::get_root_($o->{fstab}) or die "Oops, no root partition";
if (arch() =~ /ppc/ && detect_devices::get_mac_generation() =~ /NewWorld/) {
die "Need bootstrap partition to boot system!" if !(defined $partition_table::mac::bootstrap_part);
}
if (arch() =~ /ia64/ && !fsedit::has_mntpoint("/boot/efi", $o->{all_hds})) {
die N("You must have a FAT partition mounted in /boot/efi");
}
if ($o->{partitioning}{use_existing_root} && !$::recovery) {
#- ensure those partitions are mounted so that they are not proposed in choosePartitionsToFormat
fs::mount_part($_, $o->{prefix}) foreach sort { $a->{mntpoint} cmp $b->{mntpoint} }
grep { $_->{mntpoint} && maybeFormatted($_) } @{$o->{fstab}};
}
cat_("/proc/mounts") =~ m|(\S+)\s+/tmp/nfsimage| &&
!any { $_->{mntpoint} eq "/mnt/nfs" } @{$o->{all_hds}{nfss}} and
push @{$o->{all_hds}{nfss}}, { pt_type => 'nfs', mntpoint => "/mnt/nfs", device => $1, options => "noauto,ro,nosuid,soft,rsize=8192,wsize=8192" };
}
#------------------------------------------------------------------------------
sub doPartitionDisks {
my ($o) = @_;
if ($o->{partitioning}{auto_allocate}) {
catch_cdie { fsedit::auto_allocate($o->{all_hds}, $o->{partitions}) } sub { 1 };
}
}
#------------------------------------------------------------------------------
sub ask_mntpoint_s {#-}}}
my ($_o, $fstab) = @_;
#- TODO: set the mntpoints
my %m; foreach (@$fstab) {
my $m = $_->{mntpoint};
next if !$m || $m eq 'swap'; #- there may be a lot of swap.
$m{$m} and die N("Duplicate mount point %s", $m);
$m{$m} = 1;
#- in case the type does not correspond, force it to ext3
$_->{pt_type} = 0x483 if $m =~ m|^/| && !isTrueFS($_) && !isOtherAvailableFS($_);
}
1;
}
sub rebootNeeded($) {
my ($_o) = @_;
log::l("Rebooting...");
c::_exit(0);
}
sub choosePartitionsToFormat($$) {
my ($_o, $fstab) = @_;
foreach (@$fstab) {
$_->{mntpoint} = "swap" if isSwap($_);
$_->{mntpoint} or next;
add2hash_($_, { toFormat => $_->{notFormatted} });
$_->{$::recovery ? 'toFormat' : 'toFormatUnsure'} ||= member($_->{mntpoint}, '/', '/usr');
if (!$_->{toFormat}) {
my $t = fsedit::typeOfPart($_->{device});
$_->{toFormatUnsure} ||=
#- if detected dos/win, it's not precise enough to just compare the types (too many of them)
(!$t || isOtherAvailableFS({ pt_type => $t }) ? !isOtherAvailableFS($_) : $t != $_->{pt_type});
}
}
}
sub formatMountPartitions {
my ($o) = @_;
fs::formatMount_all($o->{all_hds}{raids}, $o->{fstab}, $o->{prefix});
}
#------------------------------------------------------------------------------
sub setPackages {
my ($o, $rebuild_needed) = @_;
install_any::setPackages($o, $rebuild_needed);
pkgs::selectPackagesAlreadyInstalled($o->{packages}, $o->{prefix});
$rebuild_needed and pkgs::selectPackagesToUpgrade($o->{packages}, $o->{prefix});
}
sub choosePackages {
my ($o, $packages, $_compssUsers, $first_time) = @_;
#- 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 (xfs at least).
my $available = install_any::getAvailableSpace($o);
my $availableCorrected = pkgs::invCorrectSize($available / sqr(1024)) * sqr(1024);
log::l(sprintf "available size %s (corrected %s)", formatXiB($available), formatXiB($availableCorrected));
add2hash_($o, { compssListLevel => 5 }) if !$::auto_install;
#- avoid destroying user selection of packages but only
#- for expert, as they may have done individual selection before.
if ($first_time || !$::expert) {
exists $o->{compssListLevel}
and pkgs::setSelectedFromCompssList($packages, $o->{compssUsersChoice}, $o->{compssListLevel}, $availableCorrected);
}
$availableCorrected;
}
sub beforeInstallPackages {
my ($o) = @_;
#- save these files in case of upgrade failure.
if ($o->{isUpgrade}) {
foreach (@filesToSaveForUpgrade) {
unlink "$o->{prefix}/$_.mdkgisave";
if (-e "$o->{prefix}/$_") {
eval { cp_af("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") };
}
}
foreach (@filesNewerToUseAfterUpgrade) {
unlink "$o->{prefix}/$_.rpmnew";
}
}
#- some packages need such files for proper installation.
install_any::write_fstab($o);
require network::network;
network::network::add2hosts("$o->{prefix}/etc/hosts", "localhost.localdomain", "127.0.0.1");
log::l("setting excludedocs to $o->{excludedocs}");
substInFile { s/%_excludedocs.*//; $_ .= "%_excludedocs yes\n" if eof && $o->{excludedocs} } "$o->{prefix}/etc/rpm/macros";
#- add oem theme if the files exists.
mkdir_p("$o->{prefix}/usr/share");
install_any::getAndSaveFile("install/oem-theme.rpm", "$o->{prefix}/usr/share/oem-theme.rpm");
}
sub pkg_install {
my ($o, @l) = @_;
log::l("selecting packages ".join(" ", @l));
require pkgs;
if ($::testing) {
log::l(qq(selecting package "$_")) foreach @l;
} else {
$o->{packages}{rpmdb} ||= pkgs::rpmDbOpen($o->{prefix});
pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || die "$_ rpm not found") foreach @l;
}
my @toInstall = pkgs::packagesToInstall($o->{packages});
if (@toInstall) {
log::l("installing packages");
$o->installPackages;
} else {
log::l("all packages selected are already installed, nothing to do")
}
}
sub pkg_install_if_requires_satisfied {
my ($o, @l) = @_;
require pkgs;
$o->{packages}{rpmdb} ||= pkgs::rpmDbOpen($o->{prefix});
foreach (@l) {
my %newSelection;
my $pkg = pkgs::packageByName($o->{packages}, $_) || die "$_ rpm not found";
pkgs::selectPackage($o->{packages}, $pkg, 0, \%newSelection);
if (scalar(keys %newSelection) == 1) {
pkgs::selectPackage($o->{packages}, $pkg);
} else {
log::l("pkg_install_if_requires_satisfied: not selecting $_ because of ", join(", ", keys %newSelection));
}
}
$o->installPackages;
}
sub installPackages($$) { #- complete REWORK, TODO and TOCHECK!
my ($o) = @_;
my $packages = $o->{packages};
if (%{$packages->{state}{ask_remove} || {}}) {
log::l("removing : ", join ', ', keys %{$packages->{state}{ask_remove}});
pkgs::remove($o->{prefix}, [ keys %{$packages->{state}{ask_remove}} ], $packages);
}
#- small transaction will be built based on this selection and depslist.
my @toInstall = pkgs::packagesToInstall($packages);
my $time = time();
$ENV{DURING_INSTALL} = 1;
pkgs::install($o->{prefix}, $o->{isUpgrade}, \@toInstall, $packages);
any::writeandclean_ldsoconf($o->{prefix});
delete $ENV{DURING_INSTALL};
run_program::rooted_or_die($o->{prefix}, 'ldconfig');
log::l("Install took: ", formatTimeRaw(time() - $time));
install_any::log_sizes($o);
scalar(@toInstall); #- return number of packages installed.
}
sub afterInstallPackages($) {
my ($o) = @_;
die N("Some important packages didn't get installed properly.
Either your cdrom drive or your cdrom is defective.
Check the cdrom on an installed computer using \"rpm -qpl media/main/*.rpm\"
") if any { m|read failed: Input/output error| } cat_("$o->{prefix}/root/drakx/install.log");
if (arch() !~ /^sparc/) { #- TODO restore it as may be needed for sparc
-x "$o->{prefix}/usr/bin/dumpkeys" or $::testing or die
"Some important packages didn't get installed properly.
Please switch to console 2 (using ctrl-alt-f2)
and look at the log file /tmp/ddebug.log
Consoles 1,3,4,7 may also contain interesting information";
}
#- why not? cuz weather is nice today :-) [pixel]
common::sync(); common::sync();
my $have_devfsd = do {
my $p = pkgs::packageByName($o->{packages}, 'devfsd');
$p && $p->flag_installed
};
require bootloader;
bootloader::may_append($o->{bootloader}, devfs => $have_devfsd ? 'mount' : 'nomount');
#- generate /etc/lvmtab needed for rc.sysinit
run_program::rooted($o->{prefix}, 'lvm2', 'vgscan') if -e '/etc/lvmtab';
#- configure PCMCIA services if needed.
install_any::write_pcmcia($o->{pcmcia});
#- for mandrake_firstime
touch "$o->{prefix}/var/lock/TMP_1ST";
any::config_dvd($o->{prefix}, $have_devfsd);
any::config_mtools($o->{prefix});
#- make sure wins is disabled in /etc/nsswitch.conf
#- else if eth0 is not existing, glibc segfaults.
substInFile { s/\s*wins// if /^\s*hosts\s*:/ } "$o->{prefix}/etc/nsswitch.conf";
#- make sure some services have been enabled (or a catastrophic restart will occur).
#- these are normally base package post install scripts or important services to start.
run_program::rooted($o->{prefix}, "chkconfig", "--add", $_) foreach
qw(random netfs network rawdevices sound kheader keytable syslog crond portmap);
if ($o->{mouse}{device} =~ /ttyS/) {
log::l("disabling gpm for serial mice (doesn't get along nicely with X)");
run_program::rooted($o->{prefix}, "chkconfig", "--del", "gpm")
}
#- install urpmi before as rpmdb will be opened, this will cause problem with update-menus.
$o->install_urpmi;
#- update menu scheme before calling update menus if desktop mode.
if ($o->{meta_class} eq 'desktop') {
run_program::rooted($o->{prefix}, "touch", "/etc/menu/do-not-create-menu-link");
run_program::rooted($o->{prefix}, "touch", "/etc/menu/enable_simplified");
} elsif (!$o->{isUpgrade}) {
run_program::rooted($o->{prefix}, "touch", "/etc/menu/do-not-create-menu-link");
}
if ($o->{pcmcia}) {
substInFile { s/.*(TaskBarShowAPMStatus).*/$1=1/ } "$o->{prefix}/usr/lib/X11/icewm/preferences";
eval { cp_af("$o->{prefix}/usr/share/applnk/System/kapm.kdelnk",
"$o->{prefix}/etc/skel/Desktop/Autostart/kapm.kdelnk") };
}
if ($o->{brltty}) {
output("$o->{prefix}/etc/brltty.conf", <<EOF);
braille-driver $o->{brltty}{driver}
braille-device $o->{brltty}{device}
text-table $o->{brltty}{table}
EOF
}
install_any::disable_user_view() if $o->{security} >= 3 || $o->{authentication}{NIS};
run_program::rooted($o->{prefix}, "kdeDesktopCleanup");
foreach (list_skels($o->{prefix}, '.kde/share/config/kfmrc')) {
my $found;
substInFile {
$found ||= /KFM Misc Defaults/;
$_ .=
"[KFM Misc Defaults]
GridWidth=85
GridHeight=70
" if eof && !$found;
} $_
}
#- move some file after an upgrade that may be seriously annoying.
#- and rename saved files to .mdkgiorig.
if ($o->{isUpgrade}) {
my $pkg = pkgs::packageByName($o->{packages}, 'rpm');
$pkg && ($pkg->flag_selected || $pkg->flag_installed) && $pkg->compare(">= 4.0") and pkgs::cleanOldRpmDb($o->{prefix});
log::l("moving previous desktop files that have been updated to Trash of each user");
install_any::kdemove_desktop_file($o->{prefix});
foreach (@filesToSaveForUpgrade) {
renamef("$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_.mdkgiorig")
if -e "$o->{prefix}$_.mdkgisave";
}
foreach (@filesNewerToUseAfterUpgrade) {
if (-e "$o->{prefix}/$_.rpmnew" && -e "$o->{prefix}/$_") {
renamef("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgiorig");
renamef("$o->{prefix}/$_.rpmnew", "$o->{prefix}/$_");
}
}
}
any::fix_broken_alternatives();
#- update theme directly from a package (simplest).
if (-s "$o->{prefix}/usr/share/oem-theme.rpm") {
run_program::rooted($o->{prefix}, "rpm", "-U", "/usr/share/oem-theme.rpm");
unlink "/usr/share/oem-theme.rpm";
}
#- call update-menus at the end of package installation
push @{$o->{waitpids}}, run_program::raw({ root => $o->{prefix}, detach => 1 }, "update-menus", "-n");
if ($o->{updatemodules}) {
$o->{updatemodules} = detect_devices::floppy() or die N("No floppy drive available");
$o->updateModulesFromFloppy;
}
}
sub install_urpmi {
my ($o) = @_;
my $pkg = pkgs::packageByName($o->{packages}, 'urpmi');
if ($pkg && ($pkg->flag_selected || $pkg->flag_installed)) {
install_any::install_urpmi($o->{prefix},
$o->{method},
$o->{packages},
$o->{packages}{mediums});
pkgs::saveCompssUsers($o->{prefix}, $o->{packages}, $o->{compssUsers}, $o->{compssUsersSorted});
}
}
sub updateModulesFromFloppy {
my ($o) = @_;
return if $::testing;
fs::mount($o->{updatemodules}, "/floppy", "ext2", 0);
foreach (glob_("$o->{prefix}/lib/modules/*")) {
my ($kernelVersion) = m,lib/modules/(\S*),;
log::l("examining updated modules for kernel $kernelVersion");
if (-d "/floppy/$kernelVersion") {
my @src_files = glob_("/floppy/$kernelVersion/*");
my @dest_files = map { chomp_($_) } run_program::rooted_get_stdout($o->{prefix}, 'find', '/lib/modules');
foreach my $s (@src_files) {
log::l("found updatable module $s");
my ($sfile, $sext) = $s =~ m!([^/\.]*\.k?o)(?:\.gz|\.bz2)?$!;
my $qsfile = quotemeta $sfile;
my $qsext = quotemeta $sext;
foreach my $target (@dest_files) {
$target =~ /$qsfile/ or next;
eval { cp_af($s, $target) };
if ($@) {
log::l("updating module $target by $s failed: $@");
} else {
log::l("updating module $target by $s");
}
if ($target !~ /$qsfile$qsext$/) {
#- extension differ, first rename target file correctly,
#- then uncompress source file, then compress it as expected.
my ($basetarget, $text) = $target =~ /(.*?)(\.gz|\.bz2)$/;
rename $target, "$basetarget$sext";
$sext eq '.gz' and run_program::run("gzip", "-d", "$basetarget$sext");
$sext eq '.bz2' and run_program::run("bzip2", "-d", "$basetarget$sext");
$text eq '.gz' and run_program::run("gzip", $basetarget);
$text eq '.bz2' and run_program::run("bzip2", $basetarget);
}
}
}
}
}
fs::umount("/floppy");
}
#------------------------------------------------------------------------------
sub selectMouse($) {
my ($_o) = @_;
}
#------------------------------------------------------------------------------
sub configureNetwork {
my ($o) = @_;
require network::network;
network::network::configureNetwork2($o, $o->{prefix}, $o->{netc}, $o->{intf});
if ($o->{method} =~ /ftp|http|nfs/) {
$o->{netcnx}{type} = 'lan';
foreach ("up", "down") {
my $f = "$o->{prefix}/etc/sysconfig/network-scripts/net_cnx_$_";
output_with_perm($f, 0755, "\nif$_ eth0\n");
}