diff options
Diffstat (limited to 'rescue')
38 files changed, 0 insertions, 2164 deletions
diff --git a/rescue/.cvsignore b/rescue/.cvsignore deleted file mode 100644 index c1a06f76b..000000000 --- a/rescue/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -rescue_stage2.bz2 -kernel_read_part diff --git a/rescue/Makefile b/rescue/Makefile deleted file mode 100644 index bbc0d7dda..000000000 --- a/rescue/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -ARCH := $(patsubst i%86,i386,$(shell uname -m)) -ARCH := $(patsubst sparc%,sparc,$(ARCH)) - - -ROOTDEST = /export - -all: rescue_stage2.bz2 - -install: rescue_stage2.bz2 - cp -f $< $(ROOTDEST)/Mandrake/base - -rescue_stage2.bz2: kernel_read_part list list.$(ARCH) drvinst guessmounts lsparts rescue-doc make_rescue_img - ./make_rescue_img - -clean: - rm -f rescue_stage2.bz2 kernel_read_part diff --git a/rescue/aliases b/rescue/aliases deleted file mode 100644 index eae42f0ce..000000000 --- a/rescue/aliases +++ /dev/null @@ -1,4 +0,0 @@ -/bin/zcat gzip -/bin/gunzip gzip -/bin/rpm /usr/bin/rpm-dynamic -/bin/vi vim-minimal diff --git a/rescue/devices.pl b/rescue/devices.pl deleted file mode 100644 index 985031fd0..000000000 --- a/rescue/devices.pl +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/perl - -@ARGV == 1 && chdir $ARGV[0] or die "usage: devices.pl <dir>\n"; - -if ($>) { $sudo = "sudo"; $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; } - -foreach (<DATA>) { - chomp; - my ($typ, $maj, $min, @l) = split; - foreach (@l) { - my @l2 = do { - if (my ($prefix, $ini, $end) = /(.*)(\d+)-(\d+)$/) { - map { "$prefix$_" } $ini .. $end; - } else { - $_; - } - }; - system("$sudo mknod $_ $typ $maj " . $min++) foreach @l2; - } -} - -__DATA__ -c 5 1 console -b 2 0 fd0-1 -c 0 0 initctl -c 1 2 kmem -b 7 0 loop0-15 -c 1 1 mem -c 1 3 null -c 1 4 port -b 1 1 ram -b 1 0 ram0-19 -b 1 0 ramdisk -c 1 8 random -b 11 0 scd0-7 -c 0 0 stderr -c 0 0 stdin -c 0 0 stdout -c 5 0 tty -c 4 0 tty0-9 -c 4 64 ttyS0-3 -c 1 9 urandom -c 1 5 zero -b 3 0 hda hda1-16 -b 3 64 hdb hdb1-16 -b 22 0 hdc hdc1-16 -b 22 64 hdd hdd1-16 -b 33 0 hde hde1-16 -b 33 64 hdf hdf1-16 -b 34 0 hdg hdg1-16 -b 34 64 hdh hdh1-16 -b 8 0 sda sda1-15 sdb sdb1-15 sdc sdc1-15 sdd sdd1-15 sde sde1-15 sdf sdf1-15 sdg sdg1-15 sdh sdh1-15 -c 10 144 nvram diff --git a/rescue/dirs b/rescue/dirs deleted file mode 100644 index cb5d6a250..000000000 --- a/rescue/dirs +++ /dev/null @@ -1,8 +0,0 @@ -/mnt/cdrom -/mnt/disk -/mnt/floppy -/lib -/tmp -/modules -/proc -/dev diff --git a/rescue/drvinst b/rescue/drvinst deleted file mode 100755 index 1e3899f4b..000000000 --- a/rescue/drvinst +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/perl - -# -# Guillaume Cottenceau (gc@mandrakesoft.com) -# -# Copyright 2000 MandrakeSoft -# -# This software may be freely redistributed under the terms of the GNU -# public license. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - -local $_ = join '', @ARGV; - -"@ARGV" =~ /-h/ and die "usage: drivers_install [drivertype1 drivertype2..]\n"; - - -sub pci_probe { - my @l; - foreach (`/usr/bin/lspcidrake`) { - push @l, do { - if (/^(\S+)\s*: (.+) \[([^\]]+)/) { - { driver => $1, description => $2, type => $3 }; - } elsif (/^(\S+)\s*: (.+)/) { - { driver => $1, description => $2, type => 'NOT_DEFINED' }; - } else { - next; - } - }; - } - @l; -} - -sub install_module($$) { - my ($driver, $descr) = @_; - print "Installing driver $driver (for \"$descr\")\n"; - system("/sbin/modprobe", $driver) and print "\tfailed\n"; - my $already_usb if 0; - if (!$already_usb && $driver =~ /usb/) { - $already_usb = 1; - print "Installing driver usbkdb\n"; - system('/sbin/modprobe', 'usbkbd') and print "\tfailed\n"; - print "Installing driver keybdev\n"; - system('/sbin/modprobe', 'keybdev') and print "\tfailed\n"; - } -} - - -#- start -foreach $card (pci_probe()) { - $card->{type} eq "DISPLAY_VGA" and next; - $card->{driver} eq "unknown" and next; - $card->{driver} =~ "Card:" and next; - - if (!@ARGV || grep { $card->{type} =~ /$_/i } @ARGV) { - install_module($card->{driver}, $card->{description}); - } -} - - - -#------------------------------------------------- -#- $Log$ -#- Revision 1.5 2001/09/27 16:00:05 gc -#- don't install usb keyboard drivers more than once -#- -#- Revision 1.4 2001/09/27 15:57:55 gc -#- try to fix usb keyboards -#- -#- Revision 1.3 2001/03/29 11:33:28 gc -#- test for "Card:" and not install, some videoboards are not reported as DISPLAY_VGA :-( -#- -#- Revision 1.2 2001/02/12 18:42:17 uid553 -#- pixelization -#- -#- Revision 1.1 2001/02/12 14:31:10 uid535 -#- - add lspci, lspcidrake, vim-minimal -#- - better /etc/issue -#- - better PS1 -#- - write embryonic tool (installation of detected drivers according to pci cards) -#- diff --git a/rescue/guessmounts b/rescue/guessmounts deleted file mode 100755 index 18514bce3..000000000 --- a/rescue/guessmounts +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/perl -# -# Guillaume Cottenceau (gc@mandrakesoft.com) -# -# Copyright 2001 MandrakeSoft -# -# This software may be freely redistributed under the terms of the GNU -# public license. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - - -sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } -sub chomp_ { my @l = map { my $l = $_; chomp $l; $l } @_; wantarray ? @l : $l[0] } - - -my @mounts = cat_('/proc/mounts'); -grep { (split)[1] =~ m|^/mnt$| } @mounts and print("/mnt is already mounted (according to /proc/mounts)\n"), exit 0; - - -system('drvinst'); #- class2text seems broken, I can't detect easily only modules for SCSI storage :-( - -print "\nPlease wait, trying to find your root device...\n"; - -my $target = '/mnt'; --d $target || mkdir($target) or die "couldn't create $target\n"; - - -my (undef, undef, @parts) = cat_('/proc/partitions'); - -my @fstab; -my $root; - -M: foreach (@parts) { - my $dev = (split)[3] or next; - $dev = "/dev/$dev"; - - for my $fs ('ext3', 'ext2', 'reiserfs', 'xfs', 'jfs') { - my $where = $target; - if (!system("mount -t $fs $dev $where 2>/dev/null")) { - if (-r "$where/etc/fstab" && -r "$where/etc/mandrake-release") { - print "=> found a Mandrake root partition on $dev\n=> type $fs, version `", - chomp_(cat_ "$where/etc/mandrake-release"), - "'\n"; - @fstab = cat_("$where/etc/fstab"); - $root = $dev; - last M; - } else { - system('umount', $where) and die "error unmounting $where\n"; - } - last; - } - } -} - -if ($root) { - print "\nMounting other partitions from fstab on $target...\n"; - foreach (@fstab) { - next if /^\s*#/; - my ($dev, $where, $type, $opts) = split; - next if (!$type || $dev eq 'none' || $opts =~ /noauto/ || - $type =~ /^(supermount|swap|nfs)$/ || - $where eq '/' || - $where =~ m,proc|cdrom|floppy|/mnt/zip, - ); - $opts = join(',', grep { !/codepage=/ && !/iocharset/ } split(',', $opts)); #- vfat opts, we don't have the modules in rescue - $where = "$target$where"; - -d $where || mkdir($where) or die "couldn't create $where\n"; - print "\t$dev on $where type $type\n"; - system("mount -t $type $dev $where -o $opts"); - } - print "\nYour system is ready on $target.\n\n"; -} else { - die "Could not find your root device :-(.\n"; -} - - - -#------------------------------------------------- -#- $Log$ -#- Revision 1.5 2001/11/05 17:03:54 gc -#- honours hash in /etc/fstab to disable lines -#- -#- Revision 1.4 2001/10/24 22:34:01 gc -#- - add a GUI to the rescue -#- - provide guessmounts with better efficiency and output, go to console, and reboot -#- - provide install_bootloader which runs lilo from /mnt if it seems safe -#- - add lsparts to rescue, which prints partitions with detected types -#- -#- Revision 1.3 2001/09/07 18:22:54 gc -#- ext3, xfs, jfs -#- -#- Revision 1.2 2001/06/10 22:41:21 prigaux -#- pixelization (tested!) -#- -#- Revision 1.1 2001/06/10 21:08:33 gc -#- - add 'guessmounts' that mimics RH's detecting of partitions when rescue starts -#- -#- diff --git a/rescue/install_bootloader b/rescue/install_bootloader deleted file mode 100755 index 8bbd6886c..000000000 --- a/rescue/install_bootloader +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/perl -# -# Guillaume Cottenceau (gc@mandrakesoft.com) -# -# Copyright 2001 MandrakeSoft -# -# This software may be freely redistributed under the terms of the GNU -# public license. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - - -sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } -sub chomp_ { my @l = map { my $l = $_; chomp $l; $l } @_; wantarray ? @l : $l[0] } - -system('guessmounts') and die; - -#- this is dangerous, try to take care -my @mounts = cat_('/proc/mounts'); -grep { (split)[1] =~ m|^/mnt$| } @mounts or die "Your root device isn't mounted on /mnt (according to /proc/mounts)\n"; --x '/mnt/sbin/lilo' or die "/mnt/sbin/lilo isn't executable, exiting.\n"; --r '/mnt/etc/lilo.conf' or die "/mnt/etc/lilo.conf isn't readable, exiting.\n"; -cat_('/mnt/etc/mandrake-release') =~ /Mandrake/ or die "/mnt/etc/mandrake-release doesn't contain 'Mandrake', exiting.\n"; - -print "About to re-install Boot Loader of following Mandrake distro:\n\t", - chomp_(cat_ "/mnt/etc/mandrake-release"), - "\n=> ok? <press Enter to continue, 'n' and Enter to cancel> "; -<STDIN> =~ /^n/i and exit 0; - -exec '/mnt/sbin/lilo', '-r', '/mnt'; - -die "error: couldn't exec /mnt/sbin/lilo.\n"; - - -#------------------------------------------------- -#- $Log$ -#- Revision 1.1 2001/10/24 22:34:01 gc -#- - add a GUI to the rescue -#- - provide guessmounts with better efficiency and output, go to console, and reboot -#- - provide install_bootloader which runs lilo from /mnt if it seems safe -#- - add lsparts to rescue, which prints partitions with detected types -#- -#- -#- diff --git a/rescue/kernel_read_part.c b/rescue/kernel_read_part.c deleted file mode 100644 index 279dfe787..000000000 --- a/rescue/kernel_read_part.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <stdio.h> -#include <sys/mount.h> -#include <fcntl.h> - -void die(char *msg) -{ - perror(msg); - exit(1); -} - -void kernel_read(char *dev) -{ - int fd; - if ((fd = open(dev, O_RDONLY)) == -1) die("can't open device"); - ioctl(fd, BLKRRPART, 0); - close(fd); -} - -int main(int argc, char **argv) -{ - if (argc != 2) { - fprintf(stderr, "usage: kernel_read_part <hard drive device>\n"); - exit(1); - } - kernel_read(argv[1]); -} diff --git a/rescue/list b/rescue/list deleted file mode 100644 index 056b0dd00..000000000 --- a/rescue/list +++ /dev/null @@ -1,137 +0,0 @@ -/bin/bash -/bin/cat -/bin/chmod -/bin/chown -/bin/cp -/bin/date -/bin/dd -/bin/df -/bin/dmesg -/bin/false -/bin/grep -/bin/gzip -/usr/bin/bzip2 -/usr/bin/bunzip2 -/usr/bin/bzcat -/usr/bin/packdrake -/usr/bin/parsehdlist -/bin/hostname -/bin/kill -/bin/ln -/bin/loadkeys -/usr/bin/du -/usr/lib/kbd -/bin/ls -/bin/mkdir -/bin/mknod -/bin/mount -/bin/mount -/bin/mv -/bin/ping -/bin/ps -/bin/pwd -/bin/rm -/bin/rmdir -/bin/setserial -/sbin/lsmod -/bin/cpio -/usr/bin/diff -/bin/sh -/bin/sleep -/bin/sync -/bin/touch -/bin/tar -/bin/true -/bin/umount -/etc/inputrc -/etc/termcap -/LIB/libnss_files-* -/LIB/libnss_files.so.2 -/sbin/debugfs -/sbin/e2fsck -/sbin/fdisk -/sbin/fsck.ext2 -/sbin/fsck.ext3 -/sbin/halt -/sbin/ifconfig -/sbin/init -/sbin/insmod -/sbin/ldconfig -/sbin/mingetty -/sbin/mkdosfs -/sbin/mkfs.ext2 -/sbin/reboot -/sbin/rmmod -/sbin/shutdown -/usr/bin/strace -/sbin/route -/sbin/mkswap -/sbin/swapoff -/sbin/swapon -/sbin/tune2fs -/sbin/update -/usr/bin/cmp -/usr/bin/cut -/usr/bin/eject -/usr/bin/fdformat -/usr/bin/file -/usr/bin/find -/usr/bin/ftp -/usr/bin/head -/usr/bin/hexedit -/usr/bin/less -/usr/bin/less.bin -/usr/bin/loadkeys -/usr/bin/reset -/usr/bin/split -/usr/bin/tail -/usr/bin/tee -/usr/bin/telnet -/usr/bin/tset -/usr/sbin/chroot -/usr/sbin/parted -/usr/share/magic -/usr/share/terminfo/l/linux -/var/run/utmp -/sbin/killall5 -/usr/bin/perl -/usr/bin/perl5 -/usr/bin/perlPERL_VERSION -/bin/sort -/usr/bin/md5sum -/etc/protocols -/etc/services -/bin/rpm -/sbin/mkraid -/usr/LIB/rpm/rpmrc -/usr/LIB/rpm/macros -/usr/LIB/rpm/rpmpopt-4.0.4 -/usr/bin/rpm2cpio -/usr/bin/rpmdb -/usr/LIB/rpm/rpmd -/usr/bin/rpme -/usr/LIB/rpm/rpme -/usr/bin/rpmi -/usr/LIB/rpm/rpmi -/usr/bin/rpmu -/usr/LIB/rpm/rpmu -/usr/bin/rpmquery -/usr/LIB/rpm/rpmq -/usr/bin/rpmverify -/usr/LIB/rpm/rpmv -/usr/lib/perl5/PERL_VERSION/strict.pm -/usr/lib/perl5/PERL_VERSION/vars.pm -/usr/lib/perl5/PERL_VERSION/warnings/register.pm -/usr/lib/perl5/PERL_VERSION/warnings.pm -/usr/lib/perl5/PERL_VERSION/Carp.pm -/usr/lib/perl5/PERL_VERSION/Exporter.pm -/usr/bin/lspci -/usr/share/pci.ids -/usr/bin/lspcidrake -/usr/share/ldetect-lst/pcitable -/usr/share/ldetect-lst/usbtable -/bin/vim-minimal -/LIB/libnss_dns.so.2 -/LIB/libresolv.so.2 -/bin/mt -/sbin/stinit diff --git a/rescue/list.alpha b/rescue/list.alpha deleted file mode 100644 index 4ab451f01..000000000 --- a/rescue/list.alpha +++ /dev/null @@ -1,2 +0,0 @@ -/usr/lib/perl5/site_perl/PERL_VERSION/alpha-linux/packdrake.pm -/sbin/sfdisk diff --git a/rescue/list.i386 b/rescue/list.i386 deleted file mode 100644 index 696468a3c..000000000 --- a/rescue/list.i386 +++ /dev/null @@ -1,13 +0,0 @@ -/usr/sbin/ext2resize -/sbin/rescuept -/usr/sbin/grub -/usr/sbin/grub-install -/sbin/reiserfsck -/sbin/fsck.jfs -/sbin/fsck.xfs -/sbin/xfs_repair -/sbin/sfdisk -/boot/grub/stage[12] -/usr/lib/perl5/PERL_VERSION/i386-linux/CORE/libperl.so -/usr/lib/perl5/vendor_perl/PERL_VERSION/i386-linux/packdrake.pm -/usr/lib/extipl/aldebaran.bin diff --git a/rescue/list.ia64 b/rescue/list.ia64 deleted file mode 100644 index 9388a86c3..000000000 --- a/rescue/list.ia64 +++ /dev/null @@ -1,9 +0,0 @@ -/usr/sbin/ext2resize -/sbin/mkreiserfs -/sbin/reiserfsck -/sbin/fsck.xfs -/sbin/xfs_repair -/sbin/sfdisk -/usr/sbin/efibootmgr -/usr/lib/perl5/PERL_VERSION/ia64-linux/CORE/libperl.so -/usr/lib/perl5/site_perl/PERL_VERSION/ia64-linux/packdrake.pm diff --git a/rescue/list.ppc b/rescue/list.ppc deleted file mode 100644 index 1c835ef51..000000000 --- a/rescue/list.ppc +++ /dev/null @@ -1,10 +0,0 @@ -/usr/lib/perl5/PERL_VERSION/ppc-linux/CORE/libperl.so -/usr/lib/perl5/site_perl/PERL_VERSION/ppc-linux/packdrake.pm -/sbin/pdisk -/sbin/ybin -/sbin/mkofboot -/usr/local/lib/yaboot/ofboot -/usr/local/lib/yaboot/yaboot -/usr/local/sbin/ofpath -/sbin/nvsetenv -/usr/bin/hformat diff --git a/rescue/list.sparc b/rescue/list.sparc deleted file mode 100644 index 4d5c9118e..000000000 --- a/rescue/list.sparc +++ /dev/null @@ -1,3 +0,0 @@ -/sbin/silo -/sbin/sfdisk -/usr/lib/perl5/site_perl/PERL_VERSION/sparc-linux/packdrake.pm diff --git a/rescue/list.x86_64 b/rescue/list.x86_64 deleted file mode 100644 index 7616d49f5..000000000 --- a/rescue/list.x86_64 +++ /dev/null @@ -1,6 +0,0 @@ -/usr/sbin/ext2resize -/sbin/mkreiserfs -/sbin/reiserfsck -/sbin/sfdisk -/usr/lib/perl5/PERL_VERSION/x86_64-linux/CORE/libperl.so -/usr/lib/perl5/vendor_perl/PERL_VERSION/x86_64-linux/packdrake.pm diff --git a/rescue/lsparts b/rescue/lsparts deleted file mode 100755 index 2346ee134..000000000 --- a/rescue/lsparts +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/perl -# -# Main author Pascal Rigaux (pixel@mandrakesoft.com) -# Put together by Guillaume Cottenceau (gc@mandrakesoft.com) -# -# Copyright 1999,2000,2001 MandrakeSoft -# -# This software may be freely redistributed under the terms of the GNU -# public license. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# This code is extracted from DrakX, the Mandrake Linux graphical installer. -# http://www.mandrakelinux.com/drakx/ -# Open development rulz, find CVS here: -# http://www.mandrakelinux.com/cgi-bin/cvsweb.cgi/gi/ -# -# Detects partition types using signatures -# - -sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } - -sub arch() { - my $t = `uname -m`; - chomp $t; - $t; -} - -# from Perl Cookbook / Pleac -# http://pleac.sourceforge.net/pleac_perl/numbers.html#AEN121 -sub commify { - my $text = reverse $_[0]; - $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; - return scalar reverse $text; -} - -my @partitions_signatures = ( - [ 0x8e, 0, "HM\1\0" ], - [ 0x83, 0x438, "\x53\xEF" ], - [ 0x183, 0x10034, "ReIsErFs" ], - [ 0x183, 0x10034, "ReIsEr2Fs" ], - [ 0x283, 0, 'XFSB', 0x200, 'XAGF', 0x400, 'XAGI' ], - [ 0x383, 0x8000, 'JFS1' ], - [ 0x82, 4086, "SWAP-SPACE" ], - [ 0x82, 4086, "SWAPSPACE2" ], - [ 0x7, 0x1FE, "\x55\xAA", 0x3, "NTFS" ], - [ 0xc, 0x1FE, "\x55\xAA", 0x52, "FAT32" ], -arch() !~ /^sparc/ ? ( - [ 0x6, 0x1FE, "\x55\xAA", 0x36, "FAT" ], -) : (), -); - -sub typeFromMagic { - my $f = shift; - local *F; sysopen F, $f, 0 or return; - - my $tmp; - M: foreach (@partitions_signatures) { - my ($name, @l) = @$_; - while (@l) { - my ($offset, $signature) = splice(@l, 0, 2); - sysseek(F, $offset, 0) or next M; - sysread(F, $tmp, length $signature); - $tmp eq $signature or next M; - } - return $name; - } - return -1; -} - -my %type2name = ( - 0x1 => 'DOS 12-bit FAT', - 0x4 => 'DOS 16-bit FAT (up to 32M)', - 0x5 => 'DOS 3.3+ Extended Partition', - 0x6 => 'DOS FAT16', - 0x7 => 'NTFS (or HPFS)', - 0xb => 'Win98 FAT32', - 0xc => 'Win98 FAT32, LBA-mapped', - 0xe => 'Win95: DOS 16-bit FAT, LBA-mapped', - 0xf => 'Win95: Extended partition, LBA-mapped', - 0x82 => 'Linux Swap', - 0x83 => 'Ext2', - 0x183 => 'ReiserFS', - 0x283 => 'XFS', - 0x383 => 'JFS', - 0x85 => 'Linux extended partition', - 0x87 => 'NTFS volume set', - 0x8e => 'Linux LVM', - -1 => 'unknown' - ); - - -my $params = join '', @ARGV; - -$params =~ /-h/ and die "usage: lsparts [-v]\n"; -$params =~ /-v/ and $verbose = 1; - - -my (undef, undef, @parts) = cat_('/proc/partitions'); - -P: foreach (@parts) { - my (undef, undef, $blocks, $dev) = split or next; - my %skip_conditions = ( - "Skipping <$dev> because too little blocks ($blocks)" => ($blocks <= 1), - "Skipping <$dev> because doesn't end with a number (e.g. seems to not be a partition)" => ($dev !~ /\d$/), - ); - $skip_conditions{$_} and ($verbose and print(STDERR $_, "\n")), next P foreach keys %skip_conditions; - my $type = typeFromMagic("/dev/$dev"); - $type and printf "$dev: %6s Mbytes, type <0x%0x> (%s)\n", commify($blocks >> 10), $type, $type2name{$type}; -} - - -#------------------------------------------------- -#- $Log$ -#- Revision 1.2 2002/01/10 21:28:15 gc -#- better looking output of type of partition (%x => %0x) -#- -#- Revision 1.1 2001/10/24 22:34:01 gc -#- - add a GUI to the rescue -#- - provide guessmounts with better efficiency and output, go to console, and reboot -#- - provide install_bootloader which runs lilo from /mnt if it seems safe -#- - add lsparts to rescue, which prints partitions with detected types -#- -# diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img deleted file mode 100755 index dc6a7cb3a..000000000 --- a/rescue/make_rescue_img +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/perl - -use MDK::Common; -use lib "../perl-install"; -use keyboard; - -$lib = (arch() =~ /x86_64/ ? "lib64" : "lib"); -$tmp = "/tmp/rescue_tmp"; -$mnt = "/tmp/rescue_stage2_img"; -$mke2fs = "/sbin/mke2fs -q -m 0 -F -s 1"; -$rescue = "rescue_stage2"; - -if ($>) { - $sudo = "sudo"; - $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; -} - -BEGIN { undef *_; } -sub __ { print @_, "\n"; system(@_); } -sub _ { __ @_; $? and die; } - -sub install_raw { - s|^/|| foreach @_; - _ "tar c -C / @_ | tar x -C $tmp" if @_; -} -sub install_lib { - s|^/|| foreach @_; - _ "tar c -C / --dereference @_ | tar x -C $tmp" if @_; -} - -sub install_l { - my @l = @_; - - @l = uniq(map { chomp_($_) } @l); - push @l, - `ldd @l 2>/dev/null | grep "=>" | perl -pe 's/.*=> //; s/ .*//; s,^/lib/.*?/,/lib/,'`; - - @l = uniq(map { chomp_($_) } @l); - install_raw(grep { !/lib.*\.so/ } @l); - install_lib(grep { /lib.*\.so/ } @l); -} - -sub installown($$) { - my ($own, $dir) = @_; - return if -e "$tmp$dir$own"; - mkdir_p("$tmp$dir"); - _ "cp -a $own $tmp$dir"; -} - -_ "$sudo rm -rf $tmp" if -e $tmp; -_ "mkdir $tmp"; -_ 'find . -name "*~" | xargs rm -f'; -foreach (cat_("dirs")) { - chomp; - mkdir_p("$tmp$_"); -} -_ "cp -a tree/* $tmp"; -_ "find $tmp -name 'CVS*' | xargs rm -rf"; -_ "perl devices.pl $tmp/dev"; - -install_raw(keyboard::loadkeys_files()); -my %keytable_conflicts; -my @less_important_keytables = qw(am_old am_phonetic no-dvorak fr_CH-latin1); -foreach (keyboard::loadkeys_files()) { - my ($dir, $fname) = (dirname($_), basename($_)); - my ($name) = $fname =~ /(.*)\.kmap\.gz/ or next; - next if member($name, @less_important_keytables); - if (my ($short) = $name =~ m|(.+?)[\W_]|) { - $keytable_conflicts{$short} and warn("conflict between $keytable_conflicts{$short} and $name for short name $short (choosing the first)\n"), next; - $keytable_conflicts{$short} = $name; - # create the short name based on the long one - symlinkf($fname, "$tmp$dir/$short.kmap.gz"); - } -} - -my $perl_version = join ".", unpack "C3", $^V; -@files = map { chomp; s/PERL_VERSION/$perl_version/g; s|/LIB/|/$lib/|g; $_ } (cat_("list"), cat_(`../tools/specific_arch list`)); -@files = `ls -d @files`; -$? == 0 or exit 1; - -install_l(@files); - -foreach (cat_("aliases")) { - chomp; my ($f, $dest) = split; - symlink $dest, "$tmp$f"; -} - --e "../kernel/all.modules" or die "use ./update_kernel in gi/kernel first\n"; - -chomp($main = `cat ../kernel/all.kernels/.main`); - -_ "cp ../kernel/all.modules/modules.cz-$main $tmp/modules/modules.cz"; -_ "cp ../kernel/all.modules/$main/modules.dep $tmp/modules"; - -installown("drvinst", "/usr/bin"); -installown("guessmounts", "/usr/bin"); -installown("install_bootloader", "/usr/bin"); -if (arch() =~ /^i.86/) { - installown("restore_ms_boot", "/usr/bin"); -} -installown("lsparts", "/usr/bin"); -installown("rescue-doc", "/usr/bin"); -_ "cd ../mdk-stage1 && make rescue-gui"; -installown("../mdk-stage1/rescue-gui", "/usr/bin"); - -#- note that on biarch systems, we may need to have both /lib and /lib64 -__ "strip $tmp/{lib,$lib,bin,sbin}/* $tmp/usr/{bin,sbin}/* 2>/dev/null"; - -exit 0 if $ARGV[0]; - -if (arch() =~ /ppc/) { - #- xfs module on PPC is 4MB! - need room to unpack it - $size = `du -s $tmp | cut -f1` + 4096; #- add 4MB of free space -} else { - $size = `du -s $tmp | cut -f1` + 2048; #- add 2MB of free space -} - -mkdir_p($mnt); -__ "$sudo umount $rescue 2>/dev/null"; - -_ "dd if=/dev/zero of=$rescue bs=1k count=$size"; -_ "$mke2fs $rescue"; -_ "$sudo mount -t ext2 $rescue $mnt -o loop"; -_ "rmdir $mnt/lost+found"; - -_ "$sudo chown -R root.root $tmp"; -_ "$sudo cp -a $tmp/* $mnt"; -_ "$sudo rm -rf $tmp"; - -_ "$sudo umount $rescue"; -_ "rmdir $mnt"; - -_ "bzip2 -f -9 $rescue"; diff --git a/rescue/rescue-doc b/rescue/rescue-doc deleted file mode 100755 index 1791966cb..000000000 --- a/rescue/rescue-doc +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/perl - -sub output { my $f = shift; local *F; open F, ">$f" or die "output in file $f failed: $!\n"; print F foreach @_; } - -output('/tmp/rescue-doc-contents', q( - Information regarding problems not directly addressed - by this rescue. - - -Are you certain "rescue mode" is the best tool for your specific -problem? - -The rescue system on this CD is a very basic text-based -environment for rescuing systems that no longer boot. You will -not find an easy-to-use graphical environment in this rescue -system, nor the Mandrake detection/configuration libraries. - - -The vast majority of problems that can affect a Linux system are -much easier to repair on a running system than by booting into -"rescue mode". In fact, there are very few problems which aren't -easier to resolve in the comfortable environment of a fully -installed Mandrake Linux system than in this spartan "rescue -system" shell. Some of the most common problems include: - -- bad or missing X (video display) configuration -- adding/removing/reconfiguring hardware -- repairing problems caused by installing third-party software - with the "--force" and "--nodeps" options - -The general rule of thumb is: "If you can boot into the Linux -system without using rescue mode or this CD, there is no real -reason to use the rescue CD". - - -However, if you can no longer boot into the system, the rescue -system is the right tool. Some common examples include: - -- If you previously changed some parameters in the /etc/fstab and - the system will no longer boot, fix the offending line while in - rescue mode, then try to boot normally into your system. - -- If the problem cannot be completely resolved in rescue mode - (for example, if you need to reconfigure the video display), - just modify what's necessary to boot into a running system, - then complete the fix from there. - -In case you have found a new problem which should be handled by -"rescue mode" but currently isn't, please report it to -<gc@mandrakesoft.com>. - -For more information on troubleshooting a Mandrake Linux system, -please consult the official manuals, the documentation on -MandrakeLinux.com, MandrakeUser.org, troubleshooting articles on -MandrakeForum.com, or the MandrakeExpert.com support forum. - -<press 'q' (qwerty keyboard) to continue> -)); - -exec 'less /tmp/rescue-doc-contents'; - diff --git a/rescue/restore_ms_boot b/rescue/restore_ms_boot deleted file mode 100755 index 0d674af99..000000000 --- a/rescue/restore_ms_boot +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/perl -# -# Guillaume Cottenceau (gc@mandrakesoft.com) -# -# Copyright 2002 MandrakeSoft -# -# This software may be freely redistributed under the terms of the GNU -# public license. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - -sub arch() { - my $t = `uname -m`; - chomp $t; - $t; -} -sub if_($@) { - my $b = shift; - $b or return (); - wantarray || @_ <= 1 or die("if_ called in scalar context with more than one argument " . join(":", caller())); - wantarray ? @_ : $_[0]; -} -sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } -sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 } - -@known_boot_loaders = qw(lilo grub yaboot); - -# keep this in sync with DrakX -@MBR_signatures = ( - [ 'empty', 0, "\0\0\0\0" ], - [ 'grub', 0x6, "GRUB" ], - [ 'grub', 0, "\xEBG", 0x17d, "stage1 \0" ], - [ 'grub', 0, "\xEBH", 0x17e, "stage1 \0" ], - [ 'grub', 0, "\xEBH", 0x18a, "stage1 \0" ], - [ 'grub', 0, "\xEBH", 0x181, "GRUB \0" ], - [ 'lilo', 0x2, "LILO" ], - [ 'lilo', 0x6, "LILO" ], -if_(arch() =~ /ppc/, - map { [ 'yaboot', 0, "PM", 0x200 * $_ + 0x10, "bootstrap\0" ] } 0 .. 61 -), -); - -sub typeFromMagic { - my $f = shift; - local *F; sysopen F, $f, 0 or return; - - my $tmp; - M: foreach (@MBR_signatures) { - my ($name, @l) = @$_; - while (@l) { - my ($offset, $signature) = splice(@l, 0, 2); - sysseek(F, $offset, 0) or next M; - sysread(F, $tmp, length $signature); - $tmp eq $signature or next M; - } - return $name; - } - return 0; -} - - -my (undef, undef, @parts) = cat_('/proc/partitions'); - -my @possibilities; - -P: foreach (@parts) { - my (undef, undef, $blocks, $dev) = split or next; - next if $blocks <= 1; - my $type = typeFromMagic("/dev/$dev"); - $type && member($type, @known_boot_loaders) and push @possibilities, [ $dev, $type ]; -} - -my $choice; - -if (!@possibilities) { - print "No known Linux bootloader has been found, nothing to do.\n"; -} elsif (@possibilities == 1) { - print "I've found a Linux bootloader only on </dev/$possibilities[0]->[0]>.\n\n"; - $choice = $possibilities[0]; -} else { - print "I've found the following Linux bootloaders:\n"; - my $i; - print "\t", ++$i, ": <$_->[1]> \ton <$_->[0]>\n" foreach @possibilities; - print "\n"; - print "Which disk/partition do you want to overwrite with the Windows bootloader?\n"; - print "\t<enter the number or press 'n' and Enter to cancel> "; - <STDIN> !~ /^(\d+)$/i && $1 >= 1 and $choice = $possibilities[$1-1]; -} - -if ($choice) { - print "I'm going to overwrite bootloader on </dev/$choice->[0]> with -Windows bootloader. - -Ok? <press Enter to continue, 'n' and Enter to cancel> "; - <STDIN> =~ /^n/i and exit 0; - - system("/bin/dd if=/usr/lib/extipl/aldebaran.bin of=/dev/$choice->[0]\n") and print "\tFailed!\n"; -} - -#------------------------------------------------- -#- $Log$ -#- Revision 1.1 2002/02/27 13:31:30 gc -#- add "restore Windows Boot Loader" to rescue -#- -#- diff --git a/rescue/tree/bin/insmod b/rescue/tree/bin/insmod deleted file mode 100755 index 717dc39e1..000000000 --- a/rescue/tree/bin/insmod +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -echo "Use modprobe instead" -echo "Or even better use autoprobe" diff --git a/rescue/tree/bin/login b/rescue/tree/bin/login deleted file mode 100755 index 4b2816926..000000000 --- a/rescue/tree/bin/login +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec /bin/bash --login diff --git a/rescue/tree/boot/grub/menu.lst b/rescue/tree/boot/grub/menu.lst deleted file mode 100644 index 1af0c85e3..000000000 --- a/rescue/tree/boot/grub/menu.lst +++ /dev/null @@ -1,5 +0,0 @@ -timeout 0 - -title oem -kernel (hd0,0)/boot/vmlinuz ramdisk_size=32000 hd vga=788 fbeginner oem -initrd (hd0,0)/boot/hd.rdz diff --git a/rescue/tree/etc/fstab b/rescue/tree/etc/fstab deleted file mode 100644 index fbafb7801..000000000 --- a/rescue/tree/etc/fstab +++ /dev/null @@ -1,4 +0,0 @@ -/dev/ram3 / ext2 defaults 1 1 -/dev/fd0 /mnt/floppy auto defaults,noauto 0 0 -none /proc proc defaults,noauto,ro 0 0 -/dev/cdrom /mnt/cdrom auto defaults,noauto 0 0 diff --git a/rescue/tree/etc/group b/rescue/tree/etc/group deleted file mode 100644 index 5ba713c83..000000000 --- a/rescue/tree/etc/group +++ /dev/null @@ -1 +0,0 @@ -root::0:root diff --git a/rescue/tree/etc/host.conf b/rescue/tree/etc/host.conf deleted file mode 100644 index 1a8c1e151..000000000 --- a/rescue/tree/etc/host.conf +++ /dev/null @@ -1,2 +0,0 @@ -order hosts,bind -multi on diff --git a/rescue/tree/etc/hosts b/rescue/tree/etc/hosts deleted file mode 100644 index a9bbdee7f..000000000 --- a/rescue/tree/etc/hosts +++ /dev/null @@ -1 +0,0 @@ -127.0.0.1 mandrake-rescue diff --git a/rescue/tree/etc/inittab b/rescue/tree/etc/inittab deleted file mode 100644 index 0348c66f4..000000000 --- a/rescue/tree/etc/inittab +++ /dev/null @@ -1,14 +0,0 @@ -#Inittab for Mandrake Rescue Disk -#Author: Daouda Lo <daouda@mandrakesoft.com> -id:3:initdefault: - -si::sysinit:/etc/rc.sysinit -re:6:wait:/etc/rc.reboot -ca:12345:ctrlaltdel:/sbin/fakeshutdown - -1:12345:respawn:/bin/bash --login -2:23:respawn:/sbin/mingetty tty2 -3:23:respawn:/sbin/mingetty tty3 -4:23:respawn:/sbin/mingetty tty4 -5:23:respawn:/sbin/mingetty tty5 -6:23:respawn:/sbin/mingetty tty6 diff --git a/rescue/tree/etc/issue b/rescue/tree/etc/issue deleted file mode 100644 index a38b2f1a3..000000000 --- a/rescue/tree/etc/issue +++ /dev/null @@ -1,27 +0,0 @@ -[40m[40m -[2J[0;0H -[0;1;30;44m [40m [44m [40m -[1;44m [40m [44m [2C[47m [5C [1C [3C [1C [2C [1C [2C [40m -[1;30;44m [40m [47m [40m [47m [40m [44m [2C[47m [7C [3C [2C [1C [2C [2C [40m -[1;30;44m [40m [47m [40m [47m [40m [44m [2C[47m [7C [3C [1C [1C [2C [3C [40m -[1;30;44m [40m [43m [40m [44m [2C[47m [7C [3C [1C [1C [2C [2C [40m -[1;30;44m [40m [0;30;43m`----'[40m [1;44m [2C[47m [1C [1C [3C [2C [2C [2C [40m -[1;30;44m [40m [47m [37m [30m [40m [44m [40m -[1;30;44m [40m [47m [40m [44m [40m[2C[1;37;40m[0m -[1;30;44m [40m [47m [40m [44m [40m[2[1;37;4[0m -[1;30;44m [40m [47m [40m [30;44m [40m[2C[1;37;40m[0m -[1;30;44m [40m [47m [40m [2C[1;37;40m[0m -[1;30;44m [40m [47m [40m [2C[1;37;40mMandrake Linux Rescue Disk[0m -[1;30;44m [43m [30;47m [43m [40m [2C[1;37;40m[0m -[1;30;44m [43m [47m [43m [40m [2C -[1;30;44m [43m [47m [43m [40m[2C -[1;30;44m [43m [40m [47m [40m [43m [40m[2C -[0m[255D - -Mandrake Linux release 8.2 (Cooker) - -Use [1;33;40mloadkeys[0m to change your keyboard layout (eg: loadkeys fr) -Use [1;33;40mmodprobe[0m to load modules (eg: modprobe snd-card-fm801) -Use [1;33;40mdrvinst[0m to install drivers according to detected devices -Use [1;33;40mlsparts[0m to list your partitions with types - diff --git a/rescue/tree/etc/oem b/rescue/tree/etc/oem deleted file mode 100755 index f6eef0722..000000000 --- a/rescue/tree/etc/oem +++ /dev/null @@ -1,991 +0,0 @@ -#!/usr/bin/perl - -if (shift(@ARGV) ne '-f') { - print "Call it with option -f, but don't fear loosing all your data, this command is dangerous!"; - print " -usage: /etc/oem -f [options] -where [options] are: - server : allow server installalation - boot_entries=entry1,...,entryN : set boot entries to use, - the first one is the default one - no<option> : disable options <option> -"; - exit 1; -} -my (%options, $yes, $hd, $hdp, $cd, $fs); - -#- avoid globing as it is not available in rescue ramdisk. -foreach my $device (split ' ', `/bin/ls -d /proc/ide/hd*`) { - open F, "$device/media" or next; - foreach (<F>) { - /disk/ and do { $hd ||= $device; $hd =~ s,/proc/ide/,,; }; - /cdrom/ and do { $cd ||= $device; $cd =~ s,/proc/ide/,,; }; - } - close F; -} -#- examine available SCSI devices (avoid SCSI floppies like LS-120 or ZIP disk or generic floppies). -eval { - system "/usr/bin/drvinst"; #- load scsi drivers else it wont do anything. - - my ($driveNum, $cdromNum) = (0, 0); - open F, "/proc/scsi/scsi" or die "no scsi available"; - local $_ = <F>; /^Attached devices:/ or die "to attached devices found"; - while ($_ = <F>) { - my ($id) = /^Host:.*?Id: (\d+)/ or die "no host found"; - $_ = <F>; my ($vendor, $model) = /^\s*Vendor:\s*(.*?)\s+Model:\s*(.*?)\s+Rev:/ or die "no vendor nor model found"; - $_ = <F>; my ($type) = /^\s*Type:\s*(.*)/; - if ($type =~ /Direct-Access/ && $model !~ /ZIP\s+\d+|LS-?120|144MB|[Ff]loppy/) { - $hd ||= "sd" . chr($driveNum++ + ord('a')); - } elsif ($type =~ /CD-ROM/) { - $cd ||= "scd" . $cdromNum++; - } - } - close F; -}; -#- examine DAC960 device. -#- there is a problem as there is no more than 7 partitions available, this means no /home and no /var. -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>) { - /$hdp(\d*)\s+(\S+)/ and $already_mounted{$2} = "$hdp$1"; -} -foreach (sort { $b cmp $a } keys %already_mounted) { - print "umounting $already_mounted{$_} from $_\n"; - system "umount", $_; -} - -#- find a cdrom (like) image, normally a true cdrom but if nfs install is running, use it instead. -mkdir "/cdrom"; -open F, "/proc/cmdline"; -while (<F>) { - /automatic=method:nfs,.*server:([^\s,]*),.*directory:([^\s,]*)/ - and system "mount", "-r", "-t", "nfs", "$1:$2", "/cdrom", "-o", "nolock"; -} -close F; -unless (-e "/cdrom/VERSION") { - -e "/dev/$cd" or die "unable to access local cdrom"; - system "mount", "-r", "-t", "iso9660", "/dev/$cd", "/cdrom"; -} - -#- detect language used and default options. -my ($lang, $flang, $charset); -open F, "/cdrom/VERSION" or die "no installation cdrom found on $cd"; -while (<F>) { - /[\s-]fr/ and $options{lang} = 'fr'; - /\[lang[=:]([^]]*)\]/ and $options{lang} = $1; - /[\[\-]server[\]\-]/ and $options{server} = ''; - /\[boot_entries[=:]([^]]*)\]/ and $options{boot_entries} = $1; - /\[ext2\]/ and $options{fs} = "ext2"; - /\[ext3\]/ and $options{fs} = "ext3"; -} -close F; -foreach (@ARGV) { /^([^=:]*)[=:]?(.*)/ and $options{$1} = $2; /^no([^=:]*)/ and delete $options{$1} } - -#- default language fall to english ? -foreach ($options{lang} || 'en') { - /fr/ and ($lang, $flang, $charset) = ('fr', 'fr_FR', 'iso-8859-15'); - /en/ and ($lang, $flang, $charset) = ('en', 'en_US', 'iso-8859-1'); - /de/ and ($lang, $flang, $charset) = ('de', 'de_DE', 'iso-8859-15'); - /it/ and ($lang, $flang, $charset) = ('it', 'it_IT', 'iso-8859-15'); - /es/ and ($lang, $flang, $charset) = ('es', 'es_ES', 'iso-8859-15'); -} -foreach (keys %options) { - print "Using option [$_" . ($options{$_} && "=$options{$_}") . "]\n"; -} - -#- filesystem to use. -$fs ||= $options{fs} || "ext3"; -$fs eq "ext3" and system "modprobe", "ext3"; -print "Using filesystem of type $fs\n"; - -#- check for already existing partition table, if none are found -#- create 3 partitions (one for install, one for swap and one for root). -#- if only a fat partition is found, resize it do include the above partition. -#- other combination are really dangerous and are not supported, ask -#- the user that all data on the disk will be erased and go on. -my ($heads, $sectors, $cylinders, $hd_size, @hd_parts); -sub correct_start_end { - my ($rstart, $end, $keep_start) = @_; - my ($cylinder_size, $c_start, $c_end) = ($sectors*$heads*512/1024/1024, undef, undef); - if (abs($cylinder_size*$cylinders-$hd_size)/$hd_size < 0.01) { - $c_start = $$rstart+($keep_start ? 0 : $cylinder_size/$heads); - $c_end = $cylinder_size*int(1/2+$end/$cylinder_size); - $c_end > $hd_size and $c_end = $hd_size; - $$rstart = $c_end; - } else { - $c_start = $$rstart; - $c_end = $end; - $c_end > $hd_size and $c_end = $hd_size; - $$rstart = $c_end+5; #- fall back to use a problable safe method. - } - $c_start >= $c_end and die "no space left for partitionning\n"; - ($c_start, $c_end); -} -open F, "fdisk -l /dev/$hd |"; -while (<F>) { - /(\d+)\s*heads/ and $heads = $1; - /(\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 - 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! - push @hd_parts, { minor => $1, start => $2, end => $3, type => $4, fstype => $5 }; - }; - } - close F; - $hd_size and last; - print "Unable to detect partition on disk, trying with new label\n"; - do { - print " - -I'm going to install the OEM version on your hard drive -[1;31;40m!!ALL DATA WILL BE LOST!![0m - -Type \`\`yes'' and [enter] to go on\n" - } while (($yes = <STDIN>) !~ /^\s*yes\s*$/i); - system "parted", "/dev/$hd", "mklabel", "msdos"; -} -my ($min_size, $def_size, $trigger_size, $inst_size, $swap_size) = (2100, 2700, 4000, 200, 128); -$hd_size > $min_size or die "hard disk is too small to contain oem install (${hd_size}MB found, need $min_size at least)"; - -my ($fat_pos, $resize_fat_size, $root_size); -if (@hd_parts == 1 && $hd_parts[$fat_pos = 0]{fstype} eq 'FAT' || - @hd_parts == 2 && $hd_parts[0]{type} eq 'primary' && $hd_parts[$fat_pos = 1]{fstype} eq 'FAT' || - @hd_parts == 3 && $hd_parts[0]{type} eq 'primary' && $hd_parts[1]{type} eq 'primary' && $hd_parts[$fat_pos = 2]{fstype} eq 'FAT' || - @hd_parts == 2 && $hd_parts[0]{type} eq 'extended' && $hd_parts[$fat_pos = 1]{fstype} eq 'FAT' || - @hd_parts == 3 && $hd_parts[0]{type} eq 'extended' && $hd_parts[1]{type} eq 'primary' && $hd_parts[$fat_pos = 5]{fstype} eq 'FAT') { - if ($hd_size - $hd_parts[$fat_pos]{end} > $min_size) { - #- check first if there are some available space left on the disk. - #- so we are using it, root_size is fixed to match hard disk size. - $resize_fat_size = 0; - $root_size = $hd_size - $hd_parts[$fat_pos]{end} - $inst_size - $swap_size; - $root_size > $trigger_size and $root_size = $def_size; - } elsif ($hd_size > 2*$min_size) { - #- resize this fat partition. - $resize_fat_size = 0.5 * $hd_size; - $root_size = $hd_size - $resize_fat_size - $inst_size - $swap_size; - $root_size > $trigger_size and $root_size = $def_size; - } -} -unless ($root_size) { - #- there have not been defined above, so remove everything and start from - #- a blank partition. - $resize_fat_size = undef; - $root_size = $hd_size - $resize_fat_size - $inst_size - $swap_size; - $root_size > $trigger_size and $root_size = $def_size; -} - -#- launch parted to edit partition table, start at minor. -#- point define where we start. -my $minor = defined $resize_fat_size && $hd_parts[0]{type} eq 'extended' ? 6 : 5; -my $point = 0.0; - -if (defined $resize_fat_size) { - do { - print " - -[1;31;40m!!An existing Windows partition has been found and will be kept. -Additional Linux partitions will be created!![0m - -Type \`\`yes'' and [enter] to go on\n" - } while (($yes = <STDIN>) !~ /^\s*yes\s*$/i); - #- keep the current partition table, and try to resize the fat partition - #- if the size is not 0. - #- KEEP IN MIND there is only one partition defined. - open F, "| parted -s /dev/$hd"; - if ($resize_fat_size) { - $point = $hd_parts[$fat_pos]{start}; - printf F "resize %d %s %s\n", $hd_parts[$fat_pos]{minor}, correct_start_end(\$point, $point+$resize_fat_size, 'keepstart'); - } else { - $point = $hd_parts[$fat_pos]{end}; - } - $point+=9; #- keep blank space between partitions if parted cannot handle partition table correctly. -} else { - unless (defined $yes) { - do { - print " - -I'm going to install the OEM version on your hard drive -[1;31;40m!!ALL DATA WILL BE LOST!![0m - -Type \`\`yes'' and [enter] to go on\n" - } while (($yes = <STDIN>) !~ /^\s*yes\s*$/i); - } - #- build a new disk label here. - open F, "| parted -s /dev/$hd"; - print F "mklabel msdos\n"; -} - -#- at this point, the partition are created. -my ($instz, $inst, $swap, $root, $var, $home) = ($minor-1, $minor, $minor+1, $minor+2, undef, undef); - -#- all linux partition are stored inside an extended partition, this is easier to manipulate after. -if ($minor == 5) { - print F "mkpart extended $point $hd_size\n"; -} else { - $hd_parts[0]{type} eq 'extended' or die "first partition assumed to be extended"; - $point = $hd_parts[0]{start}; - print F "resize $hd_parts[0]{minor} $point $hd_size\n"; -} -printf F "mkpart logical ext2 %s %s\n", correct_start_end(\$point, $point+$inst_size); -printf F "mkpart logical linux-swap %s %s\n", correct_start_end(\$point, $point+$swap_size); -printf F "mkpart logical %s %s %s\n", $fs, correct_start_end(\$point, $point+$root_size); -if (exists $options{server} && $hd !~ /^rd\//) { - my $var_size = ($hd_size - $point) / 2; - if ($var_size > 1500) { - $var = $root+1; - printf F "mkpart logical %s %s %s\n", $fs, correct_start_end(\$point, $point+$var_size); - } -} -if ($hd_size - $point > 100 && $hd !~ /^rd\//) { - $home = ($var || $root) + 1; - printf F "mkpart logical %s %s %s\n", $fs, correct_start_end(\$point, $hd_size); -} -print F "quit\n"; -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/$hdp$swap"; -system "swapon", "/dev/$hdp$swap"; - -#- we have to format using right fs. -print "Formatting /dev/$hdp$inst partition\n"; -mkfs("ext2", "/dev/$hdp$inst"); -print "Formatting /dev/$hdp$root partition\n"; -mkfs($fs, "/dev/$hdp$root"); -if ($var) { - print "Formatting /dev/$hdp$var partition\n"; - mkfs($fs, "/dev/$hdp$var"); -} -if ($home) { - print "Formatting /dev/$hdp$home partition\n"; - mkfs($fs, "/dev/$hdp$home"); -} - -print "Mounting partitions\n"; -mkdir "/hd"; -system "mount", "-t", "ext2", "/dev/$hdp$inst", "/hd"; -mkdir "/mnt"; -system "mount", "-t", $fs, "/dev/$hdp$root", "/mnt"; -if ($var) { - mkdir "/mnt/var"; - system "mount", "-t", $fs, "/dev/$hdp$var", "/mnt/var"; -} -if ($home) { - mkdir "/mnt/home"; - system "mount", "-t", $fs, "/dev/$hdp$home", "/mnt/home"; -} - -print "Copying installation on hard drive\n"; -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"; -} elsif (-e "/cdrom/images/hd.img") { - mkdir "/tmp/hd"; - system "modprobe", "loop"; - system "modprobe", "vfat"; - system "mount", "-t", "vfat", "/cdrom/images/hd.img", "/tmp/hd", "-o", "loop"; - system "cp", "-a", "/tmp/hd/vmlinuz", "/hd/boot/vmlinuz"; - system "cp", "-a", "/tmp/hd/hd.rdz", "/hd/boot/all.rdz"; - system "umount", "/tmp/hd"; -} else { - die "no installation stage1 found"; -} - -mkdir "/hd/Mandrake"; -mkdir "/hd/Mandrake/RPMS"; -system "cp", "-a", "/cdrom/VERSION", "/hd"; -system "cp", "-a", "/cdrom/Mandrake/base", "/cdrom/Mandrake/mdkinst", "/hd/Mandrake"; - -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_steps; - package install_steps; - undef *choosePackages; - *choosePackages = sub { - my ($o, $packages, $compssUsers, $first_time) = @_; - - #- 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); - - #- avoid destroying user selection of packages but only - #- for expert, as they may have done individual selection before. - install_any::unselectMostPackages($o); - - #- use specific OEM packages selection, go to level 5 - #- and disable some extension. - $o->{compssUsersChoice}{$_} = 0 foreach 'GNOME'; - $o->{compssUsersChoice}{$_} = 0 - foreach map { @{$o->{compssUsers}{$_}{flags}} } 'Workstation|Office Workstation', 'Workstation|Internet station'; - $o->{compssListLevel} = 5; - pkgs::setSelectedFromCompssList($packages, $o->{compssUsersChoice}, $o->{compssListLevel}, $availableCorrected); - - $availableCorrected; - }; - }; - } else { - print F q{ - use install_steps; - package install_steps; - undef *choosePackages; - *choosePackages = sub { - my ($o, $packages, $compssUsers, $first_time) = @_; - - #- 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); - - #- avoid destroying user selection of packages but only - #- for expert, as they may have done individual selection before. - install_any::unselectMostPackages($o); - - #- use specific OEM packages selection, go to level 4. - #- and select at least GAMES group, everything else has - #- already be selected during master preparation. - $o->{compssListLevel} = 4; - $o->{compssUsersChoice}{GAMES} = 1; - pkgs::setSelectedFromCompssList($packages, $o->{compssUsersChoice}, $o->{compssListLevel}, $availableCorrected); - - $availableCorrected; - }; - }; - } - if ($options{boot_entries}) { - print "Setting OEM specific extension for boot entries\n"; - print F q{ - my $sorted_entries = q(} . $options{boot_entries} . q{); #- insert boot_entries options here as string q(...). - my $old_setupBootloaderBefore = \&setupBootloaderBefore; - undef *setupBootloaderBefore; - *setupBootloaderBefore = sub { - $old_setupBootloaderBefore->(@_); - my @entries = split ',', $sorted_entries; - my @result_entries; - foreach my $p (@entries) { - foreach (@{$_[0]{bootloader}{entries}}) { - $_->{label} eq $p and push @result_entries, $_; - } - } - if (@result_entries) { - $_[0]{bootloader}{entries} = \@result_entries; - $_[0]{bootloader}{default} = $result_entries[0]{label}; #- first image is default. - } - }; - }; - } - close F; -} - -print "Setting bootloader\n"; -mkdir "/hd/boot/grub"; -foreach (1..2) { - -e "/hd/boot/grub/stage$_" or system "cp", "-a", "/boot/grub/stage$_", "/hd/boot/grub"; -} -open F, ">/hd/boot/grub/menu.lst"; -if (defined $resize_fat_size) { - print F "timeout 5\n"; - print F "color black/cyan yellow/cyan\n\n"; - print F "title linux\n"; -} else { - 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:$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"; - printf F "rootnoverify (hd0,%s)\n", $hd_parts[$fat_pos]{minor}-1; - print F "makeactive\n"; - 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"; -close F or die "error while executing grub"; - -my $packages = select_packages("/cdrom", $lang); - -my @media; -open F, "/cdrom/Mandrake/base/hdlists"; -foreach (<F>) { - chomp; - s/\s*#.*$//; - /^\s*$/ and next; - m/^\s*(hdlist\S*\.cz2?)\s+(\S+)\s*(.*)$/ or die "invalid hdlist description \"$_\" in hdlists file"; - - push @media, { hdlist => $1, rpmsdir => $2, descr => $3 }; -} -close F; - -#- initialize installation. -$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 /var/log /proc)) { - mkdir "/mnt/$_"; -} -system "mount", "-t", "proc", "proc", "/mnt/proc"; -open F, ">/mnt/etc/fstab"; -print F "/dev/$hdp$root / $fs defaults 1 1\n"; -if ($var) { - print F "/dev/$hdp$var /var $fs defaults 1 2\n"; -} -if ($home) { - print F "/dev/$hdp$home /home $fs defaults 1 2\n"; -} -close F; -open F, ">/mnt/etc/sysconfig/i18n"; -print F "LANG=$lang\n"; -print F "LANGUAGE=$flang:$lang\n"; -print F "LC_MESSAGES=$flang\n"; -close F; -open F, ">/mnt/etc/rpm/macros"; -print F "%_install_langs $flang:$lang\n"; -close F; - -#- 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"; - -#- keep in mind all the rpm files available (according to hdlists). -my (%files, %rpms); - -require packdrake; -foreach my $medium (@media) { - my $packer = new packdrake("/cdrom/Mandrake/base/$medium->{hdlist}"); - foreach (@{$packer->{files}}) { - $packer->{data}{$_}[0] eq 'f' or next; - my ($fullname, $file) = /([^:]*):(.*)/ ? ($1, "$2.rpm") : ($_, "$_.rpm"); - $files{$fullname} = $file; - $rpms{$file} = $medium->{rpmsdir}; - } -} - -#- copy and install from each cd image. -foreach my $medium (@media) { - while ($cd && ! -d "/cdrom/$medium->{rpmsdir}") { - system "unmount", "/dev/$cd"; - system "eject", "/dev/$cd"; - print "Please insert the cdrom labeled \"$medium->{descr}\"\n and press [enter] when done\n"; - $yes = <STDIN>; - system "mount", "-r", "-t", "iso9660", "/dev/$cd", "/cdrom"; - } - - print "Copying packages from medium labeled \"$medium->{descr}\" to hard disk\n"; - system "mkdir", "-p", "/hd/$medium->{rpmsdir}"; - foreach my $pkg (@{$packages->{depslist}}) { - $files{rpm_fullname($pkg)} or next; - $pkg->{closure} && !$pkg->{selected} or next; - my $file = "/cdrom/$medium->{rpmsdir}/" . $files{rpm_fullname($pkg)}; - if (-e $file) { - print " copying " . rpm_fullname($pkg) . "\n"; - system "cp", "-a", $file, "/hd/$medium->{rpmsdir}"; - delete $pkg->{closure}; - } - } - - print "Installing packages from medium labeled \"$medium->{descr}\"\n"; - if (my $pkg = pkgs::packageByName($packages, 'glibc')) { #- HACK FOR GLIBC - $files{rpm_fullname($pkg)} or die "no glibc package found"; - if (delete $pkg->{selected}) { - my $file = "/cdrom/$medium->{rpmsdir}/" . $files{rpm_fullname($pkg)}; - if (-e $file) { - system "rpm", "-ivh", "--root", "/mnt", "--nodeps", "--force", "--noscripts", $file; - } - } - } else { - die "no glibc package found"; - } - my @files; - foreach my $pkg (@{$packages->{depslist}}) { - $files{rpm_fullname($pkg)} or next; - $pkg->{selected} or next; - my $file = "/cdrom/$medium->{rpmsdir}/" . $files{rpm_fullname($pkg)}; - if (-e $file) { - push @files, $file; - delete $pkg->{selected}; - } - } - system "rpm", "-ivh", "--root", "/mnt", "--nodeps", "--force", @files; - print "Installed " . scalar(@files) . " packages\n"; - - scalar(grep { $_->{selected} || $_->{closure} } @{$packages->{depslist}}) == 0 and last; -} - -#- try to figure out if a oem-message-graphic already exists. -#- if this is the case, rename it to /mnt/boot/message-graphic -if (-e "/cdrom/Mandrake/base/oem-message-graphic") { - print "Using specific oem graphic image\n"; - if (-e "/mnt/boot/message-graphic") { - rename "/mnt/boot/message-graphic", "/mnt/boot/message-graphic.old"; - system "cp", "-a", "/cdrom/Mandrake/base/oem-message-graphic", "/mnt/boot/message-graphic"; - } elsif (-e "/mnt/boot/lilo-graphic/message") { - rename "/mnt/boot/lilo-graphic/message", "/mnt/boot/lilo-graphic/message.old"; - system "cp", "-a", "/cdrom/Mandrake/base/oem-message-graphic", "/mnt/boot/lilo-graphic/message"; - } -} - -system "umount", "/mnt/proc"; -$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 " -Done. OEM hard drive ready! -The hard drive is now ready for a customer. -System is now halted.\n\n"; - -system "halt"; - -#- gives way to format partition (simpler approach) -sub mkfs { - my ($fs, $dev) = @_; - for ($fs) { - /ext2/ and do { system "mkfs.ext2", $dev; - next }; - /ext3/ and do { system "mkfs.ext2", "-j", $dev; - system "tune2fs", "-c0", "-i0", $dev; - next }; - die "unknown fs: $_\n"; - } -} - -#- provide package fullname that have to be installed and copied. -sub select_packages { - my ($dir, $lang) = @_; - my $o = { packages => read_depslist("$dir/Mandrake/base/depslist.ordered") }; - - #- act as DrakX will do to select packages. - pkgs::read_rpmsrate($o->{packages}, install_any::getFile("Mandrake/base/rpmsrate") || die "unable to read rpmsrate"); - ($o->{compssUsers}, $o->{compssUsersSorted}, $o->{compssUsersIcons}, $o->{compssUsersDescr}) = - pkgs::readCompssUsers($o->{packages}, $o->{meta_class}); - eval { install_any::getFile("XXX") }; #- close out any still opened filehandle.. - - pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, 'basesystem') || die "no basesystem package found"); - #- 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'; - - 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_LDAP_SERVER - NETWORKING_MAIL_SERVER NETWORKING_OTHER_SERVER - 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 DOCS)) { - $o->{compssUsersChoice}{$_} = 1; - } - #- additional packages to be selected for server, databases with MySQL (avoid rpmsrate modifications). - foreach (qw(MySQL-client MySQL-shared MySQL perl-Mysql)) { - my $pkg = pkgs::packageByName($o->{packages}, $_); - $pkg and pkgs::selectPackage($o->{packages}, $pkg); - } - } else { - $o->{compssUsersChoice}{$_} = 1 foreach map { @{$o->{compssUsers}{$_}} } @{$o->{compssUsersSorted}}; - $o->{compssUsersChoice}{$_} = 1 foreach qw(SYSTEM X DOCS); - @{$o->{compssUsersChoice}}{grep { /SERVER|DATABASES/ } keys %{$o->{compssUsersChoice}}} = (); - } - - my $lang_pkg = $lang && pkgs::packageByName($o->{packages}, "locales-$lang"); - if ($lang_pkg) { - pkgs::selectPackage($o->{packages}, $lang_pkg); - $o->{compssUsersChoice}{qq(LOCALES"$lang")} = 1; - $o->{compssUsersChoice}{qq(LOCALES"$flang")} = 1; - $o->{compssUsersChoice}{qq(CHARSET"$charset")} = 1; - } - - pkgs::setSelectedFromCompssList($o->{packages}, $o->{compssUsersChoice}, 4, 0); - #- save selected, but keep selected property. - foreach my $pkg (@{$o->{packages}{depslist}}) { - $pkg->{selected} and $pkg->{save_selected} = $pkg->{selected}; - } - - #- extend selection to closure now, make all selected as closure and restore selected after. - $o->{compssUsersChoice}{$_} = 1 foreach qw(BURNER DVD PCMCIA BIGMEM SMP 3D TV SCANNER PHOTO SOUND); - pkgs::setSelectedFromCompssList($o->{packages}, $o->{compssUsersChoice}, 4, 0); - $o->{compssUsersChoice}{$_} = 0 foreach qw(BURNER DVD PCMCIA BIGMEM SMP 3D TV SCANNER PHOTO SOUND); - #- INSTALL class need to be copied as closure (unless installed after). - #- but we have to remove kernel22 and kernel22-smp now obsolete for oem. - foreach (@{$o->{packages}{needToCopy}}) { - /^(kernel22.*|raidtools|lvm|reiserfsprogs|xfsprogs|jfsprogs|XFree86-(Mach8|Mach32|Mono|W32|3DLabs|P9000|8514|VGA16|I128|AGX))$/ and next; - my $pkg = pkgs::packageByName($o->{packages}, $_); - pkgs::selectPackage($o->{packages}, $pkg); - } - #- first select package that have to go to closure according to their names. - foreach my $pkg (@{$o->{packages}{depslist}}) { - $pkg->{name} =~ /kernel-(\d|smp|enterprise)/ and pkgs::selectPackage($o->{packages}, $pkg); - $pkg->{name} =~ /NVIDIA/ and pkgs::selectPackage($o->{packages}, $pkg); - } - foreach my $pkg (@{$o->{packages}{depslist}}) { - delete $pkg->{selected} && !$pkg->{save_selected} and $pkg->{closure} = 1; - $pkg->{save_selected} and $pkg->{selected} = $pkg->{save_selected}; - } - - #- package that have to selected here as a bonus for oem install. - foreach (qw(cups cups-drivers a2ps drakprofile draksync numlock icewm-light - Mesa Mesa-demos alsa alsa-utils curl - glibc vim-minimal kernel gcc-cpp - ), exists $options{server} ? qw(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(nfs-utils-client numlock usbd hotplug alsa alsa-utils - Aurora Aurora-Monitor-NewStyle-Categorizing-WsLib bootsplash)) { - my $pkg = pkgs::packageByName($o->{packages}, $_); - if ($pkg) { - pkgs::selectPackage($o->{packages}, $pkg); - $pkg->{closure} = 1; - delete $pkg->{selected}; - } - } - - $o->{packages}; -} - -sub chop_version { - ($_[0] =~ /^([^:\s]*)-[^:\-\s]+-[^:\-\s]+\.[^:\.\-\s]*(?::\S*)?/)[0] || die "unable to parse $_[0]"; -} -sub rpm_fullname { - ($_[0]{name} =~ /^([^:\s]*-[^:\-\s]+-[^:\-\s]+\.[^:\.\-\s]*)(?::\S*)?/)[0] || die "unable to parse $_[0]"; -} - -sub read_depslist { - my ($file) = @_; - my $packages = { depslist => [], names => {} }; - - #- read depslist.oredered file. - my $id = 0; - - open F, "$file" or die "unable to open ordered dependencies list file"; - while (<F>) { - my ($name, $size, @deps) = split; - push @{$packages->{depslist}}, { id => $id++, name => $name, size => $size, deps => \@deps }; - } - close F; - - foreach (@{$packages->{depslist}}) { - $packages->{names}{chop_version($_->{name})} = $_; - } - - print "read " . scalar(@{$packages->{depslist}}) . " package dependancies\n"; - $packages; -} - -#- compability method for the below ones, wrap DrakX code extracted. -package log; -sub l {} - -package detect_devices; -sub matching_desc { 0 } - -package install_any; -sub getFile { open FILE, "/cdrom/$_[0]" or return; \*FILE } - -package pkgs; -sub if_ { my $b = shift; $b or return (); wantarray ? @_ : $_[0] } -sub formatXiB { $_[0] } #- NOP -sub packageName { ::chop_version($_[0]{name}) } -sub packageFlagSelected { $_[0]{selected} } -sub packageSize { $_[0]{size} } -sub packageDepsId { @{$_[0]{deps}} } -sub packageRate { $_[0]{values}[0] } -sub packageRateRFlags { @{$_[0]{values}} } -sub packageSetRateRFlags { - my ($pkg, @rate_rflags) = @_; - $pkg->{values} = [ @rate_rflags ]; -} -sub packageByName { - my ($packages, $name) = @_; - $packages->{names}{$name}; -} -sub packageById { - my ($packages, $id) = @_; - $packages->{depslist}[$id]; -} -sub selectedSize { - my ($packages) = @_; - my $size = 0; - foreach (@{$packages->{depslist}}) { - $_->{selected} and $size += $_->{size}; - } - $size; -} -my @preferred = qw(perl-GTK postfix wu-ftpd ghostscript-X vim-minimal kernel ispell-en); -sub selectPackage { - my ($packages, $pkg, $base, $otherOnly, $check_recursion) = @_; - - #- avoid infinite recursion (mainly against badly generated depslist.ordered). - $check_recursion ||= {}; exists $check_recursion->{$pkg->{name}} and return; $check_recursion->{$pkg->{name}} = undef; - - #- make sure base package are set even if already selected. - $base and $pkg->{base} = 1; - - #- select package and dependancies, otherOnly may be a reference - #- to a hash to indicate package that will strictly be selected - #- when value is true, may be selected when value is false (this - #- is only used for unselection, not selection) - unless ($pkg->{selected}) { - foreach (@{$pkg->{deps}}) { - my $preferred; - if (/\|/) { - #- choice deps should be reselected recursively as no - #- closure on them is computed, this code is exactly the - #- same as pixel's one. - my %preferred; @preferred{@preferred} = (); - foreach (split '\|') { - my $dep = $packages->{depslist}[$_] or next; - $preferred ||= $dep; - $dep->{selected} and $preferred = $dep, last; - packageName($dep) =~ /kernel-\d/ and $preferred = $dep; #- hard coded preference to simple kernel - exists $preferred{::chop_version($dep->{name})} and $preferred = $dep; - } - selectPackage($packages, $preferred, $base, $otherOnly, $check_recursion) if $preferred; - } else { - #- deps have been closed except for choices, so no need to - #- recursively apply selection, expand base on it. - my $dep = $packages->{depslist}[$_]; - $base and $dep->{base} = 1; - $otherOnly and !$dep->{selected} and $otherOnly->{::chop_version($dep->{name})} = 1; - $otherOnly or $dep->{selected} += 1; - } - } - } - $otherOnly and !$pkg->{selected} and $otherOnly->{::chop_version($pkg->{name})} = 1; - $otherOnly or $pkg->{selected} += 1; - 1; -} - -#- this code is extracted from DrakX and SHOULD NOT BE MODIFIED, wrapper method exists above to provide a good choice. -sub read_rpmsrate { - my ($packages, $f) = @_; - my $line_nb = 0; - my $fatal_error; - my (@l); - while (<$f>) { - $line_nb++; - /\t/ and die "tabulations not allowed at line $line_nb\n"; - s/#.*//; # comments - - my ($indent, $data) = /(\s*)(.*)/; - next if !$data; # skip empty lines - - @l = grep { $_->[0] < length $indent } @l; - - my @m = @l ? @{$l[$#l][1]} : (); - my ($t, $flag, @l2); - while ($data =~ - /^(( - [1-5] - | - (?: (?: !\s*)? [0-9A-Z_]+(?:".*?")?) - (?: \s*\|\|\s* (?: !\s*)? [0-9A-Z_]+(?:".*?")?)* - ) - (?:\s+|$) - )(.*)/x) { #@")) { - ($t, $flag, $data) = ($1,$2,$3); - while ($flag =~ s,^\s*(("[^"]*"|[^"\s]*)*)\s+,$1,) {} - my $ok = 0; - $flag = join('||', grep { - if (my ($inv, $p) = /^(!)?HW"(.*)"/) { - ($inv xor detect_devices::matching_desc($p)) and $ok = 1; - 0; - } else { - 1; - } - } split '\|\|', $flag); - push @m, $ok ? 'TRUE' : $flag || 'FALSE'; - push @l2, [ length $indent, [ @m ] ]; - $indent .= $t; - } - if ($data) { - # has packages on same line - my ($rate) = grep { /^\d$/ } @m or die sprintf qq(missing rate for "%s" at line %d (flags are %s)\n), $data, $line_nb, join('&&', @m); - foreach (split ' ', $data) { - if ($packages) { - my $p = packageByName($packages, $_) or next; - my @m2 = - map { if_($_ && packageName($_) =~ /locales-(.*)/, qq(LOCALES"$1")) } - map { packageById($packages, $_) } packageDepsId($p); - - my @m3 = ((grep { !/^\d$/ } @m), @m2); - if (@m3 >= 1 && $m3[0] eq 'INSTALL' || @m3 >=2 && $m3[1] eq 'INSTALL') { - push @{$packages->{needToCopy} ||= []}, $_; - next; #- don't need to put INSTALL flag for a package. - } - if (packageRate($p)) { - my ($rate2, @m4) = packageRateRFlags($p); - if (@m3 > 1 || @m4 > 1) { - log::l("can't handle complicate flags for packages appearing twice ($_)"); - $fatal_error++; - } - log::l("package $_ appearing twice with different rates ($rate != $rate2)") if $rate != $rate2; - packageSetRateRFlags($p, $rate, "$m3[0]||$m4[0]"); - } else { - packageSetRateRFlags($p, $rate, @m3); - } - } else { - print "$_ = ", join(" && ", @m), "\n"; - } - } - push @l, @l2; - } else { - push @l, [ $l2[0][0], $l2[$#l2][1] ]; - } - } - $fatal_error and die "$fatal_error fatal errors in rpmsrate"; -} - -sub readCompssUsers { - my ($packages, $meta_class) = @_; - my (%compssUsers, %compssUsersIcons, , %compssUsersDescr, @sorted, $l); - my (%compss); - - my $file = 'Mandrake/base/compssUsers'; - my $f = $meta_class && install_any::getFile("$file.$meta_class") || install_any::getFile($file) or die "can't find $file"; - local $_; - while (<$f>) { - /^\s*$/ || /^#/ and next; - s/#.*//; - - if (/^(\S.*)/) { - my ($icon, $descr); - /^(.*?)\s*\[icon=(.*?)\](.*)/ and $_ = "$1$3", $icon = $2; - /^(.*?)\s*\[descr=(.*?)\](.*)/ and $_ = "$1$3", $descr = $2; - $compssUsersIcons{$_} = $icon; - $compssUsersDescr{$_} = $descr; - push @sorted, $_; - $compssUsers{$_} = $l = []; - } elsif (/^\s+(.*?)\s*$/) { - push @$l, $1; - } - } - \%compssUsers, \@sorted, \%compssUsersIcons, \%compssUsersDescr; -} - -sub setSelectedFromCompssList { - my ($packages, $compssUsersChoice, $min_level, $max_size, $otherOnly) = @_; - $compssUsersChoice->{TRUE} = 1; #- ensure TRUE is set - my $nb = selectedSize($packages); - foreach my $p (sort { packageRate($b) <=> packageRate($a) } values %{$packages->{names}}) { - my ($rate, @flags) = packageRateRFlags($p); - next if - !$rate || $rate < $min_level || - grep { !grep { /^!(.*)/ ? !$compssUsersChoice->{$1} : $compssUsersChoice->{$_} } split('\|\|') } @flags; - - #- determine the packages that will be selected when - #- selecting $p. the packages are not selected. - my %newSelection; - selectPackage($packages, $p, 0, \%newSelection); - - #- this enable an incremental total size. - my $old_nb = $nb; - foreach (grep { $newSelection{$_} } keys %newSelection) { - $nb += packageSize($packages->{names}{$_}); - } - if ($max_size && $nb > $max_size) { - $nb = $old_nb; - $min_level = packageRate($p); - last; - } - - #- at this point the package can safely be selected. - if ($otherOnly) { - selectPackage($packages, $p, 0, $otherOnly); - } else { - selectPackage($packages, $p); - } - } - unless ($otherOnly) { - log::l("setSelectedFromCompssList: reached size ", formatXiB($nb), ", up to indice $min_level (less than ", formatXiB($max_size), ")"); - log::l("setSelectedFromCompssList: ", join(" ", sort map { packageName($_) } grep { packageFlagSelected($_) } @{$packages->{depslist}})); - } - $min_level; -} diff --git a/rescue/tree/etc/passwd b/rescue/tree/etc/passwd deleted file mode 100644 index 568451e4e..000000000 --- a/rescue/tree/etc/passwd +++ /dev/null @@ -1,3 +0,0 @@ -root::0:0::/:/bin/bash -shutdown:*:6:0:shutdown:/sbin:/sbin/shutdown -halt:*:7:0:halt:/sbin:/sbin/halt diff --git a/rescue/tree/etc/profile b/rescue/tree/etc/profile deleted file mode 100644 index 5cf489922..000000000 --- a/rescue/tree/etc/profile +++ /dev/null @@ -1,25 +0,0 @@ -# /etc/profile -# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com> - -# System wide environment and startup programs -# Functions and aliases go in /etc/bashrc - -PROFILE_LOADED=1 - -export PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/mnt/sbin:/mnt/bin:/mnt/usr/sbin:/mnt/usr/bin:/mnt/usr/X11R6/bin -export LD_LIBRARY_PATH=/mnt/lib:/mnt/usr/lib:/mnt/usr/X11R6/lib - -PS1="[root@rescue \w]\\$ " -ls () { /bin/ls --color=auto -F "$@";} -ll () { /bin/ls --color=auto -Fl "$@";} -d () { /bin/ls --color=auto -F "$@";} -s () { cd .. ;} -which () { type -p "$@" ;} -HOSTNAME=rescue -HISTSIZE=1000 -HISTFILESIZE=1000 - -INPUTRC=/etc/inputrc -export PATH PS1 USER HOSTNAME HISTSIZE HISTFILESIZE INPUTRC - -cat /etc/issue diff --git a/rescue/tree/etc/rc.reboot b/rescue/tree/etc/rc.reboot deleted file mode 100755 index 0b67416f1..000000000 --- a/rescue/tree/etc/rc.reboot +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -sleep 1 -/sbin/killall5 -9 - -umount -a -f -t noproc - -reboot -i -d diff --git a/rescue/tree/etc/rc.sysinit b/rescue/tree/etc/rc.sysinit deleted file mode 100755 index 444e0c064..000000000 --- a/rescue/tree/etc/rc.sysinit +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -action() { echo $1; shift; $*; } - -export PATH=/bin:/sbin:/usr/bin:/usr/sbin - -echo -e "\t\t\tWelcome to \\033[1;36mMandrake\\033[0;39m Linux" - -action "Mounting proc filesystem" mount -n -t proc /proc /proc -action "Remounting root filesystem in read-write mode" mount -n -o remount,rw / - ->/etc/mtab -mount -f / -mount -f /proc - -# Set the hostname. -action "Setting hostname rescue" hostname rescue -echo rescue > /etc/HOSTNAME - -# Loads common modules ( no kerneld :( ) -echo "Loading additional modules..." -load() { modprobe $* 2>/dev/null; } -load ide-mod -load ide-probe -load ide-disk -load ide-cd -load floppy -load af_packet -load isofs -load vfat -load ext3 -load reiserfs -load xfs -load jfs -load loop -load sd_mod -load sr_mod - -grep -q oem /proc/cmdline && exec /etc/oem -f - -/sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0 -/sbin/route add 127.0.0.1 lo - -if ! grep -q expert /proc/cmdline; then - rescue-gui -fi diff --git a/rescue/tree/etc/resolv.conf b/rescue/tree/etc/resolv.conf deleted file mode 100644 index 3822939b1..000000000 --- a/rescue/tree/etc/resolv.conf +++ /dev/null @@ -1,2 +0,0 @@ -search foo.com -nameserver 192.168.1.1 diff --git a/rescue/tree/sbin/fakeshutdown b/rescue/tree/sbin/fakeshutdown deleted file mode 100755 index c6d9b8440..000000000 --- a/rescue/tree/sbin/fakeshutdown +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/perl - -# -# Guillaume Cottenceau (gc@mandrakesoft.com) -# -# Copyright 2001 MandrakeSoft -# -# This software may be freely redistributed under the terms of the GNU -# public license. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - -sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } - -print "\n"; - - -#- try to umount as much as possible; uses Pixel's ultra optimized algo (let you guess how it works..) -print "Umounting:\n"; -my @mounts = cat_('/proc/mounts'); -my $something_moved; -do { - $something_moved = 0; - foreach (@mounts) { - my $where = (split)[1]; - next if $where eq '/'; #- ouch! umounting the ramdisk on / always succeeds, and makes it becoming ro :-( - if (!system("umount $where 2>/dev/null")) { - print "\t$where\n"; - $something_moved++; - } - } -} while $something_moved; - - -#- shutdown with init -exec '/sbin/init', 6; diff --git a/rescue/tree/sbin/modprobe b/rescue/tree/sbin/modprobe deleted file mode 100755 index 811c75111..000000000 --- a/rescue/tree/sbin/modprobe +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - -sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } - -sub read_already_loaded() { - foreach (cat_("/proc/modules")) { - my ($name) = split; - $conf{$name}{loaded} = 1; - } -} - -sub load_deps($) { - my ($file) = @_; - - local *F; - open F, $file or log::l("error opening $file: $!"), return 0; - foreach (<F>) { - my ($f, $deps) = split ':'; - push @{$deps{$f}}, split ' ', $deps; - } -} - -sub load { - my ($name, @options) = @_; - $name =~ s/\.o//; - - $conf{$name}{loaded} and return; - eval { load($_, 'prereq') } foreach @{$deps{$name}}; - - system("packdrake -x /modules/modules.cz* /tmp $name.o"); - -r "/tmp/$name.o" or die "can't find module $name\n"; - system("/sbin/insmod /tmp/$name.o"); $? and die("insmod $name failed"); - system("rm /tmp/$name.o"); -} - -!@ARGV || $ARGV[0] =~ /-h/ and die "usage: modprobe <module> [<options...>]\n"; - -read_already_loaded(); -load_deps("/modules/modules.dep"); -load(@ARGV); diff --git a/rescue/tree/usr/lib/CVS. b/rescue/tree/usr/lib/CVS. deleted file mode 100644 index e69de29bb..000000000 --- a/rescue/tree/usr/lib/CVS. +++ /dev/null |