diff options
author | Mystery Man <unknown@mandriva.org> | 2001-10-08 11:57:18 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2001-10-08 11:57:18 +0000 |
commit | d2d128d01e5ca2d953a7d06e443df4714ac6d9cc (patch) | |
tree | 22da3bc47fddf82f9aca8544d007daf49ff75e41 /rescue/tree/etc | |
parent | 32f0790dec6eadc4b1cdd1c2ead2f84994d94467 (diff) | |
download | drakx-backup-do-not-use-OEM8_1.tar drakx-backup-do-not-use-OEM8_1.tar.gz drakx-backup-do-not-use-OEM8_1.tar.bz2 drakx-backup-do-not-use-OEM8_1.tar.xz drakx-backup-do-not-use-OEM8_1.zip |
This commit was manufactured by cvs2svn to create tag 'OEM8_1'.OEM8_1
Diffstat (limited to 'rescue/tree/etc')
-rwxr-xr-x | rescue/tree/etc/oem | 250 |
1 files changed, 199 insertions, 51 deletions
diff --git a/rescue/tree/etc/oem b/rescue/tree/etc/oem index 06944e21a..05f90a9a1 100755 --- a/rescue/tree/etc/oem +++ b/rescue/tree/etc/oem @@ -12,7 +12,7 @@ where [options] are: "; exit 1; } -my (%options, $yes, $hd, $cd); +my (%options, $yes, $hd, $hdp, $cd); #- avoid globing as it is not available in rescue ramdisk. foreach my $device (split ' ', `/bin/ls -d /proc/ide/hd*`) { @@ -40,15 +40,63 @@ eval { $cd ||= "scd" . $cdromNum++; } } + close F; }; --e "/dev/$hd" or die "unable to access hard disk"; +#- examine DAC960 device. +unless ($hd) { + local $_; + open F, "dmesg |"; + while (<F>) { + m|/dev/(rd/.*?): .*?,| and $hd ||= $1, last; + } + close F; + if ($hd) { + my ($c_id, $d_id) = $hd =~ m|rd/c(\d+)d(\d+)|; + -d "/dev/rd" or mkdir "/dev/rd"; + system "mknod", "/dev/$hd", "b", 48+$c_id, 8*$d_id; + foreach (1..7) { + system "mknod", "/dev/${hd}p$_", "b", 48+$c_id, 8*$d_id+$_; + } + $hdp = $hd . 'p'; + } +} +#- examine Compaq Smart Array device. +unless ($hd) { + foreach ('array/ida', 'cpqarray/ida', 'cciss/cciss') { + my $prefix = "/proc/driver/$_"; #- kernel 2.4 places it here + $prefix = "/proc/$_" if !-e "${prefix}0"; #- kernel 2.2 + + my ($name) = m|/(.*)|; + for (my $i = 0; -r ($f = "${prefix}$i"); $i++) { + local $_; + open F, $f; + while (<F>) { + if (m|^\s*($name/.*?):|) { + $hd ||= $1; + } + } + close F; + } + } + if ($hd) { + my ($type, $c_id, $d_id) = $hd =~ m,(ida|cciss)/c(\d+)d(\d+),; + -d "/dev/$type" or mkdir "/dev/$type"; + system "mknod", "/dev/$hd", "b", ($type eq 'ida' ? 72 : 104)+$c_id, 16*$d_id; + foreach (1..15) { + system "mknod", "/dev/${hd}p$_", "b", ($type eq 'ida' ? 72 : 104)+$c_id, 16*$d_id+$_; + } + $hdp = $hd . 'p'; + } +} +$hd && -e "/dev/$hd" or die "unable to access hard disk"; print "hd: $hd\ncd: $cd\n"; +$hdp ||= $hd; #- try to free any reference to hard disk which will be used (as in rescue mode it has already loaded #- existing partition in /mnt. open F, "/proc/mounts"; while (<F>) { - /$hd(\d*)\s+(\S+)/ and $already_mounted{$2} = "$hd$1"; + /$hdp(\d*)\s+(\S+)/ and $already_mounted{$2} = "$hdp$1"; } foreach (sort { $b cmp $a } keys %already_mounted) { print "umounting $already_mounted{$_} from $_\n"; @@ -121,11 +169,16 @@ while (<F>) { /(\d+)\s*sectors/ and $sectors = $1; /(\d+)\s*cylinders/ and $cylinders = $1; } +if ($heads == 1 && $cylinders == 1) { + $cylinders = $sectors / 255 / 63; + $heads = 255; + $sectors = 63; +} close F; for (1..2) { open F, "parted /dev/$hd -s print |"; while (<F>) { - /^Disk geometry [^:]*:\s*([\d\.]+)-([\d\.]+)/ and do { $hd_size = $2 - $1 }; + /^Disk geometry [^:]*:\s*([\d\.]+)-([\d\.]+)/ and do { $hd_size = $2 - $1 - 1 }; #/^Disk label type:\s*msdos/ and do { $hd_type = 'msdos' }; /^(\d+)\s+([\d\.]+)\s+([\d\.]+)\s+(primary|logical|extended)\s*(\S*)/ and do { #- this automatically drops extended partition here! @@ -246,49 +299,47 @@ close F or die "unable to partition the disk $hd"; #- we have to build swap and mount it. print "Setting swap\n"; -system "mkswap", "/dev/$hd$swap"; -system "swapon", "/dev/$hd$swap"; +system "mkswap", "/dev/$hdp$swap"; +system "swapon", "/dev/$hdp$swap"; #- we have -print "Formatting /dev/$hd$inst partition\n"; -system "mkfs.ext2", "/dev/$hd$inst"; -print "Formatting /dev/$hd$root partition\n"; -system "mkfs.ext2", "/dev/$hd$root"; +print "Formatting /dev/$hdp$inst partition\n"; +system "mkfs.ext2", "/dev/$hdp$inst"; +print "Formatting /dev/$hdp$root partition\n"; +system "mkfs.ext2", "/dev/$hdp$root"; if ($var) { - print "Formatting /dev/$hd$var partition\n"; - system "mkfs.ext2", "/dev/$hd$var"; + print "Formatting /dev/$hdp$var partition\n"; + system "mkfs.ext2", "/dev/$hdp$var"; } if ($home) { - print "Formatting /dev/$hd$home partition\n"; - system "mkfs.ext2", "/dev/$hd$home"; + print "Formatting /dev/$hdp$home partition\n"; + system "mkfs.ext2", "/dev/$hdp$home"; } print "Mounting partitions\n"; mkdir "/hd"; -system "mount", "-t", "ext2", "/dev/$hd$inst", "/hd"; +system "mount", "-t", "ext2", "/dev/$hdp$inst", "/hd"; mkdir "/mnt"; -system "mount", "-t", "ext2", "/dev/$hd$root", "/mnt"; +system "mount", "-t", "ext2", "/dev/$hdp$root", "/mnt"; if ($var) { mkdir "/mnt/var"; - system "mount", "-t", "ext2", "/dev/$hd$var", "/mnt/var"; + system "mount", "-t", "ext2", "/dev/$hdp$var", "/mnt/var"; } if ($home) { mkdir "/mnt/home"; - system "mount", "-t", "ext2", "/dev/$hd$home", "/mnt/home"; + system "mount", "-t", "ext2", "/dev/$hdp$home", "/mnt/home"; } print "Copying installation on hard drive\n"; -if (-e "/boot/vmlinuz" && -e "/boot/hd.rdz" || -e "/cdrom/boot/vmlinuz" && -e "/cdrom/boot/hd.rdz") { - system "cp", "-a", "/boot", "/cdrom/boot", "/hd"; +mkdir "/hd/boot"; +if (-e "/cdrom/oem/vmlinuz" && -e "/cdrom/oem/all.rdz") { + system "cp", "-a", "/cdrom/oem/vmlinuz", "/hd/boot/vmlinuz"; + system "cp", "-a", "/cdrom/oem/all.rdz", "/hd/boot/all.rdz"; +} elsif (-e "/cdrom/boot/vmlinuz" && -e "/cdrom/boot/hd.rdz") { + system "cp", "-a", "/cdrom/boot/vmlinuz", "/hd/boot/vmlinuz"; + system "cp", "-a", "/cdrom/boot/hd.rdz", "/hd/boot/all.rdz"; } else { - mkdir "/hd/boot"; - unless (-e "/tmp/hd/vmlinuz" && -e "/tmp/hd/hd.rdz") { - system "cp", "/cdrom/images/hd.img", "/hd/hd.img"; - mkdir "/tmp/hd"; - system "modprobe", "loop"; - system "mount", "/hd/hd.img", "/tmp/hd", "-o", "loop"; - } - system "cp", "-a", "/tmp/hd/vmlinuz", "/tmp/hd/hd.rdz", "/hd/boot"; + die "no installation stage1 found"; } mkdir "/hd/Mandrake"; @@ -300,6 +351,93 @@ if (open F, ">/hd/Mandrake/oem_patch.pl") { print "Setting OEM specific extension to DrakX\n"; if (exists $options{server}) { print F q{ + use install_any; + package install_any; + undef *setPackages; + *setPackages = sub { + my ($o) = @_; + + require pkgs; + if (!$o->{packages} || is_empty_hash_ref($o->{packages}{names})) { + $o->{packages} = pkgs::psUsingHdlists($o->{prefix}, $o->{method}); + + push @{$o->{default_packages}}, "nfs-utils-clients" if $o->{method} eq "nfs"; + push @{$o->{default_packages}}, "numlock" if $o->{miscellaneous}{numlock}; + push @{$o->{default_packages}}, "kernel-enterprise" if (availableRamMB() > 800) && (arch() !~ /ia64/); + push @{$o->{default_packages}}, "kernel22" if !$::oem && c::kernel_version() =~ /^\Q2.2/; + push @{$o->{default_packages}}, "kernel-smp" if detect_devices::hasSMP(); + push @{$o->{default_packages}}, "kernel-pcmcia-cs" if $o->{pcmcia}; + push @{$o->{default_packages}}, "raidtools" if !is_empty_array_ref($o->{all_hds}{raids}); + push @{$o->{default_packages}}, "lvm" if !is_empty_array_ref($o->{all_hds}{lvms}); + push @{$o->{default_packages}}, "usbd", "hotplug" if modules::get_alias("usb-interface"); + push @{$o->{default_packages}}, "reiserfsprogs" if grep { isThisFs("reiserfs", $_) } @{$o->{fstab}}; + push @{$o->{default_packages}}, "xfsprogs" if grep { isThisFs("xfs", $_) } @{$o->{fstab}}; + push @{$o->{default_packages}}, "jfsprogs" if grep { isThisFs("jfs", $_) } @{$o->{fstab}}; + push @{$o->{default_packages}}, "alsa", "alsa-utils" if modules::get_alias("sound-slot-0") =~ /^snd-card-/; + push @{$o->{default_packages}}, "imwheel" if $o->{mouse}{nbuttons} > 3; + + pkgs::getDeps($o->{prefix}, $o->{packages}); + pkgs::selectPackage($o->{packages}, + pkgs::packageByName($o->{packages}, 'basesystem') || die("missing basesystem package"), 1); + + #- must be done after selecting base packages (to save memory) + pkgs::getProvides($o->{packages}); + + #- must be done after getProvides + pkgs::read_rpmsrate($o->{packages}, getFile("Mandrake/base/rpmsrate")); + ($o->{compssUsers}, $o->{compssUsersSorted}) = pkgs::readCompssUsers($o->{meta_class}); + + if ($::auto_install && $o->{compssUsersChoice}{ALL}) { + $o->{compssUsersChoice}{$_} = 1 foreach map { @{$o->{compssUsers}{$_}{flags}} } @{$o->{compssUsersSorted}}; + } + if (!$o->{compssUsersChoice} && !$o->{isUpgrade}) { + #- by default, choose: + $o->{compssUsersChoice}{$_} = 1 foreach 'GNOME', 'KDE', 'CONFIG', 'X'; + $o->{compssUsersChoice}{$_} = 1 + foreach map { @{$o->{compssUsers}{$_}{flags}} } 'Workstation|Office Workstation', 'Workstation|Internet station'; + } + $o->{compssUsersChoice}{uc($_)} = 1 foreach grep { modules::get_that_type($_) } ('tv', 'scanner', 'photo', 'sound'); + $o->{compssUsersChoice}{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall(); + $o->{compssUsersChoice}{SYSTEM} = 1; + $o->{compssUsersChoice}{BURNER} = 1 if detect_devices::burners(); + $o->{compssUsersChoice}{DVD} = 1 if detect_devices::dvdroms(); + $o->{compssUsersChoice}{PCMCIA} = 1 if detect_devices::hasPCMCIA(); + $o->{compssUsersChoice}{HIGH_SECURITY} = 1 if $o->{security} > 3; + $o->{compssUsersChoice}{'3D'} = 1 if + detect_devices::matching_desc('Matrox.* G[245][05]0') || + detect_devices::matching_desc('Riva.*128') || + detect_devices::matching_desc('Rage X[CL]') || + detect_devices::matching_desc('Rage Mobility [PL]') || + detect_devices::matching_desc('3D Rage (?:LT|Pro)') || + detect_devices::matching_desc('Voodoo [35]') || + detect_devices::matching_desc('Voodoo Banshee') || + detect_devices::matching_desc('8281[05].* CGC') || + detect_devices::matching_desc('Rage 128') || + detect_devices::matching_desc('Radeon ') || + detect_devices::matching_desc('[nN]Vidia.*T[nN]T2') || #- TNT2 cards + detect_devices::matching_desc('[nN]Vidia.*NV[56]') || + detect_devices::matching_desc('[nN]Vidia.*Vanta') || + detect_devices::matching_desc('[nN]Vidia.*GeForce') || #- GeForce cards + detect_devices::matching_desc('[nN]Vidia.*NV1[15]') || + detect_devices::matching_desc('[nN]Vidia.*Quadro'); + + + foreach (map { substr($_, 0, 2) } lang::langs($o->{langs})) { + pkgs::packageByName($o->{packages}, "locales-$_") or next; + push @{$o->{default_packages}}, "locales-$_"; + $o->{compssUsersChoice}{qq(LOCALES"$_")} = 1; #- mainly for zh in case of zh_TW.Big5 + } + foreach (lang::langsLANGUAGE($o->{langs})) { + $o->{compssUsersChoice}{qq(LOCALES"$_")} = 1; + } + $o->{compssUsersChoice}{'CHARSET"' . lang::lang2charset($o->{lang}) . '"'} = 1; + } else { + #- this has to be done to make sure necessary files for urpmi are + #- present. + pkgs::psUpdateHdlistsDeps($o->{prefix}, $o->{method}); + } + }; + use install_steps; package install_steps; undef *choosePackages; @@ -393,8 +531,8 @@ if (defined $resize_fat_size) { print F "timeout 0\n\n"; print F "title oem\n"; } -print F "kernel (hd0,$instz)/boot/vmlinuz ramdisk_size=32000 automatic=method:disk,disk:$hd,partition:$hd$inst,directory:/ hd vga=788 fbeginner flang=$flang oem defcfg=/tmp/hdimage/Mandrake/oem_patch.pl\n"; -print F "initrd (hd0,$instz)/boot/hd.rdz\n"; +print F "kernel (hd0,$instz)/boot/vmlinuz ramdisk_size=32000 automatic=method:disk,disk:$hd,partition:$hdp$inst,directory:/ hd vga=788 fbeginner flang=$flang oem defcfg=/tmp/hdimage/Mandrake/oem_patch.pl\n"; +print F "initrd (hd0,$instz)/boot/all.rdz\n"; #- if a windows partition is available, add an entrie for it. if (defined $resize_fat_size) { print F "\ntitle windows\n"; @@ -403,6 +541,9 @@ if (defined $resize_fat_size) { print F "chainloader +1\n"; } close F; +open F, ">/hd/boot/grub/device.map"; +print F "(hd0) /dev/$hd\n"; +close F; open F, "| grub --device-map=/hd/boot/grub/device.map --batch"; print F "install (hd0,$instz)/boot/grub/stage1 d (hd0) (hd0,$instz)/boot/grub/stage2 p (hd0,$instz)/boot/grub/menu.lst\n"; print F "quit\n"; @@ -427,17 +568,17 @@ $ENV{DURING_INSTALL} = 1; $ENV{RPM_INSTALL_LANG} = "$flang:$lang"; $ENV{LD_LIBRARY_PATH} = "/usr/X11R6/lib"; $ENV{SECURE_LEVEL} = 2; -foreach (qw(/etc /etc/sysconfig /etc/rpm /var /var/lib /var/lib/rpm /proc)) { +foreach (qw(/etc /etc/sysconfig /etc/rpm /var /var/lib /var/lib/rpm /var/log /proc)) { mkdir "/mnt/$_"; } system "mount", "-t", "proc", "proc", "/mnt/proc"; open F, ">/mnt/etc/fstab"; -print F "/dev/$hd$root / ext2 defaults 1 1\n"; +print F "/dev/$hdp$root / ext2 defaults 1 1\n"; if ($var) { - print F "/dev/$hd$var /var ext2 defaults 1 2\n"; + print F "/dev/$hdp$var /var ext2 defaults 1 2\n"; } if ($home) { - print F "/dev/$hd$home /home ext2 defaults 1 2\n"; + print F "/dev/$hdp$home /home ext2 defaults 1 2\n"; } close F; open F, ">/mnt/etc/sysconfig/i18n"; @@ -448,10 +589,14 @@ close F; open F, ">/mnt/etc/rpm/macros"; print F "%_install_langs $flang:$lang\n"; close F; -system "rpm", "--root", "/mnt", "--initdb"; -#- hack for rpm bug, copy environment of rpm before an throw install from that. -#system "tar cvf - /lib/l* /usr/lib/librpm* /bin/rpm /usr/bin/rpm* /usr/lib/rpm/* | tar xvf - -C /mnt"; +#- hack for package psacct which has problem with its log file not touched. +if (${pkgs::packageByName($packages, 'psacct') || {}}{selected}) { + system "touch", "/mnt/var/log/psacct.log"; + system "touch", "/mnt/var/log/pacct"; +} + +system "rpm", "--root", "/mnt", "--initdb"; #- copy and install from each cd image. foreach my $medium (@media) { @@ -469,7 +614,7 @@ foreach my $medium (@media) { $pkg->{closure} && !$pkg->{selected} or next; my $file = "/cdrom/$medium->{rpmsdir}/" . rpm_filename($pkg); if (-e $file) { - print " copying $pkg->{name}.$_.rpm\n"; + print " copying " . rpm_filename($pkg) . "\n"; system "cp", "-a", $file, "/hd/$medium->{rpmsdir}"; delete $pkg->{closure}; } @@ -481,9 +626,6 @@ foreach my $medium (@media) { my $file = "/cdrom/$medium->{rpmsdir}/" . rpm_filename($pkg); if (-e $file) { system "rpm", "-ivh", "--root", "/mnt", "--nodeps", "--force", "--noscripts", $file; - #system "cp", $file, "/mnt"; - #system "chroot", "/mnt", "rpm", "--nodeps", "--force", "--noscripts", "-ivh", rpm_filename($pkg); - #system "rm", ("/mnt" . rpm_filename($pkg)); } } } else { @@ -518,7 +660,12 @@ if (-e "/cdrom/Mandrake/base/oem-message-graphic") { } system "umount", "/mnt/proc"; -system "umount", "-a", "-f", "-t", "noproc"; +$home and system "umount", "/mnt/home"; +$var and system "umount", "/mnt/var"; +system "umount", "/mnt"; +system "umount", "/hd"; +system "umount", "/cdrom"; + $cd and system "eject", "/dev/$cd"; print " @@ -574,9 +721,9 @@ sub select_packages { if (exists $options{server}) { foreach (qw(KDE ACCESSIBILITY PUBLISHING CUPS EDITORS TEXT_TOOLS COMMUNICATIONS TERMINALS NETWORKING_FILE_TRANSFER NETWORKING_OTHER - NETWORKING_FILE_TRANSFER_SERVER NETWORKING_FIREWALLING_SERVER + NETWORKING_FILE_TRANSFER_SERVER NETWORKING_FIREWALLING_SERVER NETWORKING_LDAP_SERVER NETWORKING_MAIL_SERVER NETWORKING_OTHER_SERVER - NETWORKING_REMOTE_ACCESS NETWORKING_REMOTE_ACCESS_SERVER NETWORKING_DNS + NETWORKING_REMOTE_ACCESS NETWORKING_REMOTE_ACCESS_SERVER NETWORKING_DNS NETWORKING_DNS_SERVER NETWORKING_FILE NETWORKING_FILE_SERVER NETWORKING_WWW NETWORKING_WWW_SERVER ARCHIVING DEVELOPMENT MONITORING FILE_TOOLS CONFIG BOOKS SYSTEM X)) { $o->{compssUsersChoice}{$_} = 1; @@ -603,21 +750,22 @@ sub select_packages { pkgs::setSelectedFromCompssList($o->{packages}, $o->{compssUsersChoice}, 4, 0); #- package that have to selected here as a bonus for oem install. - foreach (qw(cups cups-drivers drakprofile draksync numlock raidtools reiserfsprogs xfsprogs jfsprogs icewm-light + foreach (qw(cups cups-drivers drakprofile draksync numlock raidtools icewm-light Mesa Mesa-demos alsa alsa-utils Mesa-demos glibc vim-minimal kernel - )) { + ), exists $options{server} ? qw(kernel22 openldap-migration openldap-clients pam_ldap) : ()) { my $pkg = pkgs::packageByName($o->{packages}, $_); $pkg and pkgs::selectPackage($o->{packages}, $pkg); } #- special packages that are to be move to closure always ... foreach (qw(kernel-smp kernel-linus kernel-secure hackkernel-smp hackkernel-linus hackkernel-secure kernel-pcmcia-cs - xawtv kwintv xscreensaver-gl xmms-mesa - bzflag csmash gltron spacecup chromium tuxracer FlightGear armagetron - alsa imwheel nfs-utils-clients lvm usbd hotplug reiserfsprogs - sox aumix xawtv gatos kwintv sane-frontends gphoto gnome-toaster gcombust xcdroast apmd cdlabelgen - ), exists $options{server} ? qw(Aurora Aurora-Monitor-NewStyle-Categorizing-WsLib) : ()) { + xawtv kwintv xscreensaver-gl xmms-mesa openuniverse + csmash chromium tuxracer armagetron + alsa imwheel nfs-utils-clients lvm usbd hotplug reiserfsprogs xfsprogs jfsprogs + sox aumix xmms-arts xawtv gatos kwintv sane-frontends gphoto gnome-toaster gcombust xcdroast apmd cdlabelgen + ), exists $options{server} ? qw(Aurora Aurora-Monitor-NewStyle-Categorizing-WsLib + kernel-enterprise kernel22-secure) : ()) { my $pkg = pkgs::packageByName($o->{packages}, $_); if ($pkg) { pkgs::selectPackage($o->{packages}, $pkg); |