#!/usr/bin/perl use lib "../perl-install"; use common; use pkgs; use lang; @ARGV <= 1 or die "usage: make_live [live_location=/tmp/live_tree]\n"; my $kernel_version = do { my @l = glob_('/export/Mandrake/RPMS/kernel-2.6*'); @l >= 1 or die "can't find kernel"; @l <= 1 or die "too many kernels"; first(`rpm -qp --qf '%{name}' $l[0]` =~ /kernel-(.*)/); }; sub installPackages() { output_p("$::prefix/etc/rpm/macros", "%_install_langs all\n"); rename '/etc/rpm/macros', '/etc/rpm/macros.'; system('cp', "$::prefix/etc/rpm/macros", '/etc/rpm/macros'); mkdir_p("$::prefix/var/lib/rpm"); mkdir_p("$::prefix/root/drakx"); undef *install_any::setDefaultPackages; *install_any::setDefaultPackages = sub {}; undef *install_any::getFile; *install_any::getFile = sub { my ($f, $o_method) = @_; log::l("getFile $f:$o_method"); open(my $F, '/export/' . install_any::relGetFile($f)) or return; $F; }; undef *c::kernel_version; *c::kernel_version = sub { $kernel_version }; install_any::setPackages(my $o = $::o = { prefix => $::prefix, meta_class => 'desktop', default_packages => [ qw(XFree86-server XFree86-xfs XFree86-FBDev), qw(openssh-server), #- fred wants it qw(alsa-utils newt), #- newt qw(davfs nfs-utils samba-server sane-backends xsane xsane-gimp ntp), qw(acpi acpid), #- so that removing acpi=ht will work qw(mountloop), #- crypted folders qw(dnotify), #- notification of /etc changes qw(mandrake-doc-drakxtools-en mandrake-doc-drakxtools-fr mandrake-doc-drakxtools-es mandrake-doc-drakxtools-it), qw(synaptics), #- network conf: qw(wireless-tools pcmcia-cs), #- zeroconf: qw(zcip dhcpcd tmdns), #- cnx stuff: qw(dhcp-client ppp kdenetwork-kppp ppp-pppoatm ppp-pppoe pptp-linux pptp-adsl rp-pppoe), #- ISDN stuff: qw(isdn4net ibod isdn4k-utils), #- network file sharing: qw(nfs-utils-clients samba-client), #- network drivers and firmwares: qw(eagle-usb speedtouch speedtouch_mgmt unicorn), qw(cups cups-drivers foomatic-db gimpprint hpoj libnet-snmp mtools mtoolsfm nmap printer-filters printer-testpages printer-utils scli xojpanel xpp), #- printer stuff qw(ATI_GLX ATI_GLX-utils NVIDIA_GLX), qw(hcfpcimodem hsflinmodem ltmodem ipw2100), qw(nxclient), #- proprietary soft from powerpack qw(xinput), #- for some mice qw(perl-Term-Readline-Gnu binutils bash-completion), #- allow debugging move qw(openssh-askpass-gnome), #- openssh-askpass for mountloop doesn't allow to click on ok/cancel buttons qw(clanbomber freeciv-client freeciv-server crack-attack kdegames), #- more games qw(numlock shorewall clamav unison mozilla), qw(xawtv zapping), #- tv apps qw(scribus scribus-i18n-de scribus-i18n-fr), #- John Jablonski says it's so much useful ], }); my %compssUsersChoice = map { $_ => 1 } map { @{$_->{flags}} } values %{$o->{compssUsers}}; $compssUsersChoice{$_} = 1 foreach qw(SYSTEM DVD USB SOUND BURNER UTF8 DOCS TV 3D INSTALL PHOTO); $compssUsersChoice{qq(LOCALES"$_")} = 1 foreach lang::langsLANGUAGE({ all => 1 }); #- we don't want those foreach (qw(mdkonline quanta)) { my $pkg = pkgs::packageByName($o->{packages}, $_) or die "$_ not there anymore"; $pkg->set_rate(0); } pkgs::setSelectedFromCompssList($o->{packages}, \%compssUsersChoice, 4, 0); my @toInstall = pkgs::packagesToInstall($o->{packages}); local $ENV{DURING_INSTALL} = 1; $ENV{LD_LIBRARY_PATH} = "/lib:/usr/lib:/usr/X11R6/lib:/usr/lib/qt3/lib"; pkgs::install($::prefix, 0, \@toInstall, $o->{packages}); eval { fs::umount("$::prefix/proc") }; unlink "/etc/rpm/macros"; rename "/etc/rpm/macros.", "/etc/rpm/macros"; } sub config_X_proprietary_drivers() { unlink "$::prefix/usr/lib/libGL.so"; my %name_to_Driver = (NVIDIA_GLX => 'nvidia', ATI_GLX => 'fglrx'); my $lib = 'libGL.so.1'; symlinkf("/etc/X11/$lib", "$::prefix/usr/lib/$lib"); foreach (keys %name_to_Driver) { my ($full_name) = run_program::rooted_get_stdout($::prefix, 'rpm', '-ql', $_) =~ m!/usr/lib/(\Q$lib\E\..*)! or die ''; symlinkf($full_name, "$::prefix/usr/lib/$lib.$name_to_Driver{$_}"); } #- nvidia's libglx.so is hardwired to the tls version, change this system("cd $::prefix/usr/X11R6/lib/modules/extensions ; ln -sf libglx.so.* libglx.so"); #- remove the dirty hack done by NVIDIA_kernel-xxx proprietary package #- we do it by hand when needed substInFile { $_ = '' if $_ eq 'nvidia' } "$::prefix/etc/modules"; } $::prefix = `make get_dest_livetree`; print "Making live in $::prefix directory.\n"; eval { fs::umount("$::prefix/proc") }; eval { rm_rf($::prefix) }; output_p("$::prefix/etc/fstab", "none /proc proc defaults 0 0\n"); installPackages(); run_program::rooted($::prefix, 'ldconfig'); any::fix_broken_alternatives(); run_program::rooted($::prefix, 'fc-cache'); #- generate cache in all directories mentioned in config file run_program::rooted_or_die($::prefix, '/usr/lib/mozilla-1.6/mozilla-rebuild-databases.pl'); #- system # de-complexify, use the default on any arch eval { rm_rf("$::prefix$_") } foreach '/lib/i686', '/lib/tls', '/usr/lib/tls', '/usr/X11R6/lib/tls', '/usr/X11R6/lib/modules/extensions/tls', '/usr/X11R6/lib/modules/dri/tls'; eval { config_X_proprietary_drivers() }; substInFile { #- /lib is ro, for the moment we don't save, we'll see later if we may want to save (using /var/dev-state for example) s|.*lib/dev-state.*||; } "$::prefix/etc/devfsd.conf"; substInFile { #- don't use shadow passwords since pwconv overwrites /etc/shadow hence contents will be lost for usb key s|\s*shadow||; } "$::prefix/etc/pam.d/system-auth"; substInFile { #- remove this line which D-state mounting /home again #- we don't know what this line is for $_ = "# $_" if /Mounting other filesystems/; } "$::prefix/etc/init.d/netfs"; #- remove services we start ourselves from chkconfig system substInFile { s|chkconfig:|chkconfig-disabled:|; } "$::prefix/etc/rc.d/init.d/$_" foreach qw(xfs dm devfsd syslog); #- we're not using sysv init, we need to replace these unlink "$::prefix/sbin/$_" foreach qw(halt reboot); #- provide a way for speedtouch users of free version to escape if (!-e "$::prefix/usr/share/speedtouch/mgmt.o") { symlink '/etc/mgmt.o', "$::prefix/usr/share/speedtouch/mgmt.o"; } #- we don't want everyone to have the same ssh key :) system("rm -f $::prefix/etc/ssh/*key*"); #- XFree #- don't want the relative path, prefering the absolute path symlinkf('/var/lib/xkb', "$::prefix/etc/X11/xkb/compiled"); #- Xsession wants to start first-time unlink "$::prefix/usr/X11R6/bin/drakfw"; #- KDE unlink "$::prefix/usr/share/autostart/$_.desktop" foreach 'klipper', 'korgac', 'kalarmd.autostart'; update_gnomekderc("$::prefix/usr/share/config/kdesktoprc", ScreenSaver => (Lock => 'true')); #- remove "Login Manager" module from kcontrol, rpmdrake stuff unlink "$::prefix/usr/lib/menu/$_" foreach qw(kdebase-kdm rpmdrake); touch("$::prefix/etc/menu/enable_simplified"); substInFile { s/mandrake_doc-(en|fr)/mandrake_doc-move-$1/g; $_ = '' if m!/usr/sbin/drakbackup!; } "$::prefix/usr/lib/menu/simplified/mandrake_desk"; substInFile { s!/es/Starter.html/!/en/Starter.html/!; } "$::prefix/usr/share/mdk/mandrakegalaxy/mdkgalaxy-es.html"; substInFile { if (!/mimetypes=/) { chomp; $_ .= ' mimetypes="image/gif;image/jpeg;image/png;image/tiff;image/x-xbm;image/x-xpm;image/bmp;image/fits;image/pcx;image/pix;image/pnm;image/x-bmp"'; $_ .= ' kde_opt="InitialPreference=15"' . "\n"; } } "$::prefix/usr/lib/menu/gqview"; { local $ENV{LC_ALL} = 'en_US'; #- update-menus doesn't work when there is no locale (aka locale "C") local $ENV{HOME} = '/'; #- savekdemimetypes.pl needs this otherwise it's tmp file fails run_program::rooted($::prefix, 'update-menus', '-n'); } run_program::rooted($::prefix, 'nspluginscan'); #- must be run before kbuildsycoca for the ksycoca to be flash plugin aware $ENV{HELP_BROWSER} = "kfmclient openProfile webbrowsing"; $ENV{BROWSER} = "kfmclient openProfile webbrowsing"; $ENV{DESKTOP} = "kde"; foreach my $lang (lang::list_langs()) { local $ENV{LC_ALL} = lang::getLANGUAGE($lang); unlink "$::prefix/usr/share/services/ksycoca"; run_program::rooted($::prefix, 'kbuildsycoca', '--global'); rename("$::prefix/usr/share/services/ksycoca", "$::prefix/usr/share/services/ksycoca-$lang"); } symlinkf('/etc/X11/ksycoca', "$::prefix/usr/share/services/ksycoca"); cp_af("$::prefix/usr/share/applnk-mdk/System/Configuration/Hardware/krandrtray.desktop", "$::prefix/usr/share/autostart"); #- Mandrake substInFile { s|Mandrake Linux release (\S+) \(.*\)|Mandrake Move release $1 (Moyoto)|; } "$::prefix/etc/mandrake-release"; #- remove documentation link in mdkgalaxy foreach (glob("$::prefix/usr/share/mdk/mandrakegalaxy/mdkgalaxy-*.html")) { my $nb; substInFile { if (m!/Starter.html! ... m!^\s*$!) { $_ = ''; $nb++; } } $_; $nb % 4 == 0 or die "bad $_\n"; } rm_rf("$::prefix/usr/share/locale/en_ZA"); #- remove uncessary wizards, especially from appearing in MCC unlink "$::prefix/usr/sbin/$_" foreach qw(drakautoinst drakboot drakfloppy drakgw drakbackup drakedm drakfont drakperm draksec rpmdrake MandrakeUpdate rpmdrake-remove edit-urpm-sources.pl); unlink "$::prefix/usr/bin/$_" foreach qw(userdrake); #- selecting language must be done from drakx anyway unlink "$::prefix/usr/bin/localedrake"; #- fix openoffice autopilote feature foreach (glob("$::prefix/usr/lib/openoffice/share/template/*")) { symlink '../../english/wizard/bitmap', "$_/wizard/bitmap"; } # fix nxclient system("chmod a+x $::prefix/etc/profile.d/nx*"); id='n118' href='#n118'>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
package harddrake::data;
use strict;
use detect_devices;
use common;
use modules;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(version tree);
our ($version, $sbindir, $bindir) = ("10", "/usr/sbin", "/usr/bin");
my @devices = (detect_devices::probeall(), detect_devices::getSCSI());
foreach my $dev (@devices) {
# normalize device IDs for devices that came from mouse.pm:
next if !defined $dev->{Synaptics};
foreach my $field (qw(vendor id subvendor subid)) {
next if !defined $dev->{$field};
$dev->{$field} = hex($dev->{$field});
}
}
# Update me each time you handle one more devices class (aka configurator)
sub unknown() {
grep { $_->{media_type} !~ /BRIDGE|class\|Mouse|DISPLAY|Hub|MEMORY_RAM|MULTIMEDIA_(VIDEO|AUDIO|OTHER)|NETWORK|Printer|SERIAL_(USB|SMBUS)|STORAGE_(IDE|OTHER|RAID|SCSI)|SYSTEM_(OTHER|SDHCI)|tape|UPS/
&& !member($_->{driver}, qw(cpia_usb cyber2000fb forcedeth ibmcam megaraid mod_quickcam nvnet ohci1394 ov511 ov518_decomp scanner ultracam usbvideo usbvision))
&& $_->{driver} !~ /^ISDN|Mouse:USB|Removable:zip|class\|Mouse|sata|www.linmodems.org|kbd|mouse|sysrq|usbhid/
&& $_->{type} ne 'network'
&& $_->{description} !~ /Alcatel|ADSL Modem/;
} @devices;
}
my @alrd_dected;
sub f {
my @devs = grep { !member(pciusb_id($_), @alrd_dected) } grep { $_ } @_;
push @alrd_dected, map { pciusb_id($_) } @devs;
@devs;
}
# tree format ("CLASS_ID", "type", "type_icon", configurator, detect_sub)
# NEVER, NEVER alter CLASS_ID or you'll see harddrake2 service detect changes
# in hw configuration ... :-(
# FIXME: add translated items
sub is_removable { member($_[0], qw(FLOPPY ZIP DVDROM CDROM BURNER)) }
sub is_auto_configurable_media { !detect_devices::isKeyUsb($_[0]) }
sub set_removable_configurator {
my ($class, $device) = @_;
is_removable($class) ? "/usr/sbin/diskdrake --removable=$device->{device}" : undef;
}
my $modules_conf = modules::any_conf->read;
# Format is (HW class ID, l18n class name, icon, config tool , is_to_be_detected_on_boot)
our @tree =
(
{
class => "SATA_STORAGE",
string => N("SATA controllers"),
icon => "ide_hd.png",
configurator => "",
detector => sub { f(grep { $_->{driver} !~ /^pata/ } detect_devices::probe_category('disk/sata')),
f(grep { $_->{description} =~ /AHCI/ } @devices) },
checked_on_boot => 1,
},
{
class => "RAID_STORAGE",
string => N("RAID controllers"),
icon => "ide_hd.png",
configurator => "",
detector => sub { f(detect_devices::probe_category('disk/hardware_raid')),
f(grep { $_->{media_type} =~ /STORAGE_RAID/ } @devices) },
checked_on_boot => 1,
},
{
class => "ATA_STORAGE",
string => N("(E)IDE/ATA controllers"),
icon => "ide_hd.png",
configurator => "",
detector => sub { f(detect_devices::probe_category('disk/ide')),
f(grep { $_->{driver} =~ /^pata/ && $_->{media_type} =~ /IDE|STORAGE_SATA/ } @devices),
f(grep { $_->{media_type} =~ /STORAGE_(IDE|OTHER)/ } @devices) },
checked_on_boot => 1,
},
{
class => "CARD_READER",
string => N("Card readers"),
icon => "ide_hd.png",
configurator => "",
detector => sub { f(detect_devices::probe_category('disk/card_reader')) },
checked_on_boot => 1,
},
{
class => "FIREWIRE_CONTROLLER",
string => N("Firewire controllers"),
icon => "usb.png",
configurator => "",
detector => sub { f(grep { $_->{driver} =~ /firewire_ohci|ohci1394/ } @devices) },
checked_on_boot => 1,
},
{
class => "PCMCIA_CONTROLLER",
string => N("PCMCIA controllers"),
icon => "hw-pcmcia.png",
configurator => "",
detector => sub { f(detect_devices::pcmcia_controller_probe()) },
checked_on_boot => 1,
},
{
class => "SCSI_CONTROLLER",
string => N("SCSI controllers"),
icon => "scsi.png",
configurator => "",
detector => sub { f(detect_devices::probe_category('disk/scsi'), grep { $_->{media_type} =~ /STORAGE_SCSI/ } @devices) },
checked_on_boot => 1,
},
{
class => "USB_CONTROLLER",
string => N("USB controllers"),
icon => "usb.png",