summaryrefslogtreecommitdiffstats
path: root/kernel
Commit message (Expand)AuthorAgeFilesLines
* - strip_modules on every archPascal Rigaux2003-08-211-8/+4
* of course newly added module pdc-ultra doesn't fit on hd.img :-/Pascal Rigaux2003-08-211-1/+1
* Add strip_modules scriptGwenolé Beauchesne2003-08-201-0/+124
* - Strip modules on AMD64 with K. O. scriptGwenolé Beauchesne2003-08-204-10/+33
* Merge from AMD64 branchGwenolé Beauchesne2003-08-191-8/+23
* Only build mar when neededGwenolé Beauchesne2003-08-191-1/+1
* hd.img doesn't fit anymore, removing gdth (chosen randomly)Pascal Rigaux2003-08-181-1/+1
* add kahlua and snd-ice1724Pascal Rigaux2003-08-141-2/+2
* add gigabit ethernet modules in all.rdz as well :/Guillaume Cottenceau2003-08-061-1/+1
* i82092 is also a controller driverGuillaume Cottenceau2003-07-091-1/+1
* allow hd.img to build again..Guillaume Cottenceau2003-07-031-0/+1
* fix #2291Thierry Vignaud2003-05-221-1/+1
* fix #3959 : add aic79xx scsi host controller driverThierry Vignaud2003-05-201-1/+1
* mptscsih doesn't fit on hd.imgPascal Rigaux2003-03-061-1/+1
* added usbvnet_rfmd to network/usbFrederic Lepied2003-03-041-1/+1
* added 3c90xFrederic Lepied2003-03-041-1/+1
* hd_usb.img -> hdcdrom_usb.imgGuillaume Cottenceau2003-02-282-2/+3
* add 3c990 and bcm4400 (bug #2316)Pascal Rigaux2003-02-252-2/+2
* don't have hptraid silraid pdcraid on stage1 (/dev/ataraid unsupported anyway...Pascal Rigaux2003-02-201-1/+1
* add silraid and pdcraidPascal Rigaux2003-02-191-2/+2
* Probe airport on PPC, don't skip gmac. Fix sound driver name.Stew Benedict2003-02-181-3/+3
* add aic7xxx_old (needed when the network card firmware hasn't been updated)Pascal Rigaux2003-02-161-1/+1
* add 8139cp (cf Frederik Himpe post on cooker)Pascal Rigaux2003-02-131-1/+1
* - better error message for bad modules in modules.plPascal Rigaux2003-02-112-3/+4
* fixed sanity check on presence of marfile.Francois Pons2003-02-111-1/+1
* ck hptraid, but discard the insmod error for itPascal Rigaux2003-02-101-1/+1
* don't list hptraid since it's too buggy (eg: bug 1085)Pascal Rigaux2003-02-101-1/+1
* - have 3w-xxxx back in network.imgPascal Rigaux2003-02-041-8/+5
* - add some more modules (from pcitable, thanks chmouel)Pascal Rigaux2003-01-301-13/+18
* - remove other & usb, add hd_usb & network_gigabit_usbPascal Rigaux2003-01-301-6/+19
* - separate "bad/old pcitable modules" (ie pcitable modules not available inPascal Rigaux2003-01-301-67/+93
* nothing should be quoted here. if one wants to remove modulesGuillaume Cottenceau2003-01-231-6/+0
* ataraid is ad-hoc raid, unsupported in stage1 anywayGuillaume Cottenceau2003-01-231-0/+1
* include FS modules (fixes #975)Guillaume Cottenceau2003-01-221-1/+1
* snd-sscape does not existThierry Vignaud2003-01-151-1/+1
* remove dobleThierry Vignaud2003-01-141-2/+2
* add missing sound modules (found by check_snd in comparing draksoundThierry Vignaud2003-01-141-5/+5
* using pixel though for perl (-lne instead of -ln).Francois Pons2003-01-081-1/+1
* definitively fixed bad version and release retrieved from BOOT kernel.Francois Pons2003-01-081-2/+2
* remove some more scsi driversPascal Rigaux2003-01-021-0/+1
* add floppy.o for all boot disks, don't have some 3c isa cards to fit network.imgPascal Rigaux2002-12-051-1/+4
* fixed too many modules removed (but untested if still buildable, pixel can doFrancois Pons2002-11-251-6/+6
* revert.Francois Pons2002-11-251-1/+1
* added adiusbadsl (for supporting Sagem USB ADSL modem).Francois Pons2002-11-251-7/+13
* add new drivers that appears in alsa cvsThierry Vignaud2002-10-281-3/+3
* add nvaudio driver for lord fredlThierry Vignaud2002-10-211-1/+1
* fealnxGuillaume Cottenceau2002-09-252-0/+2
* - added orinoco_cs in pcmciaDamien Chaumette2002-09-131-1/+1
* fake support the firewire in stage1 (as if it were usb ;p)Guillaume Cottenceau2002-09-052-3/+4
* add r8169Pascal Rigaux2002-08-292-2/+2
an> ], "snd-darla20" => [ "unknown" ], "snd-darla24" => [ "unknown" ], "snd-dt0197h" => [ "unknown" ], # isa "snd-dt019x" => [ "unknown" ], # isa "snd-emu10k1" => [ "audigy", "emu10k1" ], "snd-ens1370" => [ "es1370" ], "snd-ens1371" => [ "es1371" ], "snd-es1688" => [ "sb" ], # isa "snd-es18xx" => [ "sb" ], # isa "snd-es1938" => [ "esssolo1" ], "snd-es1968" => [ "maestro" ], # isa "snd-es968" => [ "sb" ], "snd-fm801" => [ "forte" ], "snd-gina20" => [ "unknown" ], "snd-gina24" => [ "unknown" ], "snd-gusclassic" => [ "gus" ], # isa "snd-gusextreme" => [ "gus" ], # isa "snd-gusmax" => [ "gus" ], # isa "snd-hdsp" => [ "unknown" ], "snd-ice1712" => [ "unknown" ], # isa "snd-ice1724" => [ "unknown" ], # isa "snd-intel8x0" => [ "ali5455", "i810_audio", "nvaudio" ], "snd-interwave" => [ "gus" ], # isa "snd-interwave-stb" => [ "unknown" ], # isa "snd-korg1212" => [ "unknown" ], # isa "snd-layla20" => [ "unknown" ], "snd-layla24" => [ "unknown" ], "snd-maestro3" => [ "maestro3" ], "snd-mia" => [ "unknown" ], "snd-mixart" => [ "unknown" ], "snd-mona" => [ "unknown" ], "snd-mpu401" => [ "mpu401" ], "snd-nm256" => [ "nm256_audio" ], "snd-opl3sa2" => [ "opl3", "opl3sa", "opl3sa2" ], # isa "snd-opti92x-ad1848" => [ "unknown" ], # isa "snd-opti92x-cs4231" => [ "unknown" ], # isa "snd-opti93x" => [ "mad16" ], "snd-rme32" => [ "unknown" ], # isa "snd-rme96" => [ "rme96xx" ], # pci "snd-rme9652" => [ "rme96xx" ], # pci "snd-sb16" => ["sscape", "sb"], "snd-sb8" => [ "sb" ], "snd-sbawe" => [ "awe_wave" ], "snd-sgalaxy" => [ "sgalaxy" ], # isa "snd-sonicvibes" => [ "sonicvibes" ], "snd-sscape" => [ "sscape" ], # isa "snd-trident" => [ "trident" ], "snd-usb-audio" => [ "audio" ], # usb "snd-via82xx" => [ "via82cxxx_audio" ], "snd-vx222" => [ "unknown" ], "snd-vxp440" => [ "unknown" ], # pcmcia "snd-vxpocket" => [ "unknown" ], # pcmcia "snd-wavefront" => [ "wavefront" ], # isa "snd-ymfpci" => [ "ymfpci" ], ); our %oss2alsa = ( if_(arch() =~ /ppc/, "dmasound_pmac" => [ "snd-powermac" ]), "ad1816" => [ "snd-ad1816a" ], "ad1848" => [ "snd-ad1848", "snd-cs4236" ], "ad1889" => [ "unknown" ], "ali5455" => [ "snd-intel8x0" ], "audigy" => [ "snd-emu10k1" ], "audio" => [ "snd-usb-audio" ], # usb "awe_wave" => [ "snd-sbawe" ], "btaudio" => [ "snd-bt87x" ], "cmpci" => [ "snd-cmipci" ], "cs4232" => [ "snd-cs4232" ], "cs4281" => [ "snd-cs4281" ], "cs46xx" => [ "snd-cs46xx" ], "emu10k1" => [ "snd-emu10k1" ], "es1370" => [ "snd-ens1370" ], "es1371" => [ "snd-ens1371" ], "esssolo1" => [ "snd-es1938" ], "forte" => [ "snd-fm801" ], "gus" => ["snd-interwave", "snd-gusclassic", "snd-gusmax", "snd-gusextreme"], "i810_audio" => [ "snd-intel8x0" ], "ice1712" => [ "snd-ice1712" ], "mad16" => [ "snd-opti93x" ], "maestro" => [ "snd-es1968" ], "maestro3" => [ "snd-maestro3" ], "mpu401" => [ "snd-mpu401" ], "msnd_pinnacle" => [ "unknown" ], "nm256_audio" => [ "snd-nm256" ], "nvaudio" => [ "snd-intel8x0" ], "opl3" => [ "snd-opl3sa2" ], "opl3sa" => [ "snd-opl3sa2" ], "opl3sa2" => [ "snd-opl3sa2" ], "pas2" => [ "unknown" ], "pss" => [ "snd-ad1848" ], "rme96xx" => [ "snd-rme96", "snd-rme9652" ], "sam9407" => [ "unknown" ], "sb" => [ "snd-als100", "snd-cmi8330", "snd-es1688", "snd-es18xx", "snd-es968", "snd-sb8", "snd-sb16" ], "sgalaxy" => [ "snd-sgalaxy" ], "sonicvibes" => [ "snd-sonicvibes" ], "sscape" => [ "snd-sb16", "snd-sscape" ], "trident" => [ "snd-ali5451", "snd-trident" ], "via82cxxx_audio" => [ "snd-via82xx" ], "wavefront" => [ "snd-wavefront" ], "ymfpci" => [ "snd-ymfpci" ], ); my @blacklist = qw(cs46xx cs4281); my $blacklisted = 0; sub rooted { run_program::rooted($::prefix, @_) } sub unload { modules::unload(@_) if $::isStandalone || $blacklisted } sub load { my ($modules_conf, $name) = @_; modules::load_and_configure($modules_conf, $name) if $::isStandalone || $blacklisted; } sub get_alternative { my ($driver) = @_; $alsa2oss{$driver} || $oss2alsa{$driver}; } sub do_switch { my ($in, $modules_conf, $old_driver, $new_driver, $index) = @_; return if $old_driver eq $new_driver; my $_wait = $in->wait_message(N("Please wait"), N("Please Wait... Applying the configuration")); log::explanations("removing old $old_driver\n"); if ($::isStandalone) { rooted("service sound stop") unless $blacklisted; rooted("service alsa stop") if $old_driver =~ /^snd-/ && !$blacklisted; unload($old_driver); # run_program("/sbin/modprobe -r $driver"); # just in case ... } $modules_conf->remove_module($old_driver); $modules_conf->set_sound_slot("sound-slot-$index", $new_driver); $modules_conf->write; if ($new_driver =~ /^snd-/) { # new driver is an alsa one $in->do_pkgs->ensure_binary_is_installed('alsa-utils', 'alsactl'); rooted("service alsa start") if $::isStandalone && !$blacklisted; rooted("/sbin/chkconfig --add alsa") if $::isStandalone; load($modules_conf, $new_driver) if $::isStandalone; # service alsa is buggy } else { rooted("/sbin/chkconfig --del alsa") } log::explanations("loading new $new_driver\n"); rooted("/sbin/chkconfig --add sound"); # just in case ... rooted("service sound start") if $::isStandalone && !$blacklisted; } sub switch { my ($in, $modules_conf, $device) = @_; my $driver = $device->{current_driver} || $device->{driver}; foreach (@blacklist) { $blacklisted = 1 if $driver eq $_ } my @alternative = @{get_alternative($driver)}; unless ($driver eq $device->{driver} || member($device->{driver}, @alternative)) { push @alternative, @{get_alternative($device->{driver})}, $device->{driver} } if (@alternative) { my $new_driver = $driver; push @alternative, $driver; my %des = modules::category2modules_and_description('multimedia/sound'); if ($new_driver eq 'unknown') { $in->ask_from(N("No alternative driver"), N("There's no known OSS/ALSA alternative driver for your sound card (%s) which currently uses \"%s\"", $device->{description}, $driver), [ get_any_driver_entry($in, $modules_conf, $driver, $device), ] ); } elsif ($in->ask_from_({ title => N("Sound configuration"), messages => N("Here you can select an alternative driver (either OSS or ALSA) for your sound card (%s).", $device->{description}) . N("\n\nYour card currently use the %s\"%s\" driver (default driver for your card is \"%s\")", ($driver =~ /^snd-/ ? "ALSA " : "OSS "), $driver, $device->{driver}), interactive_help => sub { N("OSS (Open Sound System) was the first sound API. It's an OS independent sound API (it's available on most UNIX(tm) systems) but it's a very basic and limited API. What's more, OSS drivers all reinvent the wheel. ALSA (Advanced Linux Sound Architecture) is a modularized architecture which supports quite a large range of ISA, USB and PCI cards.\n It also provides a much higher API than OSS.\n To use alsa, one can either use: - the old compatibility OSS api - the new ALSA api that provides many enhanced features but requires using the ALSA library. "); }, }, [ { label => N("Driver:"), val => \$new_driver, list => \@alternative, default => $new_driver, sort =>1, help => join("\n\n", map { qq("$_": ) . $des{$_} } @alternative), allow_empty_list => 1, }, { val => N("Trouble shooting"), disabled => sub {}, clicked => sub { &trouble($in) } }, get_any_driver_entry($in, $modules_conf, $driver, $device), ])) { return if $new_driver eq $device->{current_driver}; log::explanations("switching audio driver from '" . $device->{current_driver} . "' to '$new_driver'\n"); $in->ask_warn(N("Warning"), N("The old \"%s\" driver is blacklisted.\n It has been reported to oops the kernel on unloading.\n The new \"%s\" driver will only be used on next bootstrap.", $device->{current_driver}, $new_driver)) if $blacklisted; do_switch($in, $modules_conf, $device->{current_driver}, $new_driver, $device->{sound_slot_index}); $device->{current_driver} = $new_driver; } } elsif ($driver =~ /^Bad:/) { $driver =~ s/^Bad://; $in->ask_warn(N("No open source driver"), N("There's no free driver for your sound card (%s), but there's a proprietary driver at \"%s\".", $device->{description}, $driver)); } elsif ($driver eq "unknown") { $in->ask_from(N("No known driver"), N("There's no known driver for your sound card (%s)", $device->{description}), [ get_any_driver_entry($in, $modules_conf, $driver, $device) ]); } else { $in->ask_warn(N("Unknown driver"), N("Error: The \"%s\" driver for your sound card is unlisted", $driver)); } end: } sub config { my ($in, $modules_conf, $device) = @_; switch($in, $modules_conf, $device); } sub trouble { my ($in) = @_; $in->ask_warn(N("Sound trouble shooting"), formatAlaTeX( #-PO: keep the double empty lines between sections, this is formatted a la LaTeX N("The classic bug sound tester is to run the following commands: - \"lspcidrake -v | fgrep AUDIO\" will tell you which driver your card uses by default - \"grep sound-slot /etc/modules.conf\" will tell you what driver it currently uses - \"/sbin/lsmod\" will enable you to check if its module (driver) is loaded or not - \"/sbin/chkconfig --list sound\" and \"/sbin/chkconfig --list alsa\" will tell you if sound and alsa services're configured to be run on initlevel 3 - \"aumix -q\" will tell you if the sound volume is muted or not - \"/sbin/fuser -v /dev/dsp\" will tell which program uses the sound card. "))); } sub get_any_driver_entry { my ($in, $modules_conf, $driver, $device) = @_; return () if $::isInstall; +{ val => N("Let me pick any driver"), disabled => sub {}, clicked => sub { my $old_driver = $driver; if ($in->ask_from(N("Choosing an arbitrary driver"), formatAlaTeX( #-PO: keep the double empty lines between sections, this is formatted a la LaTeX N("If you really think that you know which driver is the right one for your card you can pick one in the above list. The current driver for your \"%s\" sound card is \"%s\" ", $device->{description}, $driver)), [ { label => N("Driver:"), val => \$driver, list => [ category2modules("multimedia/sound") ], type => 'combo', default => $driver, sort =>1, separator => '|' }, ] )) { do_switch($in, $modules_conf, $old_driver, $driver, $device->{sound_slot_index}); goto end; } } } } sub configure_sound_slots { my ($modules_conf) = @_; my $altered = 0; each_index { my $default_driver = $modules_conf->get_alias("sound-slot-$::i"); if (!member($default_driver, @{get_alternative($_->{driver})}, $_->{driver})) { $altered ||= $default_driver; $modules_conf->set_sound_slot("sound-slot-$::i", $_->{driver}); } } detect_devices::getSoundDevices(); $modules_conf->write if $altered && $::isStandalone; } 1; ="hl kwb">$availableCorrected, $o->{installClass}) if exists $o->{compssListLevel}; $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 { commands::cp("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") }; } } } #- some packages need such files for proper installation. install_any::write_ldsoconf($o->{prefix}); fs::write($o->{prefix}, $o->{fstab}, $o->{manualFstab}, $o->{useSupermount}); network::add2hosts("$o->{prefix}/etc/hosts", "localhost.localdomain", "127.0.0.1"); require pkgs; pkgs::init_db($o->{prefix}, $o->{isUpgrade}); } sub pkg_install { my ($o, @l) = @_; require pkgs; pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || die "$_ rpm not found") foreach @l; $o->installPackages; } sub installPackages($$) { #- complete REWORK, TODO and TOCHECK! my ($o) = @_; my $packages = $o->{packages}; if (@{$o->{toRemove} || []}) { #- hack to ensure proper upgrade of packages from other distribution, #- as release number are not mandrake based. this causes save of #- important files and restore them after. foreach (@{$o->{toSave} || []}) { if (-e "$o->{prefix}/$_") { unlink "$o->{prefix}/$_.mdkgisave"; eval { commands::cp("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") }; } } pkgs::remove($o->{prefix}, $o->{toRemove}); foreach (@{$o->{toSave} || []}) { if (-e "$o->{prefix}/$_.mdkgisave") { unlink "$o->{prefix}/$_"; rename "$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_"; } } $o->{toSave} = []; #- hack for compat-glibc to upgrade properly :-( if (pkgs::packageFlagSelected(pkgs::packageByName($packages, 'compat-glibc'))) { rename "$o->{prefix}/usr/i386-glibc20-linux", "$o->{prefix}/usr/i386-glibc20-linux.mdkgisave"; } } #- small transaction will be built based on this selection and depslist. my @toInstall = pkgs::packagesToInstall($packages); $ENV{DURING_INSTALL} = 1; pkgs::install($o->{prefix}, $o->{isUpgrade}, \@toInstall, $packages->[1], $packages->[2]); delete $ENV{DURING_INSTALL}; } sub afterInstallPackages($) { my ($o) = @_; return if $::g_auto_install; -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"; pkgs::done_db(); #- why not? cuz weather is nice today :-) [pixel] sync(); sync(); $o->pcmciaConfig(); #- for mandrake_firstime output "$o->{prefix}/var/lock/TMP_1ST", ""; #- remove the nasty acon... run_program::rooted($o->{prefix}, "chkconfig", "--del", "acon") unless $ENV{LANGUAGE} =~ /ar/; #- make the mdk fonts last in available fonts for buggy kde run_program::rooted($o->{prefix}, "chkfontpath", "--remove", "/usr/X11R6/lib/X11/fonts/mdk"); run_program::rooted($o->{prefix}, "chkfontpath", "--add", "/usr/X11R6/lib/X11/fonts/mdk"); #- call update-menus at the end of package installation run_program::rooted($o->{prefix}, "update-menus"); #- mainly for auto_install's run_program::rooted($o->{prefix}, "sh", "-c", $o->{postInstall}) if $o->{postInstall}; #- create /etc/sysconfig/desktop file according to user choice and presence of /usr/bin/kdm or /usr/bin/gdm. my $f = "$o->{prefix}/etc/sysconfig/desktop"; if ($o->{compssUsersChoice}{KDE} && -x "$o->{prefix}/usr/bin/kdm") { output($f, "KDE\n"); } elsif ($o->{compssUsersChoice}{Gnome} && -x "$o->{prefix}/usr/bin/gdm") { output($f, "GNOME\n"); } if ($o->{pcmcia}) { substInFile { s/.*(TaskBarShowAPMStatus).*/$1=1/ } "$o->{prefix}/usr/lib/X11/icewm/preferences"; eval { commands::cp("$o->{prefix}/usr/share/applnk/System/kapm.kdelnk", "$o->{prefix}/etc/skel/Desktop/Autostart/kapm.kdelnk") }; } my $msec = "$o->{prefix}/etc/security/msec"; substInFile { s/^audio\n//; $_ .= "audio\n" if eof } "$msec/group.conf" if -d $msec; substInFile { s/^cdrom\n//; $_ .= "cdrom\n" if eof } "$msec/group.conf" if -d $msec; substInFile { s/^xgrp\n//; $_ .= "xgrp\n" if eof } "$msec/group.conf" if -d $msec; my $pkg = pkgs::packageByName($o->{packages}, 'urpmi'); if ($pkg && pkgs::packageFlagSelected($pkg)) { install_any::install_urpmi($o->{prefix}, $o->{method}, $o->{packages}[2]); substInFile { s/^urpmi\n//; $_ .= "urpmi\n" if eof } "$msec/group.conf" if -d $msec; } #- update language and icons for KDE. log::l("updating language for kde"); install_any::kdelang_postinstall($o->{prefix}); log::l("updating kde icons according to available devices"); install_any::kdeicons_postinstall($o->{prefix}); my $welcome = _("Welcome to %s", "[HOSTNAME]"); substInFile { s/^(GreetString)=.*/$1=$welcome/ } "$o->{prefix}/usr/share/config/kdmrc"; substInFile { s/^(UserView)=false/$1=true/ } "$o->{prefix}/usr/share/config/kdmrc" if $o->{security} < 3; run_program::rooted($o->{prefix}, "kdeDesktopCleanup"); #- konsole and gnome-terminal are lamers in exotic languages, link them to something better if ($o->{lang} =~ /ja|ko|zh/) { foreach ("konsole", "gnome-terminal") { my $f = "$o->{prefix}/usr/bin/$_"; symlinkf("X11/rxvt.sh", $f) if -e $f; } } #- my $hasttf; #- my $dest = "/usr/X11R6/lib/X11/fonts/drakfont"; #- foreach my $d (map { $_->{mntpoint} } grep { isFat($_) } @{$o->{fstab}}) { #- foreach my $D (map { "$d/$_" } grep { m|^win|i } all("$o->{prefix}$d")) { #- $D .= "/fonts"; #- -d "$o->{prefix}$D" or next; #- log::l("found win font dir $D"); #- if (!$hasttf) { #- $hasttf = $o->ask_okcancel('', #-_("Some true type fonts from windows have been found on your computer. #-Do you want to use them? Be sure you have the right to use them under Linux."), 1) or goto nottf; #- mkdir "$o->{prefix}$dest", 0755; #- } #- /(.*)\.ttf/i and symlink "$D/$_", "$o->{prefix}$dest/$1.ttf" foreach grep { /\.ttf/i } all("$o->{prefix}$D"); #- } #- } #- nottf: #- if ($hasttf) { #- run_program::rooted($o->{prefix}, "ttmkfdir", "-d", $dest, "-o", "$dest/fonts.dir"); #- run_program::rooted($o->{prefix}, "chkfontpath", "--add", $dest); #- } foreach (install_any::list_skels()) { my $found; substInFile { $found ||= /KFM Misc Defaults/; $_ .= "[KFM Misc Defaults] GridWidth=85 GridHeight=70 " if eof && !$found; } "$o->{prefix}$_/.kde/share/config/kfmrc" } #- move some file after an upgrade that may be seriously annoying. #- and rename saved files to .mdkgiorig. if ($o->{isUpgrade}) { log::l("moving previous desktop files that have been updated to Trash of each user"); install_any::move_desktop_file($o->{prefix}); foreach (@filesToSaveForUpgrade) { if (-e "$o->{prefix}$_.mdkgisave") { unlink "$o->{prefix}$_.mdkgiorig"; rename "$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_.mdkgiorig"; } } } } #------------------------------------------------------------------------------ sub selectMouse($) { my ($o) = @_; } #------------------------------------------------------------------------------ sub configureNetwork($) { my ($o) = @_; my $etc = "$o->{prefix}/etc"; network::write_conf("$etc/sysconfig/network", $o->{netc}); network::write_resolv_conf("$etc/resolv.conf", $o->{netc}); network::write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_->{DEVICE}", $_) foreach @{$o->{intf}}; network::add2hosts("$etc/hosts", $o->{netc}{HOSTNAME}, map { $_->{IPADDR} } @{$o->{intf}}); network::sethostname($o->{netc}) unless $::testing; network::addDefaultRoute($o->{netc}) unless $::testing; $o->pkg_install("dhcpcd") if grep { $_->{BOOTPROTO} =~ /^(dhcp)$/ } @{$o->{intf}}; # Handle also pump (this is still in initscripts no?) $o->pkg_install("pump") if grep { $_->{BOOTPROTO} =~ /^(pump|bootp)$/ } @{$o->{intf}}; #-res_init(); #- reinit the resolver so DNS changes take affect miscellaneousNetwork($o); } #------------------------------------------------------------------------------ sub pppConfig { my ($o) = @_; $o->{modem} or return; symlinkf($o->{modem}{device}, "$o->{prefix}/dev/modem") or log::l("creation of $o->{prefix}/dev/modem failed"); $o->pkg_install("ppp") unless $::testing; my %toreplace; $toreplace{$_} = $o->{modem}{$_} foreach qw(connection phone login passwd auth domain dns1 dns2); $toreplace{kpppauth} = ${{ 'Script-based' => 0, 'PAP' => 1, 'Terminal-based' => 2, 'CHAP' => 3, }}{$o->{modem}{auth}}; $toreplace{phone} =~ s/\D//g; $toreplace{dnsserver} = join ',', map { $o->{modem}{$_} } "dns1", "dns2"; $toreplace{dnsserver} .= $toreplace{dnsserver} && ','; #- using peerdns or dns1,dns2 avoid writing a /etc/resolv.conf file. $toreplace{peerdns} = "yes"; $toreplace{connection} ||= 'DialupConnection'; $toreplace{domain} ||= 'localdomain'; $toreplace{intf} ||= 'ppp0'; $toreplace{papname} = $o->{modem}{auth} eq 'PAP' && $toreplace{login}; #- build ifcfg-ppp0. my $ifcfg = "$o->{prefix}/etc/sysconfig/network-scripts/ifcfg-ppp0"; local *IFCFG; open IFCFG, ">$ifcfg" or die "Can't open $ifcfg"; print IFCFG <<END; DEVICE="$toreplace{intf}" ONBOOT="no" USERCTL="no" MODEMPORT="/dev/modem" LINESPEED="115200" PERSIST="yes" DEFABORT="yes" DEBUG="yes" INITSTRING="ATZ" DEFROUTE="yes" HARDFLOWCTL="yes" ESCAPECHARS="no" PPPOPTIONS="" PAPNAME="$toreplace{papname}" REMIP="" NETMASK="" IPADDR="" MRU="" MTU="" DISCONNECTTIMEOUT="5" RETRYTIMEOUT="60" BOOTPROTO="none" PEERDNS="$toreplace{peerdns}" END foreach (1..2) { if ($toreplace{"dns$_"}) { print IFCFG <<END; DNS$_=$toreplace{"dns$_"} END } } close IFCFG; #- build chat-ppp0. my $chat = "$o->{prefix}/etc/sysconfig/network-scripts/chat-ppp0"; local *CHAT; open CHAT, ">$chat" or die "Can't open $chat"; print CHAT <<END; 'ABORT' 'BUSY' 'ABORT' 'ERROR' 'ABORT' 'NO CARRIER' 'ABORT' 'NO DIALTONE' 'ABORT' 'Invalid Login' 'ABORT' 'Login incorrect' '' 'ATZ' 'OK' 'ATDT$toreplace{phone}' 'CONNECT' '' END if ($o->{modem}{auth} eq 'Terminal-based' || $o->{modem}{auth} eq 'Script-based') { print CHAT <<END; 'ogin:' '$toreplace{login}' 'ord:' '$toreplace{passwd}' END } print CHAT <<END; 'TIMEOUT' '5' '~--' '' END close CHAT; if ($o->{modem}{auth} eq 'PAP') { #- need to create a secrets file for the connection. my $secrets = "$o->{prefix}/etc/ppp/" . lc($o->{modem}{auth}) . "-secrets"; my @l = cat_($secrets); my $replaced = 0; do { $replaced ||= 1 if s/^\s*"?$toreplace{login}"?\s+ppp0\s+(\S+)/"$toreplace{login}" ppp0 "$toreplace{passwd}"/; } foreach @l; if ($replaced) { local *F; open F, ">$secrets" or die "Can't open $secrets: $!"; print F @l; } else { local *F; open F, ">>$secrets" or die "Can't open $secrets: $!"; print F "$toreplace{login} ppp0 \"$toreplace{passwd}\"\n"; } #- restore access right to secrets file, just in case. chmod 0600, $secrets; } #- CHAP is not supported by initscripts, need patching before doing more on that here! #-install_any::template2userfile($o->{prefix}, "$ENV{SHARE_PATH}/kppprc.in", ".kde/share/config/kppprc", 1, %toreplace); commands::mkdir_("-p", "$o->{prefix}/usr/share/config"); template2file("$ENV{SHARE_PATH}/kppprc.in", "$o->{prefix}/usr/share/config/kppprc", %toreplace); miscellaneousNetwork($o); } #------------------------------------------------------------------------------ sub installCrypto { my ($o) = @_; my $u = $o->{crypto} or return; $u->{mirror} && $u->{packages} or return; $o->upNetwork; require crypto; my @crypto_packages = crypto::getPackages($o->{prefix}, $o->{packages}, $u->{mirror}); my $oldGetFile = \&install_any::getFile; local *install_any::getFile = sub { my ($rpmfile) = @_; if ($rpmfile =~ /^(.*)-[^-]*-[^-]*$/ && member($1, @crypto_packages)) { log::l("crypto::getFile $rpmfile"); crypto::getFile($rpmfile, $u->{mirror}); } else { #- use previous getFile typically if non cryptographic packages #- have been selected by dependancies. log::l("normal getFile $rpmfile"); &$oldGetFile($rpmfile); } }; $o->pkg_install(@{$u->{packages}}); } #------------------------------------------------------------------------------ sub pcmciaConfig($) { my ($o) = @_; my $t = $o->{pcmcia}; #- should be set after installing the package above else the file will be renamed. setVarsInSh("$o->{prefix}/etc/sysconfig/pcmcia", { PCMCIA => $t ? "yes" : "no", PCIC => $t, PCIC_OPTS => "", CORE_OPTS => "", }); } #------------------------------------------------------------------------------ sub timeConfig { my ($o, $f) = @_; require timezone; timezone::write($o->{prefix}, $o->{timezone}, $f); } #------------------------------------------------------------------------------ sub servicesConfig {} #------------------------------------------------------------------------------ sub printerConfig { my($o) = @_; if ($o->{printer}{configured}) { require pkgs; pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, 'rhs-printfilters')); $o->installPackages($o->{packages}); require printer; foreach (keys %{$o->{printer}{configured} || {}}) { log::l("configuring printer queue $_->{queue}"); printer::copy_printer_params($_, $o->{printer}); #- setup all configured queues, which is not the case interactively where #- only the working queue is setup on configuration. printer::configure_queue($o->{printer}); } } } #------------------------------------------------------------------------------ my @etc_pass_fields = qw(name pw uid gid realname home shell); sub setRootPassword($) { my ($o) = @_; my $p = $o->{prefix}; my $u = $o->{superuser} ||= {}; $u->{pw} ||= $u->{password} && install_any::crypt($u->{password}); my @lines = cat_(my $f = "$p/etc/passwd") or log::l("missing passwd file"), return; local *F; open F, "> $f" or die "failed to write file $f: $!\n"; foreach (@lines) { if (/^root:/) { chomp; my %l; @l{@etc_pass_fields} = split ':'; add2hash($u, \%l); $_ = join(':', @$u{@etc_pass_fields}) . "\n"; } print F $_; } } #------------------------------------------------------------------------------ sub addUser($) { my ($o) = @_; my $p = $o->{prefix}; my (%uids, %gids); foreach (glob_("$p/home")) { my ($u, $g) = (stat($_))[4,5]; $uids{$u} = 1; $gids{$g} = 1; } my %done; my @l = grep { if (!$_->{name} || getpwnam($_->{name}) || $done{$_->{name}}) { 0; } else { $_->{home} ||= "/home/$_->{name}"; my $u = $_->{uid} || ($_->{oldu} = (stat("$p$_->{home}"))[4]); my $g = $_->{gid} || ($_->{oldg} = (stat("$p$_->{home}"))[5]); #- search for available uid above 501 else initscripts may fail to change language for KDE. if (!$u || getpwuid($u)) { for ($u = 501; getpwuid($u) || $uids{$u}; $u++) {} } if (!$g || getgrgid($g)) { for ($g = 501; getgrgid($g) || $gids{$g}; $g++) {} } $_->{uid} = $u; $uids{$u} = 1; $_->{gid} = $g; $gids{$g} = 1; $_->{pw} ||= $_->{password} && install_any::crypt($_->{password}); $_->{shell} ||= "/bin/bash"; $done{$_->{name}} = 1; } } @{$o->{users} || []}; my @passwd = cat_("$p/etc/passwd");; local *F; open F, ">> $p/etc/passwd" or die "can't append to passwd file: $!"; print F join(':', @$_{@etc_pass_fields}), "\n" foreach @l; open F, ">> $p/etc/group" or die "can't append to group file: $!"; print F "$_->{name}:x:$_->{gid}:\n" foreach @l; foreach my $u (@l) { if (! -d "$p$u->{home}") { my $mode = $o->{security} < 2 ? 0755 : 0750; eval { commands::cp("-f", "$p/etc/skel", "$p$u->{home}") }; if ($@) { log::l("copying of skel failed: $@"); mkdir("$p$u->{home}", $mode); } else { chmod $mode, "$p$u->{home}"; } } eval { commands::chown_("-r", "$u->{uid}.$u->{gid}", "$p$u->{home}") } if $u->{uid} != $u->{oldu} || $u->{gid} != $u->{oldg}; } require any; any::addUsers($o->{prefix}, @l); } #------------------------------------------------------------------------------ sub createBootdisk($) { my ($o) = @_; my $dev = $o->{mkbootdisk} or return; my @l = detect_devices::floppies(); $dev = shift @l || die _("No floppy drive available") if $dev eq "1"; #- special case meaning autochoose return if $::testing; if (arch() =~ /^sparc/) { require silo; silo::mkbootdisk($o->{prefix}, install_any::kernelVersion($o), $dev, $o->{bootloader}{perImageAppend}); } else { require lilo; lilo::mkbootdisk($o->{prefix}, install_any::kernelVersion($o), $dev, $o->{bootloader}{perImageAppend}); } $o->{mkbootdisk} = $dev; } #------------------------------------------------------------------------------ sub readBootloaderConfigBeforeInstall { my ($o) = @_; my ($image, $v); if (arch() =~ /^sparc/) { require silo; add2hash($o->{bootloader} ||= {}, silo::read($o->{prefix}, "/etc/silo.conf")); } else { require lilo; add2hash($o->{bootloader} ||= {}, lilo::read($o->{prefix}, "/etc/lilo.conf")); } #- since kernel or kernel-smp may not be upgraded, it should be checked #- if there is a need to update existing lilo.conf entries by using that #- hash. my %ofpkgs = ( 'vmlinuz' => pkgs::packageByName($o->{packages}, 'kernel'), 'vmlinuz-smp' => pkgs::packageByName($o->{packages}, 'kernel-smp'), ); #- change the /boot/vmlinuz or /boot/vmlinuz-smp entries to follow symlink. foreach $image (keys %ofpkgs) { pkgs::packageFlagSelected($ofpkgs{$image}) or next; if (my $v = readlink "$o->{prefix}/boot/$image") { $v = "/boot/$v" if $v !~ m|^/|; if (-e "$o->{prefix}$v") { my $e = lilo::get("/boot/$image", $o->{bootloader}) or next; $e->{kernel_or_dev} = $v; log::l("renaming /boot/$image entry by $v"); } } } } sub setupBootloaderBefore { my ($o) = @_; if (arch() =~ /alpha/) { if (my $dev = fsedit::get_root($o->{fstab})) { $o->{bootloader}{boot} ||= "/dev/$dev->{rootDevice}"; $o->{bootloader}{root} ||= "/dev/$dev->{device}"; $o->{bootloader}{part_nb} ||= first($dev->{device} =~ /(\d+)/); } } elsif (arch() =~ /^sparc/) { require silo; silo::suggest($o->{prefix}, $o->{bootloader}, $o->{hds}, $o->{fstab}, install_any::kernelVersion($o)); } else { require lilo; lilo::suggest($o->{prefix}, $o->{bootloader}, $o->{hds}, $o->{fstab}, install_any::kernelVersion($o)); if ($o->{miscellaneous}{profiles}) { my $e = lilo::get_label("linux", $o->{bootloader}); push @{$o->{bootloader}{entries}}, { %$e, label => "office", append => "$e->{append} prof=Office" }; $e->{append} .= " prof=Home"; } lilo::suggest_floppy($o->{bootloader}) if $o->{security} <= 3; $o->{bootloader}{keytable} ||= keyboard::keyboard2kmap($o->{keyboard}); } } sub setupBootloader($) { my ($o) = @_; return if $::g_auto_install; if (arch() =~ /alpha/) { return if $::testing; my $b = $o->{bootloader}; $b->{boot} or $o->ask_warn('', "Can't install aboot, not a bsd disklabel"), return; run_program::rooted($o->{prefix}, "swriteboot", $b->{boot}, "/boot/bootlx") or do { cdie "swriteboot failed"; run_program::rooted($o->{prefix}, "swriteboot", "-f1", $b->{boot}, "/boot/bootlx"); }; run_program::rooted($o->{prefix}, "abootconf", $b->{boot}, $b->{part_nb}); output "$o->{prefix}/etc/aboot.conf", map_index { "$::i:$b->{part_nb}$_ root=$b->{root} $b->{perImageAppend}\n" } map { /$o->{prefix}(.*)/ } eval { glob_("$o->{prefix}/boot/vmlinux*") }; } elsif (arch() =~ /^sparc/) { silo::install($o->{prefix}, $o->{bootloader}); } else { $o->{lnx4win} ? lilo::install_loadlin($o->{prefix}, $o->{bootloader}, $o->{fstab}) : lilo::install($o->{prefix}, $o->{bootloader}, $o->{fstab}, $o->{hds}); } } #------------------------------------------------------------------------------ sub setupXfreeBefore { my ($o) = @_; my $xkb = $o->{X}{keyboard}{xkb_keymap} || keyboard::keyboard2xkb($o->{keyboard}); if (!-e "$o->{prefix}/usr/X11R6/lib/X11/xkb/symbols/$xkb" && (my $f = keyboard::xmodmap_file($o->{keyboard}))) { commands::cp("-f", $f, "$o->{prefix}/etc/X11/xinit/Xmodmap"); $xkb = ''; } $o->{X}{keyboard}{xkb_keymap} = $xkb; $o->{X}{mouse} = $o->{mouse}; $o->{X}{wacom} = $o->{wacom}; require Xconfig; Xconfig::getinfoFromDDC($o->{X}); #- keep this here if the package has to be updated. $o->pkg_install("XFree86"); } sub setupXfree { my ($o) = @_; $o->setupXfreeBefore; require Xconfigurator; require class_discard; { local $::testing = 0; #- unset testing local $::auto = 1; local $::skiptest = 1; Xconfigurator::main($o->{prefix}, $o->{X}, class_discard->new, $o->{allowFB}, bool($o->{pcmcia}), sub { $o->pkg_install("XFree86-$_[0]"); }); } $o->setupXfreeAfter; } sub setupXfreeAfter { my ($o) = @_; if ($o->{X}{card}{server} eq 'FBDev') { unless (install_any::setupFB($o, Xconfigurator::getVGAMode($o->{X}))) { log::l("disabling automatic start-up of X11 if any as setup framebuffer failed"); Xconfigurator::rewriteInittab(3) unless $::testing; #- disable automatic start-up of X11 on error. } } if ($o->{X}{default_depth} >= 16 && $o->{X}{card}{default_wres} >= 1024) { log::l("setting large icon style for kde"); install_any::kderc_largedisplay($o->{prefix}); } } #------------------------------------------------------------------------------ sub miscellaneousNetwork { my ($o) = @_; setVarsInSh ("$o->{prefix}/etc/profile.d/proxy.sh", $o->{miscellaneous}, qw(http_proxy ftp_proxy)); setVarsInCsh("$o->{prefix}/etc/profile.d/proxy.csh", $o->{miscellaneous}, qw(http_proxy ftp_proxy)); } #------------------------------------------------------------------------------ sub miscellaneous { my ($o) = @_; my %s = getVarsFromSh("$o->{prefix}/etc/sysconfig/system"); $o->{miscellaneous}{HDPARM} ||= $s{HDPARM} if exists $s{HDPARM}; $o->{miscellaneous}{CLEAN_TMP} ||= $s{CLEAN_TMP} if exists $s{CLEAN_TMP}; $o->{security} ||= $s{SECURITY} if exists $s{SECURITY}; $ENV{SECURE_LEVEL} = $o->{security}; add2hash_ $o, { useSupermount => $o->{security} < 4 && $o->{installClass} !~ /corporate|server/ }; cat_("/proc/cmdline") =~ /mem=(\S+)/; add2hash_($o->{miscellaneous} ||= {}, { numlock => !$o->{pcmcia}, $1 ? (memsize => $1) : () }); local $_ = $o->{bootloader}{perImageAppend}; if (my $ramsize = $o->{miscellaneous}{memsize} and !/mem=/) { $_ .= " mem=$ramsize"; } if (my @l = detect_devices::getIDEBurners() and !/ide-scsi/) { $_ .= " " . join(" ", (map { "$_=ide-scsi" } @l), map { "$_->{device}=ide-floppy" } detect_devices::ide_zips()); } if (my $m = detect_devices::hasUltra66()) { $_ .= " $m" if !/ide.=/; } #- keep some given parameters #-TODO log::l("perImageAppend: $_"); $o->{bootloader}{perImageAppend} = $_; } #------------------------------------------------------------------------------ sub generateAutoInstFloppy($) { my ($o) = @_; } #------------------------------------------------------------------------------ sub hasNetwork { my ($o) = @_; $o->{intf} && $o->{netc}{NETWORKING} ne 'false' || $o->{modem}; } #------------------------------------------------------------------------------ sub upNetwork { my ($o, $pppAvoided) = @_; foreach (qw(resolv.conf protocols services)) { symlinkf("$o->{prefix}/etc/$_", "/etc/$_"); } modules::write_conf("$o->{prefix}/etc/conf.modules"); if ($o->{intf} && $o->{netc}{NETWORKING} ne 'false') { network::up_it($o->{prefix}, $o->{intf}); } elsif (!$pppAvoided && $o->{modem} && !$o->{modem}{isUp}) { eval { modules::load_multi(qw(serial ppp bsd_comp ppp_deflate)) }; run_program::rooted($o->{prefix}, "/etc/rc.d/init.d/syslog", "start"); run_program::rooted($o->{prefix}, "ifup", "ppp0"); $o->{modem}{isUp} = 1; } else { $::testing or return; } 1; } #------------------------------------------------------------------------------ sub downNetwork { my ($o, $pppOnly) = @_; modules::write_conf("$o->{prefix}/etc/conf.modules"); if (!$pppOnly && $o->{intf} && $o->{netc}{NETWORKING} ne 'false') { network::down_it($o->{prefix}, $o->{intf}); } elsif ($o->{modem} && $o->{modem}{isUp}) { run_program::rooted($o->{prefix}, "ifdown", "ppp0"); run_program::rooted($o->{prefix}, "/etc/rc.d/init.d/syslog", "stop"); eval { modules::unload($_) foreach qw(ppp serial) }; $o->{modem}{isUp} = 0; } else { $::testing or return; } 1; } #------------------------------------------------------------------------------ sub cleanIfFailedUpgrade($) { my ($o) = @_; #- if an upgrade has failed, there should be .mdkgisave files around. if ($o->{isUpgrade}) { foreach (@filesToSaveForUpgrade) { if (-e "$o->{prefix}/$_" && -e "$o->{prefix}/$_.mdkgisave") { rename "$o->{prefix}/$_", "$o->{prefix}/$_.mdkginew"; #- keep new files around in case ! rename "$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_"; } } } } #-###################################################################################### #- Wonderful perl :( #-###################################################################################### 1;