diff options
Diffstat (limited to 'rescue')
39 files changed, 0 insertions, 2560 deletions
diff --git a/rescue/.cvsignore b/rescue/.cvsignore deleted file mode 100644 index c660273e8..000000000 --- a/rescue/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -rescue.clp diff --git a/rescue/Makefile b/rescue/Makefile deleted file mode 100644 index 9721a68dc..000000000 --- a/rescue/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../Makefile.config - -all: rescue.clp - -install: rescue.clp - cp -f $< $(STAGE2_DEST) - -rescue.clp: list.xml drvinst guessmounts lsparts rescue-doc make_rescue_img - DISTRIB_DESCR=$(DISTRIB_DESCR) ./make_rescue_img - -clean: - rm -f rescue.clp kernel_read_part diff --git a/rescue/aliases b/rescue/aliases deleted file mode 100644 index cec7b82ba..000000000 --- a/rescue/aliases +++ /dev/null @@ -1,6 +0,0 @@ -/bin/zcat gzip -/bin/gunzip gzip -/bin/vi vim-minimal -/sbin/lsmod lsmod-25 -/sbin/rmmod rmmod-25 -/sbin/insmod insmod-25 diff --git a/rescue/devices.pl b/rescue/devices.pl deleted file mode 100644 index 79308508a..000000000 --- a/rescue/devices.pl +++ /dev/null @@ -1,54 +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 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 -b 9 0 md0-15 -c 10 144 nvram -c 9 0 st0-15 diff --git a/rescue/dirs b/rescue/dirs deleted file mode 100644 index e6d5a5d47..000000000 --- a/rescue/dirs +++ /dev/null @@ -1,6 +0,0 @@ -/lib -/tmp -/modules -/proc -/dev -/dev/pts diff --git a/rescue/drvinst b/rescue/drvinst deleted file mode 100755 index 78c6f5c74..000000000 --- a/rescue/drvinst +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/perl -# -# Guillaume Cottenceau -# -# Copyright 2000-2005 Mandriva -# -# 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. -# - -use lib qw(../perl-install /usr/lib/libDrakX); -use common; -use detect_devices; - -$ARGV[0] =~ /^--?h/ and die "usage: drivers_install [drivertype1 [drivertype2 ...]]\n"; -my @types = @ARGV; - -sub install_module_raw { - my ($driver, $o_descr) = @_; - print STDERR "Installing driver $driver", $o_descr ? " (for \"$o_descr\")" : '', "\n"; - system("/sbin/modprobe", $driver) and print "\tfailed\n"; -} - -my $already_usb; -sub install_module { - my ($driver, $descr) = @_; - install_module_raw($driver, $descr); - if (!$already_usb && $driver =~ /usb/) { - $already_usb = 1; - install_module_raw('usbkbd'); - install_module_raw('keybdev'); - } -} - -#- start -foreach my $card (detect_devices::pci_probe()) { - $card->{driver} eq 'unknown' || $card->{driver} =~ /:/ and next; - $card->{media_type} eq "DISPLAY_VGA" and next; - - if (!@ARGV || find { $card->{media_type} =~ /$_/i } @types) { - install_module($card->{driver}, $card->{description}); - } -} diff --git a/rescue/guessmounts b/rescue/guessmounts deleted file mode 100755 index 3f3a4e208..000000000 --- a/rescue/guessmounts +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/perl -# -# Guillaume Cottenceau -# -# Copyright 2001-2005 Mandriva -# -# 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. -# - -use lib qw(../perl-install /usr/lib/libDrakX); -use common; -use fs; -use fs::proc_partitions; - - -my @proc_mounts = fs::read_fstab('', '/proc/mounts'); - -my $target = '/mnt'; - -if (fs::get::mntpoint2part($target, \@proc_mounts)) { - print STDERR "$target is already mounted (according to /proc/mounts)\n"; - exit 0; -} - -system('drvinst', 'STORAGE'); - -print STDERR "\nPlease wait, trying to find your root device...\n"; - -mkdir_p($target); - -my @fstab; -my $root; - -foreach (fs::proc_partitions::read_raw()) { - my $dev = devices::make($_->{dev}); - - my $fs = find { - system("mount -t $_ $dev $target 2>/dev/null") == 0; - } fs::type::true_local_fs_types() or next; - - if (my $release_file = common::release_file($target)) { - print STDERR "=> found a Mandriva Linux root partition on $dev\n=> type $fs, version `", - chomp_(cat_("$target$release_file")), "'\n"; - @fstab = fs::read_fstab($target, '/etc/fstab'); - $root = $dev; - last; - } else { - system('umount', $target) == 0 or die "error unmounting $target\n"; - } -} - -if ($root) { - print STDERR "\nMounting other partitions from fstab on $target...\n"; - foreach (@fstab) { - my ($valued_options, $options) = fs::mount_options::unpack($_); - - next if - !$_->{fs_type} || $_->{device} eq 'none' - || $valued_options->{noauto} || $valued_options->{supermount} - || $_->{mntpoint} eq '/' - || member($_->{fs_type}, 'swap', 'nfs', 'ntfs'); - - delete $valued_options->{'iocharset='}; - delete $valued_options->{'codepage='}; - fs::mount_options::pack($_, $valued_options, $options); #- vfat opts, we don't have the modules in rescue - - my $where = "$target$_->{mntpoint}"; - mkdir_p($where); - print STDERR "\t$_->{device} on $where type $_->{fs_type} options $_->{options}\n"; - system("mount -t $_->{fs_type} /dev/$_->{device} $where -o $_->{options}"); - system("cp -f /etc/mtab $target/etc/mtab"); #- to allow a nice chrooted "mount" or "df" - } - print STDERR "\nYour system is ready on $target.\n\n"; -} else { - die "Could not find your root device :-(.\n"; -} - diff --git a/rescue/install_bootloader b/rescue/install_bootloader deleted file mode 100755 index 59248a016..000000000 --- a/rescue/install_bootloader +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/perl -# -# Guillaume Cottenceau -# -# Copyright 2001-2005 Mandriva -# -# 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. -# - -use lib qw(../perl-install /usr/lib/libDrakX); -use common; -use bootloader; -use fs; - -$::prefix = '/mnt'; - -my $release = common::mandrake_release($::prefix) || - do { - system('guessmounts') == 0 or die 'guessmounts failed'; - common::mandrake_release($::prefix); - }; - -if ($release) { - $release =~ /Mandrake|Mandriva/ or die "release file doesn't contain 'Mandriva', exiting.\n"; -} elsif (fs::get::mntpoint2part($::prefix, [ fs::read_fstab('', '/proc/mounts') ])) { - die "unknown distribution mounted in $::prefix\n"; -} else { - die "Your root device isn't mounted on $::prefix\n"; -} - -my @main_methods = bootloader::configured_main_methods(); - -my $main_method; -if (@main_methods == 0) { - die "Cannot find a configured boot loader\n"; -} elsif (@main_methods == 1) { - ($main_method) = @main_methods; -} else { - while (1) { - print "Configuration files for Boot Loaders ", join(' and ', @main_methods), " were found.\n"; - print "Which one one should be installed? "; - chomp($main_method = <STDIN>); - if (member($main_method, @main_methods)) { - last; - } else { - print "bad choice\n"; - } - } -} - -my $install = $bootloader::{'install_raw_' . $main_method} or die "unknown bootloader method install_raw_$main_method\n"; - -print "About to re-install Boot Loader $main_method of following Mandriva Linux distribution:\n\t", - $release, - "\n=> ok? <press Enter to continue, 'n' and Enter to cancel> "; -<STDIN> =~ /^n/i and exit 0; - -$install->(); diff --git a/rescue/list.xml b/rescue/list.xml deleted file mode 100644 index 8e6fdbde2..000000000 --- a/rescue/list.xml +++ /dev/null @@ -1,235 +0,0 @@ -<list no-arch-libraries="on"> - -<from expand="binary"> - bash sh - - false true - pwd reset - - ls - cp ln mkdir mknod mv rm rmdir - chmod chown - dd touch - - cat less - tail head tee - sort split cut - grep - - cmp diff - find - file md5sum - - gzip <!-- zcat and gunzip are hardlinks, they are handled in aliases to make it more apparent --> - bzip2 bunzip2 bzcat - - df du - - packdrake parsehdlist - cpio ftp tar - rsync - ssh scp - telnet - - date - dmesg - chroot - sleep - sync update - - eject - mount umount - - ldconfig - mingetty init - reboot halt shutdown - kill killall5 ps strace - - loadkeys tset - - ping hostname ifconfig route - - fdformat badblocks - e2fsck fsck.ext2 fsck.ext3 mke2fs mkfs.ext2 resize2fs - debugfs dumpe2fs tune2fs - fsck.xfs xfs_repair - resize_reiserfs reiserfsck - mkswap swapoff swapon - <if ARCH="i.86"> - fsck.jfs - </if> - <if ARCH="i.86|x86_64|ia64"> - ntfsresize - mkdosfs - </if> - <if ARCH="ppc"> - hformat - </if> - - <if-not ARCH="ppc"> - fdisk gpart sfdisk - rescuept - </if-not> - <if ARCH="ppc"> - pdisk - </if> - dump dump.ext2 restore restore.ext2 dump.ext3 restore.ext3 dump.xfs restore.xfs - parted partimage - - mdadm lvm2 - <if ARCH="i.86|x86_64|ia64"> - dmraid - </if> - - lsmod-25 - insmod-25 - rmmod-25 - - setserial - mt stinit - - lspci lspcidrake - - rpm - rpm2cpio rpmdb - rpme rpmi rpmu rpmquery rpmverify - - vim-minimal hexedit - - perl - - <if ARCH="i.86|x86_64|ia64"> - dmidecode - </if> - - <if ARCH="i.86|x86_64"> - grub grub-install - </if> - <if ARCH="ia64"> - efibootmgr - </if> - <if ARCH="ppc"> - ybin - mkofboot ofpath - nvsetenv - </if> - <if ARCH="sparc"> - silo - </if> -</from> - -<from> - /usr/lib/kbd/keymaps/include - <if ARCH="i.86|x86_64"> - /usr/lib/kbd/keymaps/i386/include - /usr/lib/kbd/keymaps/i386/azerty/be-latin1.kmap.gz <!-- this one is needed by be2-latin1 --> - </if> - /usr/share/misc/file/magic - /usr/share/terminfo/l/linux - /usr/share/pci.ids - /var/run/utmp - - <if ARCH="i.86|x86_64"> - <from dir="/lib/grub/ARCH-mandriva" expand="glob"> - stage1 - stage2 - *_stage1_5 - </from> - /usr/lib/extipl/aldebaran.bin - </if> - - <if ARCH="ppc"> - /usr/lib/yaboot/ofboot - /usr/lib/yaboot/yaboot - </if> - - <from expand="command"> - perl -Mkeyboard -I../perl-install -le 'print foreach keyboard::loadkeys_files()' - </from> -</from> - -<from dir="/usr/lib/rpm" expand="glob"> - <mode copy="keep-links"> - rpmrc - macros - rpmpopt-* - rpmd rpme rpmi rpmu rpmq rpmv - </mode> -</from> - -<filter subst="/^__END__/ and $_ = '', close ARGV"> -<from expand="main-perl"> - AutoLoader.pm - strict.pm - vars.pm - warnings/register.pm - warnings.pm - Carp.pm - Exporter.pm - ARCH-linux/CORE/libperl.so - ARCH-linux/auto/POSIX/autosplit.ix - ARCH-linux/auto/POSIX/load_imports.al - ARCH-linux/auto/POSIX/POSIX.so - ARCH-linux/POSIX.pm - ARCH-linux/XSLoader.pm -</from> - -<from expand="perl"> - packdrake.pm - Packdrakeng.pm -</from> -</filter> - -<from dir="/etc"> - inputrc - termcap - protocols - services - ssh/ssh_config -</from> - -<filter command="strip"> -<from dir="/LIB"> - libnss_files.so.2 - libnss_dns.so.2 - libresolv.so.2 - ld-linux*.so.2 -</from> -</filter> - -<from dir="/usr/share/ldetect-lst" expand="glob"> - *table.gz -</from> - -<from dir="../kernel/all.kernels/$(MAIN_KERNEL)"> - <to dir="/modules"> - modules.cz - modules.dep - </to> -</from> - -<filter command="../tools/simplify-drakx-modules"> - <from dir="." expand="collect-perl-files ../perl-install /usr/lib/libDrakX"> - <to dir="/usr/bin"> - rescue-doc drvinst lsparts - guessmounts install_bootloader - <if ARCH="i.86|x86_64"> - restore_ms_boot - </if> - </to> - <to dir="/usr/sbin"> - partimage_whole_disk - </to> - </from> -</filter> - -<from dir="../mdk-stage1"> - <to dir="/usr/bin"> - rescue-gui - </to> - <to dir="/usr/sbin"> - dhcp-client - </to> -</from> - -</list> diff --git a/rescue/lsparts b/rescue/lsparts deleted file mode 100755 index 9f0fac925..000000000 --- a/rescue/lsparts +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl -# -# Main author Pascal Rigaux (pixel@mandriva.com) -# Put together by Guillaume Cottenceau -# -# Copyright 1999-2005 Mandriva -# -# 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. -# -# -# Detects partition types using signatures -# - -use lib qw(../perl-install /usr/lib/libDrakX); -use common; -use fs::type; -use fs::proc_partitions; - -my $params = join '', @ARGV; -my $verbose = $params =~ /-v/; - -$params =~ /-h/ and die "usage: lsparts [-v]\n"; - - -foreach (fs::proc_partitions::read_raw()) { - if (my $err = $_->{size} <= 1 ? - "Skipping <$_->{dev}> because too little blocks ($_->{size})" : - $_->{dev} !~ /\d$/ ? - "Skipping <$_->{dev}> because doesn't end with a number (e.g. seems to not be a partition)" : - $_->{dev} =~ /^loop\d+$/ ? - "Skipping <$_->{dev}>" : - '') { - print STDERR "$err\n" if $verbose; - } else { - $_->{device} = $_->{dev}; - if (my $type = fs::type::type_subpart_from_magic($_)) { - printf "$_->{dev}: %6s, fs %s (%s)\n", formatXiB($_->{size} * 512), $type->{fs_type}, fs::type::part2type_name($type); - } - } -} diff --git a/rescue/make_partimage_save_rest_all b/rescue/make_partimage_save_rest_all deleted file mode 100755 index 68abcb0d1..000000000 --- a/rescue/make_partimage_save_rest_all +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh - -[ $# -lt 1 ] && { - echo "usage: make_partimage_save_rest_all <partimage special rpm> [<partimage dir> <data dirs>]" ; - exit 1 -} - -rpm=$1 ; shift -partimage_dir=$1 ; shift - -if [ -n "$partimage_dir" ]; then - first_data_dir="$partimage_dir$1" - - [ -d "$first_data_dir" ] || { - echo "can't find $first_data_dir" - exit 1 - } - [ -r "$first_data_dir/lst" ] || { - echo "can't read $first_data_dir/*" - exit 1 - } -fi - -rm -rf .tmp -mkdir -p .tmp/isolinux -cp -f /usr/lib/syslinux/isolinux.bin ../isolinux/alt0/* .tmp/isolinux - -PARTIMAGE_DIR="$@" PARTIMAGE_RPM=$rpm DISTRIB_DESCR="partimage save/restore all" ./make_rescue_img || exit 1 -mkdir -p .tmp/install/stage2 -mv -f rescue.clp .tmp/install/stage2 - -common_para="rescue acpi=ht automatic=method:cdrom" -# hda=4864,255,63 - -for action in save_all rest_all; do - - cat <<EOF > .tmp/isolinux/isolinux.cfg -default $action -prompt 1 -timeout 150 - -label save_all - kernel vmlinuz - append initrd=all.rdz $common_para save_all -label rest_all - kernel vmlinuz - append initrd=all.rdz $common_para rest_all keepmounted -label rescue - kernel vmlinuz - append initrd=all.rdz $common_para -EOF - - if [ $action = rest_all -a -n "$partimage_dir" ]; then - for i in $*; do - dir=`dirname $i` - mkdir -p .tmp$dir - ln -s $partimage_dir$i .tmp$dir - done - fi - - mkisofs -f -o part_$action.iso -r -J -hide-rr-moved -nobak -cache-inodes -publisher Mandrakesoft -V 'mdk part save/rest' -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .tmp - mkcd --addmd5 part_$action.iso -done - -rm -rf .tmp diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img deleted file mode 100755 index 174dbb8bc..000000000 --- a/rescue/make_rescue_img +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/perl - -use MDK::Common; -use lib "../perl-install"; -use keyboard; - -my $lib = (arch() =~ /x86_64/ ? "lib64" : "lib"); -my $tmp = "/tmp/rescue_tmp"; -my $rescue = "rescue.clp"; - -my $sudo = ''; -if ($>) { - $sudo = "sudo"; - $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; -} - -BEGIN { undef *_ } -sub __ { print @_, "\n"; system(@_) } -sub _ { __ @_; $? and die } - -sub installown($$) { - my ($own, $dir) = @_; - return if -e "$tmp$dir/" . basename($own); - mkdir_p("$tmp$dir"); - _ "cp -rL $own $tmp$dir"; -} - -sub install_perl_script { - my ($script, $dir) = @_; - my @gi_modules; - foreach (`../tools/get-needed-drakx-modules ../perl-install /usr/lib/libDrakX $script`) { - chomp; - my ($local, $dest) = split "\t"; - installown($local, dirname($dest || $local)); - push @gi_modules, "$tmp$dest" if $dest; - } - installown($script, $dir); - system('../tools/simplify-drakx-modules', @gi_modules, "$tmp$dir/$script"); -} - -_ "$sudo rm -rf $tmp" if -e $tmp; -_ "mkdir $tmp"; -_ 'find . -name "*~" | xargs rm -f'; -mkdir_p($tmp . chomp_($_)) foreach cat_("dirs"); -_ "cp -a tree/* $tmp"; -_ "find $tmp -name 'CVS*' | xargs rm -rf"; -_ "perl devices.pl $tmp/dev"; -substInFile { s/DISTRIB_DESCR/$ENV{DISTRIB_DESCR}/ } "$tmp/etc/issue"; - -{ - _ "cd ../mdk-stage1 && make rescue-gui dhcp-client"; - -e "../kernel/all.kernels" or die "use ./update_kernel in gi/kernel first\n"; - - $ENV{MAIN_KERNEL} = chomp_(`cat ../kernel/RPMS/.main`); - - _ "../tools/install-xml-file-list list.xml $tmp"; -} - -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"); - } -} - -foreach (cat_("aliases")) { - chomp; my ($f, $dest) = split; - symlink $dest, "$tmp$f"; -} - -if ($ENV{PARTIMAGE_RPM}) { - - _ "rpm2cpio $ENV{PARTIMAGE_RPM} | (cd $tmp ; cpio -idu ./usr/sbin/partimage)"; - my $server = 'partimaged'; - $server = 'leia'; - - my $default_dir = '/data/box'; - my $partimage_dir = $ENV{PARTIMAGE_DIR} || $default_dir; - my @local_dirs = map { "/tmp/image$_" } split(' ', $partimage_dir); - my $local_dir = $local_dirs[0]; - my $local_dirs = join(' ', @local_dirs); - - substInFile { - $_ = <<EOF if /^\s*rescue-gui/; - if grep -q save_all /proc/cmdline; then - drvinst NETWORK ; dhcp-client ; partimage_whole_disk -s $server save_all $default_dir - echo "Press enter" - read - fi - if grep -q rest_all /proc/cmdline; then - if [ -d $local_dir ]; then - partimage_whole_disk rest_all $local_dirs - else - drvinst NETWORK ; dhcp-client ; partimage_whole_disk -s $server rest_all $partimage_dir - fi - echo "Press enter" - read - fi -EOF - } "$tmp/etc/rc.sysinit"; -} - -_ "$sudo chown root.root -R $tmp/*"; - -exit 0 if $ARGV[0]; - -_ "mkisofs -quiet -D -R $tmp | create_compressed_fs - 65536 $rescue 200 2>/dev/null"; -#_ "$sudo rm -rf $tmp"; diff --git a/rescue/partimage_whole_disk b/rescue/partimage_whole_disk deleted file mode 100755 index a35c374ca..000000000 --- a/rescue/partimage_whole_disk +++ /dev/null @@ -1,248 +0,0 @@ -#!/usr/bin/perl - -use lib qw(/usr/lib/libDrakX ../perl-install); -use standalone; -use fsedit; -use fs::format; -use fs::type; -use resize_fat::main; -use diskdrake::resize_ntfs; -use diskdrake::resize_ext2; -use common; -use partition_table::empty; -use Carp::Heavy; - -#- help getting the file in make_rescue_img -BEGIN { partition_table::raw::default_type() } - -my ($server); -if ($ARGV[0] eq '-s') { - (undef, $server, @ARGV) = @ARGV; -} -my $action = shift @ARGV; - -sub usage() { die "partimage_whole_disk [-s <server>] (save_all <dir> | rest_all <dirs>)\n" } - -$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; -$ENV{HOME} = '/'; -log::openLog("/var/log/partimage_whole_disk.log"); -my @partimage_cmd = ('partimage', if_($server, '-s', $server)); -my $all_hds = fsedit::get_hds({}); - -if ($action eq 'save_all') { - @ARGV == 1 or usage(); - save_all($ARGV[0]); -} elsif ($action eq 'rest_all') { - @ARGV or usage(); - rest_all(@ARGV); -} else { - usage(); -} - -sub save_all { - my ($dir) = @_; - - my $base_dir = $dir; - for (my $i = 0; read_part_list($dir); $i++) { - #- find a free dir - $dir = sprintf("$base_dir.%03d", $i); - } - - my $hd = $all_hds->{hds}[0] or die "no main hard drive\n"; - log::l("save_all on $hd->{device}"); - my $part_list = [ partition_table::get_normal_parts($hd) ]; - - foreach (@$part_list) { - $_->{saved} = !member($_->{fs_type}, 'ntfs', 'vfat', 'swap'); - } - - #- shrink and don't save the last ext3 partition (which is the /home partition) - if (my $part = find { isTrueLocalFS($_) } reverse @$part_list) { - $part->{size} = min($part->{size}, 1024 * 1024 * 2); # not greater than 1GB - $part->{saved} = 0; - } - - foreach (grep { $_->{saved} } @$part_list) { - run_or_die(@partimage_cmd, - '-V', 0, '--nombr', '--nodesc', '--nocheck', '-b', '-o', - 'save', devices::make($_->{device}), "$dir/$_->{device}"); - } - save_part_list($dir, $hd->{geom}, $part_list); -} -sub rest_all { - my (@dirs) = @_; - - my %best; - DIRS: foreach (@dirs) { - my ($forced_geom, $part_list) = read_part_list($_) or log::l("read_part_list $_ failed"), next; - my %h = (dir => $_, forced_geom => $forced_geom, part_list => $part_list); - log::l("trying with $h{dir}"); - - ($h{hd}) = my @used_hds = uniq(map { - my $part = $_; - find { $part->{device} =~ /^\Q$_->{device}\E./ } fs::get::hds($all_hds) - or log::l("can't find hard drive for partition $part->{device}"), next DIRS; - } @$part_list); - - @used_hds >= 1 or log::l("no matching hd"), next; - @used_hds <= 1 or log::l("multiple hds: " . join(' ', map { $_->{device} } @used_hds)), next; - - fs::type::set_fs_type($_, $_->{fs_type}) foreach @$part_list; - put_in_hash($_, partition_table::hd2minimal_part($h{hd})) foreach @$part_list; - - ($h{from_partimage}, my $other) = partition { $_->{saved} } @$part_list; - ($h{from_resize}, $h{created}) = partition { member($_->{fs_type}, 'vfat', 'ntfs') } @$other; - - $h{valid_resize} = every { - my $part = fs::get::device2part($_->{device}, [ fs::get::fstab($all_hds) ]) or log::l("partition to resize is missing ($_->{device})"); - my $ok = $part && $part->{fs_type} eq $_->{fs_type}; - $ok or log::l("partition $_->{device} doesn't have the right filesystem ($part->{fs_type} != $_->{fs_type})"); - $ok; - } @{$h{from_resize}}; - - $h{total} = sum(map { $_->{size} } @$part_list); - if ($h{total} > $h{hd}{totalsectors}) { - log::l("discarding $h{dir} since total $h{total} > $h{hd}{totalsectors}"); - } elsif ($h{valid_resize} < $best{valid_resize}) { - log::l("discarding $h{dir} since it has invalid resize whereas $best{dir} has valid resize"); - } elsif ($h{total} > $best{total}) { - log::l("$h{dir} is better than $best{dir} since total $h{total} > $best{total}"); - %best = %h; - } else { - log::l("$h{dir} is not better than $best{dir} since total $h{total} <= $best{total}"); - } - } - - $best{dir} or die "no valid partimage data dirs\n"; - my %h = %best; - log::l("chosen dir $h{dir}"); - - foreach (@{$h{from_resize}}) { - #- resize first - my $part = fs::get::device2part($_->{device}, [ fs::get::fstab($all_hds) ]); - if (!$part) { - log::l("partition to resize is missing ($_->{device})"); - $_->{missing} = 1; - next; - } - if ($part->{fs_type} ne $_->{fs_type}) { - log::l("partition $_->{device} doesn't have the right filesystem ($part->{fs_type} != $_->{fs_type})"); - $_->{missing} = 1; - next; - } - - if (@{$h{from_resize}} == 1) { - my $half_size = int($h{hd}{totalsectors} / 2) - 2 * $h{hd}->cylinder_size; - my $suggested_total = $h{total} - $_->{size} + $half_size; - log::l("resizing bigger? (size $_->{size}, half_size $half_size, total $h{total}, suggested_total $suggested_total)"); - if ($half_size > $_->{size} && $suggested_total < $h{hd}{totalsectors}) { - log::l("prefering to resize $_->{device} to size $half_size instead of $_->{size}"); - $_->{size} = $half_size; - } - } - - $_->{start} = $part->{start}; - if ($_->{size} < $part->{size}) { - log::l("resizing $_->{device} to $_->{size} (it is $part->{size})"); - my $resize_pkg = $_->{fs_type} eq 'vfat' ? 'resize_fat::main' : 'diskdrake::resize_ntfs'; - my $resize = $resize_pkg->new($_->{device}, devices::make($_->{device})); - $resize->resize($_->{size}); - } else { - log::l("no need to resize, instead setting $_->{device}'s size to $part->{size} instead of $_->{size}"); - $_->{size} = $part->{size}; - } - } - - my $hd = $h{hd}; - put_in_hash($hd->{geom}, $h{forced_geom}); - log::l("totalsectors $hd->{totalsectors} heads $hd->{geom}{heads} sectors $hd->{geom}{sectors}"); - partition_table::raw::compute_nb_cylinders($hd->{geom}, $hd->{totalsectors}); - - #- grow the last ext3 partition - if (my $part = find { isTrueLocalFS($_) } reverse @{$h{part_list}}) { - $part->{ratio} = 1; - } - - #- write the partition table - partition_table::raw::zero_MBR($hd); - foreach my $part (grep { $_->{rootDevice} eq $hd->{device} } @{$h{part_list}}) { - next if $part->{missing}; - - my $hole = find { isEmpty($_) && $_->{size} >= $part->{size} } partition_table::get_normal_parts_and_holes($hd) or die "not enough room for $part->{device}"; - $part->{start} = $hole->{start}; - - log::l("handling $part->{device}"); - my $extended = $part->{device} =~ /(\d+)$/ && $1 > 4 && $hd->hasExtended; - - my %wanted_part = %$part; - if ($part->{ratio}) { - $part->{size} = $hole->{size}; - } else { - $part->{size} += $hd->{geom}{sectors} if $extended; - $part->{size} += $hd->cylinder_size if $part->{start} == 1; - } - log::l("adding $part->{device} with size $part->{size}"); - partition_table::add($hd, $part, $extended && 'Extended'); - foreach ('device', if_(!$part->{ratio}, 'size')) { - $part->{$_} eq $wanted_part{$_} or log::l("bad $_ for $part->{device}: $part->{$_} != $wanted_part{$_}"); - } - } - partition_table::write($hd); - - #- restore from partimage - foreach (@{$h{from_partimage}}) { - run_or_die(@partimage_cmd, 'restore', '-b', devices::make($_->{device}), "$h{dir}/$_->{device}"); - - if ($_->{ratio}) { - my $resize = diskdrake::resize_ext2->new($_->{device}, devices::make($_->{device})); - $resize->resize($_->{size}); - } - } - - foreach (@{$h{created}}) { - fs::format::part_raw($_, undef); - } - - run_program::run('guessmounts'); - - if (my @missing = grep { $_->{missing} } @{$h{part_list}}) { - my $missing = join('|', map { quotemeta($_->{device}) } @missing); - log::l("drop missing devices from fstab and lilo.conf: $missing"); - $::prefix = '/mnt'; - substInFile { $_ = '' if m!^/dev/($missing)\s! } "$::prefix/etc/fstab"; - - my $match; - substInFile { - /^\S/ and $match = m!^other=/dev/($missing)$!; - $_ = '' if $match; - } "$::prefix/etc/lilo.conf"; - } - - run_program::run('install_bootloader'); -} - -sub lst_fields() { qw(device size fs_type saved) } -sub save_part_list { - my ($dir, $geom, $part_list) = @_; - my @l = map { join(' ', @$_{lst_fields()}) } @$part_list; - log::l("save_part_list $dir: $_") foreach @l; - my $partimage = join(' ', @partimage_cmd); - open(my $F, "| $partimage -z0 -Bfoo=bar -o save_file $dir/lst"); - print $F join("/", $geom->{heads}, $geom->{sectors}), "\n"; - print $F "$_\n" foreach @l; -} -sub read_part_list { - my ($dir) = @_; - my $partimage = join(' ', @partimage_cmd); - open(my $F, "$partimage -z0 -Bfoo=bar rest_file $dir/lst |"); - my $geom_string = <$F> or return; - my %geom; @geom{'heads', 'sectors'} = split('/', chomp_($geom_string)); - my @l = chomp_(cat__($F)); - log::l("read_part_list $dir: $_") foreach @l; - \%geom, [ map { my %l; @l{lst_fields()} = split; \%l } @l ]; -} - -sub run_or_die { - my (@l) = @_; - run_program::raw({ timeout => 4 * 60 * 60 }, @l) or die join(' ', @l) . " failed\n"; -} diff --git a/rescue/rescue-doc b/rescue/rescue-doc deleted file mode 100755 index fa03d1be3..000000000 --- a/rescue/rescue-doc +++ /dev/null @@ -1,60 +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 Mandriva 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 Mandriva 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 -<pixel@mandriva.com>. - -For more information on troubleshooting a Mandriva Linux system, -please consult the official manuals, the documentation on -MandrivaLinux.com, MandrivaClub.org, or the MandrivaExpert.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 b31fd112e..000000000 --- a/rescue/restore_ms_boot +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/perl -# -# Guillaume Cottenceau, Pixel -# -# Copyright 2002-2005 Mandriva -# -# 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. -# - -use lib qw(../perl-install /usr/lib/libDrakX); -use common; -use bootloader; -use fs; -use fs::proc_partitions; - - -my @choices = map { - my $type = typeFromMagic(devices::make($_->{dev})); - if_($type && member($type, bootloader::main_method_choices()) , [ $_->{dev}, $type ]); -} fs::proc_partitions::read_raw(); - -my $choice; - -if (!@choices) { - print "No known Linux bootloader has been found, nothing to do.\n"; -} elsif (@choices == 1) { - print "I've found a Linux bootloader only on <$choices[0][0]>.\n\n"; - $choice = $choices[0]; -} else { - print "I've found the following Linux bootloaders:\n", - (map_index { "\t" . $::i . ": <$_->[1]> \ton <$_->[0]>\n" } @choices), - "\n", - "Which disk/partition do you want to overwrite with the Windows bootloader?\n", - "\t<enter the number or press 'n' and Enter to cancel> "; - if (<STDIN> =~ /^(\d+)$/i && $1 >= 1) { - $choice = $choices[$1 - 1]; - } -} - -if ($choice) { - print "I'm going to overwrite bootloader on <$choice->[0]> with -Windows bootloader. - -Ok? <press Enter to continue, 'n' and Enter to cancel> "; - <STDIN> =~ /^n/i and exit 0; - - system('dd', 'if=/usr/lib/extipl/aldebaran.bin', "of=/dev/$choice->[0]") == 0 - or print "\tFailed!\n"; -} - -#------------------------------------------------- -#- $Log$ -#- Revision 1.5 2005/06/13 04:33:50 prigaux -#- move functions using /proc/partitions out of fsedit to fs::proc_partitions -#- -#- Revision 1.4 2005/05/19 08:59:54 prigaux -#- rewrite using DrakX modules -#- -#- Revision 1.3 2005/04/19 12:49:39 prigaux -#- update copyright -#- -#- Revision 1.2 2004/07/20 02:42:12 prigaux -#- MandrakeSoft -> Mandrakesoft -#- -#- 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 49b298142..000000000 --- a/rescue/tree/bin/insmod +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo "Use modprobe instead" 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/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 771d7c0d4..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:/sbin/mingetty --autologin root tty1 -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 f4799bad2..000000000 --- a/rescue/tree/etc/issue +++ /dev/null @@ -1,28 +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;40mMandrakelinux 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 - -DISTRIB_DESCR - -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 -Use [1;33;40mrescue-gui[0m to go back to the rescue menu - 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 3b5ac21cc..000000000 --- a/rescue/tree/etc/profile +++ /dev/null @@ -1,24 +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 - -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 9128ea562..000000000 --- a/rescue/tree/etc/rc.sysinit +++ /dev/null @@ -1,69 +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 "Remounting root filesystem in read-write mode" mount -n -o remount,rw / - -ln -s /tmp/stage2/etc/* /etc 2>/dev/null - -rm -f /dev ; cp -a /tmp/stage2/dev /dev - -mkdir /mnt /var/log - -mkdir /proc -action "Mounting proc filesystem" mount -n -t proc /proc /proc - -if grep -q sysfs /proc/filesystems; then - mkdir /sys - action "Mounting sysfs on /sys" mount -t sysfs none /sys -fi - ->/etc/mtab -mount -f / -mount -f /proc - -#- free up stage1 memory -umount /stage1/proc/bus/usb /stage1/proc /stage1 - -# 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 - -/sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0 -/sbin/route add 127.0.0.1 lo - -grep -q noauto /proc/cmdline || drvinst SERIAL_USB - -if grep ka /proc/cmdline; then - echo Welcome to Ka rescue - drvinst - cd /ka - ./install.sh -fi - -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/ka/gen_modules_conf.pl b/rescue/tree/ka/gen_modules_conf.pl deleted file mode 100644 index ae6c5bec6..000000000 --- a/rescue/tree/ka/gen_modules_conf.pl +++ /dev/null @@ -1,191 +0,0 @@ -$kinds2all_modules = { - 'usb' => [ - 'usb-uhci', - 'usb-ohci', - 'ehci-hcd' - ], - 'network' => [ - '3c501', - '3c503', - '3c505', - '3c507', - '3c509', - '3c515', - '3c90x', - '82596', - 'abyss', - 'ac3200', - 'acenic', - 'aironet4500_card', - 'at1700', - 'atp', - 'com20020-pci', - 'cs89x0', - 'de600', - 'de620', - 'defxx', - 'depca', - 'dgrs', - 'dmfe', - 'e100', - 'e2100', - 'eepro', - 'eepro100', - 'eexpress', - 'epic100', - 'eth16i', - 'ewrk3', - 'hamachi', - 'hp', - 'hp-plus', - 'hp100', - 'ibmtr', - 'lance', - 'natsemi', - 'ne', - 'ne2k-pci', - 'ni5010', - 'ni52', - 'ni65', - 'nvnet', - 'olympic', - 'pcnet32', - 'plip', - 'rcpci', - 'sb1000', - 'sis900', - 'smc-ultra', - 'smc9194', - 'starfire', - 'tlan', - 'tmspci', - 'tulip', - 'via-rhine', - 'wd', - 'winbond-840', - 'forcedeth', - 'fealnx', - '3c990', - '3c990fx', - 'b44', - 'bcm4400', - 'skfp', - 'tc35815', - 'lanstreamer', - 'farsync', - 'sdladrv', - 'prism2_plx', - 'iph5526', - '3c59x', - '8139too', - '8139cp', - 'sundance', - 'catc', - 'CDCEther', - 'kaweth', - 'pegasus', - 'rtl8150', - 'usbnet', - 'dl2k', - 'myri_sbus', - 'yellowfin', - 'ns83820', - 'r8169', - 'tg3', - 'e1000', - 'sk98lin', - 'bcm5820', - 'bcm5700' - ], - 'scsi' => [ - '3w-xxxx', - 'AM53C974', - 'BusLogic', - 'NCR53c406a', - 'a100u2w', - 'advansys', - 'aha152x', - 'aha1542', - 'aha1740', - 'atp870u', - 'dc395x_trm', - 'dtc', - 'g_NCR5380', - 'in2000', - 'initio', - 'pas16', - 'pci2220i', - 'psi240i', - 'fdomain', - 'qla1280', - 'qla2x00', - 'qlogicfas', - 'qlogicfc', - 'seagate', - 'wd7000', - 'sim710', - 'sym53c416', - 't128', - 'tmscsim', - 'u14-34f', - 'ultrastor', - 'eata', - 'eata_pio', - 'eata_dma', - 'mptscsih', - 'nsp32', - 'ata_piix', - 'sata_promise', - 'sata_svw', - 'sata_via', - '53c7,8xx', - 'aic7xxx', - 'aic7xxx_old', - 'aic79xx', - 'pci2000', - 'qlogicisp', - 'sym53c8xx', - 'lpfcdd', - 'DAC960', - 'dpt_i2o', - 'megaraid', - 'aacraid', - 'cciss', - 'cpqarray', - 'gdth', - 'i2o_block', - 'cpqfc', - 'qla2200', - 'qla2300', - 'pdc-ultra', - 'ips', - 'ppa', - 'imm' - ] - }; -my @l = map { /^(\S+)\s*:/ ? $1 : () } `lspcidrake`; - -my %kinds2modules = map { - $_ => [ intersection(\@l, $kinds2all_modules->{$_}) ]; -} qw(usb scsi); - -$kinds2modules{network} = [ - grep { - my $l = $_; - scalar grep { $_ eq $l } @{ $kinds2all_modules->{network} } - } @l -]; - -if (my @scsi = @{$kinds2modules{scsi}}) { - print "probeall scsi_hostadapter ", join(" ", @scsi), "\n"; -} -if (my @usb = @{$kinds2modules{usb}}) { - print "probeall usb-interface ", join(" ", @usb), "\n"; -} -my $eth = 0; -foreach (@{$kinds2modules{network}}) { - print "alias eth$eth $_\n"; - $eth++; -} - -sub intersection { my (%l, @m); @l{@{shift @_}} = (); foreach (@_) { @m = grep { exists $l{$_} } @$_; %l = (); @l{@m} = () } keys %l } diff --git a/rescue/tree/ka/hostnames b/rescue/tree/ka/hostnames deleted file mode 100644 index e30fac24a..000000000 --- a/rescue/tree/ka/hostnames +++ /dev/null @@ -1,225 +0,0 @@ -icluster1 129.88.96.1 -icluster2 129.88.96.2 -icluster3 129.88.96.3 -icluster4 129.88.96.4 -icluster5 129.88.96.51 -icluster6 129.88.96.6 -icluster7 129.88.96.7 -icluster8 129.88.96.8 -icluster9 129.88.96.9 -icluster10 129.88.96.10 -icluster11 129.88.96.11 -icluster12 129.88.96.12 -icluster13 129.88.96.13 -icluster14 129.88.96.14 -icluster15 129.88.96.15 -icluster16 129.88.96.16 -icluster17 129.88.96.17 -icluster18 129.88.96.18 -icluster19 129.88.96.19 -icluster20 129.88.96.20 -icluster21 129.88.96.21 -icluster22 129.88.96.22 -icluster23 129.88.96.23 -icluster24 129.88.96.24 -icluster25 129.88.96.25 -icluster26 129.88.96.26 -icluster27 129.88.96.27 -icluster28 129.88.96.28 -icluster29 129.88.96.29 -icluster30 129.88.96.30 -icluster31 129.88.96.31 -icluster32 129.88.96.32 -icluster33 129.88.96.33 -icluster34 129.88.96.34 -icluster35 129.88.96.35 -icluster36 129.88.96.36 -icluster37 129.88.96.37 -icluster38 129.88.96.38 -icluster39 129.88.96.39 -icluster40 129.88.96.40 -icluster41 129.88.96.41 -icluster42 129.88.96.42 -icluster43 129.88.96.43 -icluster44 129.88.96.44 -icluster45 129.88.96.45 -icluster46 129.88.96.46 -icluster47 129.88.96.47 -icluster48 129.88.96.48 -icluster49 129.88.96.49 -icluster50 129.88.96.50 -icluster51 129.88.96.51 -icluster52 129.88.96.52 -icluster53 129.88.96.53 -icluster54 129.88.96.54 -icluster55 129.88.96.55 -icluster56 129.88.96.56 -icluster57 129.88.96.57 -icluster58 129.88.96.58 -icluster59 129.88.96.59 -icluster60 129.88.96.60 -icluster61 129.88.96.61 -icluster62 129.88.96.62 -icluster63 129.88.96.63 -icluster64 129.88.96.64 -icluster65 129.88.96.65 -icluster66 129.88.96.66 -icluster67 129.88.96.67 -icluster68 129.88.96.68 -icluster69 129.88.96.69 -icluster70 129.88.96.70 -icluster71 129.88.96.71 -icluster72 129.88.96.72 -icluster73 129.88.96.73 -icluster74 129.88.96.74 -icluster75 129.88.96.75 -icluster76 129.88.96.76 -icluster77 129.88.96.77 -icluster78 129.88.96.78 -icluster79 129.88.96.79 -icluster80 129.88.96.80 -icluster81 129.88.96.81 -icluster82 129.88.96.82 -icluster83 129.88.96.83 -icluster84 129.88.96.84 -icluster85 129.88.96.85 -icluster86 129.88.96.86 -icluster87 129.88.96.87 -icluster88 129.88.96.88 -icluster89 129.88.96.89 -icluster90 129.88.96.90 -icluster91 129.88.96.91 -icluster92 129.88.96.92 -icluster93 129.88.96.93 -icluster94 129.88.96.94 -icluster95 129.88.96.95 -icluster96 129.88.96.96 -icluster97 129.88.96.97 -icluster98 129.88.96.98 -icluster99 129.88.96.99 -icluster100 129.88.96.100 -icluster101 129.88.96.101 -icluster102 129.88.96.102 -icluster103 129.88.96.103 -icluster104 129.88.96.104 -icluster105 129.88.96.105 -icluster106 129.88.96.106 -icluster107 129.88.96.107 -icluster108 129.88.96.108 -icluster109 129.88.96.109 -icluster110 129.88.96.110 -icluster111 129.88.96.111 -icluster112 129.88.96.112 -icluster113 129.88.96.113 -icluster114 129.88.96.114 -icluster115 129.88.96.115 -icluster116 129.88.96.116 -icluster117 129.88.96.117 -icluster118 129.88.96.118 -icluster119 129.88.96.119 -icluster120 129.88.96.120 -icluster121 129.88.96.121 -icluster122 129.88.96.122 -icluster123 129.88.96.123 -icluster124 129.88.96.124 -icluster125 129.88.96.125 -icluster126 129.88.96.126 -icluster127 129.88.96.127 -icluster128 129.88.96.128 -icluster129 129.88.96.129 -icluster130 129.88.96.130 -icluster131 129.88.96.131 -icluster132 129.88.96.132 -icluster133 129.88.96.133 -icluster134 129.88.96.134 -icluster135 129.88.96.135 -icluster136 129.88.96.136 -icluster137 129.88.96.137 -icluster138 129.88.96.138 -icluster139 129.88.96.139 -icluster140 129.88.96.140 -icluster141 129.88.96.141 -icluster142 129.88.96.142 -icluster143 129.88.96.143 -icluster144 129.88.96.144 -icluster145 129.88.96.145 -icluster146 129.88.96.146 -icluster147 129.88.96.147 -icluster148 129.88.96.148 -icluster149 129.88.96.149 -icluster150 129.88.96.150 -icluster151 129.88.96.151 -icluster152 129.88.96.152 -icluster153 129.88.96.153 -icluster154 129.88.96.154 -icluster155 129.88.96.155 -icluster156 129.88.96.156 -icluster157 129.88.96.157 -icluster158 129.88.96.158 -icluster159 129.88.96.159 -icluster160 129.88.96.160 -icluster161 129.88.96.161 -icluster162 129.88.96.162 -icluster163 129.88.96.163 -icluster164 129.88.96.164 -icluster165 129.88.96.165 -icluster166 129.88.96.166 -icluster167 129.88.96.167 -icluster168 129.88.96.168 -icluster169 129.88.96.169 -icluster170 129.88.96.170 -icluster171 129.88.96.171 -icluster172 129.88.96.172 -icluster173 129.88.96.173 -icluster174 129.88.96.174 -icluster175 129.88.96.175 -icluster176 129.88.96.176 -icluster177 129.88.96.177 -icluster178 129.88.96.178 -icluster179 129.88.96.179 -icluster180 129.88.96.180 -icluster181 129.88.96.181 -icluster182 129.88.96.182 -icluster183 129.88.96.183 -icluster184 129.88.96.184 -icluster185 129.88.96.185 -icluster186 129.88.96.186 -icluster187 129.88.96.187 -icluster188 129.88.96.188 -icluster189 129.88.96.189 -icluster190 129.88.96.190 -icluster191 129.88.96.191 -icluster192 129.88.96.192 -icluster193 129.88.96.193 -icluster194 129.88.96.194 -icluster195 129.88.96.195 -icluster196 129.88.96.196 -icluster197 129.88.96.197 -icluster198 129.88.96.198 -icluster199 129.88.96.199 -icluster200 129.88.96.200 -icluster201 129.88.96.201 -icluster202 129.88.96.202 -icluster203 129.88.96.203 -icluster204 129.88.96.204 -icluster205 129.88.96.205 -icluster206 129.88.96.206 -icluster207 129.88.96.207 -icluster208 129.88.96.208 -icluster209 129.88.96.209 -icluster210 129.88.96.210 -icluster211 129.88.96.211 -icluster212 129.88.96.212 -icluster213 129.88.96.213 -icluster214 129.88.96.214 -icluster215 129.88.96.215 -icluster216 129.88.96.216 -icluster217 129.88.96.217 -icluster218 129.88.96.218 -icluster219 129.88.96.219 -icluster220 129.88.96.220 -icluster221 129.88.96.221 -icluster222 129.88.96.222 -icluster223 129.88.96.223 -icluster224 129.88.96.224 -icluster225 129.88.96.225 diff --git a/rescue/tree/ka/install.sh b/rescue/tree/ka/install.sh deleted file mode 100755 index ee93c1e19..000000000 --- a/rescue/tree/ka/install.sh +++ /dev/null @@ -1,641 +0,0 @@ -#!/bin/bash - -# this script is run by at startup on the nfs_root system, and runs the ka-deploy client -# it also updates the 'step file' on the tftp server - -# $Revision$ -# $Author$ -# $Date$ -# $Header$ -# $Id$ -# $Log$ -# Revision 1.4 2005/08/28 21:38:32 oblin -# ka support (initially from Antoine Ginies and Erwan Velu) -# -# Revision 1.1.2.5 2003/06/17 06:34:33 erwan -# Removing remaining dchp cache for KA -# -# Revision 1.1.2.4 2003/06/11 18:04:28 erwan -# Fixing mkreiserfs call -# -# Revision 1.1.2.3 2002/11/07 15:10:52 erwan -# SCSI support now activated -# -# Revision 1.1.2.2 2002/11/05 15:49:13 erwan -# added some files -# -# Revision 1.1.2.1 2002/11/05 11:16:54 erwan -# added ka tools in rescue -# -# Revision 1.6 2001/12/03 16:28:02 sderr -# Completely new install script -# -# Revision 1.5 2001/10/10 13:55:04 sderr -# Updates in documentation -# -# Revision 1.4 2001/06/29 09:31:45 sderr -# *** empty log message *** -# -# Revision 1.3 2001/05/31 08:51:43 sderr -# scripts/doc update to match new command-line syntax -# -# Revision 1.2 2001/05/03 12:34:41 sderr -# Added CVS Keywords to most files. Mostly useless. -# -# $State$ - -# This script is provided as an exmaple and should probably not be run as is - - -unset LANG -unset LANGUAGE - -# needed for some for i in foo* loops -shopt -s nullglob - -bash < /dev/tty2 >/dev/tty2 2>&1 & - -# IDEA : maybe this option could be overriden by a kaopt= in the kernel command line ? -KA_SESSION_BASE="-s kainstall" - -ka_call_num=0 - -inc_ka_session() -{ - (( ka_call_num++ )) - cur_ka_session=$KA_SESSION_BASE$ka_call_num -} - - -# testing ? -- NOT FULLY IMPLEMENTED !!!!!!!!!!!!!!!!!!!! -#DONTWRITE=yes -DONTWRITE=no - -# Let's find out what our IP is -ip=`/sbin/ifconfig | grep -v 127.0.0.1 | grep "inet addr" | sed 's/^.*inet addr:\([^ ]*\) .*$/\1/g' | head -n 1` - -# the file tftpserver should contain the name of the .. tftpserver -server=`cat tftpserver` - - -# reverse a file -tac() -{ - awk '{ x[NR] = $0 } END { for (i = NR; i >= 1; i--) print x[i] }' -} - -# run a command, hide its output and print OK if it suceeds, print FAILED and show the output otherwise. -runcom() -{ - echo -n "$1..." 1>&2 - shift; - out=`"$@" 2>&1` - ret=$? - if [ $ret -eq 0 ]; then - echo $C_S"OK"$C_N 1>&2 - else - echo $C_F"Failed"$C_N 1>&2 - echo $C_W"$out"$C_N 1>&2 - fi - return $ret - -} - -# 5 4 3 2 1 zero ignition -countdown() -{ - t=$1 - while [ "$t" -ne 0 ]; do - echo -n "$t " - sleep 1 - # move the cursor back - # I use now tr instead of sed because busybox's sed adds a non-wanted carriage return - # busybox's tr does not seem to know about the [: :] stuff (?) - echo -n "$t " | tr " 0-9" $'\x08' - (( t-- )) - done - # backspace only moves the cursor back, so at this point there's still a "1" to erase - if [ "$1" -ne 0 ] ;then - echo -n " "$'\x08\x08' - fi -} - - -int_shell() -{ - echo $C_H"starting an interactive shell"$C_N - exec /bin/bash -} - -fail() -{ - echo $* - echo $C_F"--- The installation program FAILED ---"$C_N - echo "Check your configuration -- try to read previous error messages" - echo "This machine is going to reboot (Ctrl-S to block it) (Ctrl-C for an interactive shell)" - trap int_shell SIGINT - countdown 30 - do_reboot -} - -do_reboot() -{ - reboot - sleep 1234567 # do not continue the install script (/sbin/reboot does not block) -} - - - -# ahem this LILO function should be fixed someday -# right now this function assumes there is a properly configured lilo on the duplicated linux system -do_lilo() -{ - - -chroot /mnt/disk << EOF -lilo -EOF - - -} - - -run_chroot_command() -{ - - /usr/sbin/chroot /mnt/disk $* - -} - - -log() -{ - echo $* 1>&2 - echo $* >> /tmp/ginstlog -} - -# version for the standard tftp client -std_tftp_put_file() -{ - remotef=$2 - localf=$1 - err=`echo put $localf $remotef | tftp $server 2>&1` - err=`echo $err | grep Sent` - if [ -z "$err" ]; then - log tftp error: could not get/put file - return 1 - fi - return 0 -} - -# version for the tftp client built in busybox -busybox_tftp_put_file() -{ - remotef=$2 - localf=$1 - err=`tftp -p -l $localf -r $remotef $server 2>&1` - if [ $? -ne 0 ]; then - log tftp error: could not get/put file $err - return 1 - fi - return 0 -} - - -busybox_tftp_get_file() -{ - remotef=$1 - localf=$2 - err=`tftp -g -l $localf -r $remotef $server 2>&1` - if [ $? -ne 0 ]; then - log tftp error: could not get/put file $err - return 1 - fi - return 0 -} - - -std_tftp_get_file() -{ - remotef=$1 - localf=$2 - err=`echo get $remotef $localf | tftp $server 2>&1` - err=`echo $err | grep Received` - if [ -z "$err" ]; then - echo tftp error: could not get/put file - return 1 - fi - return 0 -} - -tftp_get_file() -{ - busybox_tftp_get_file "$@" -} - -tftp_put_file() -{ - busybox_tftp_put_file "$@" -} - -# write a string ($2) in a remote file ($1) -tftp_put_in() -{ - echo "$2" > $temp - err=`echo put $temp "$1" | tftp $server 2>&1` - rm -f $temp - err=`echo $err | grep Sent` - if [ -z "$err" ]; then - log tftp error: could not get/put file - return 1 - fi - return 0 -} - -get_var_bis() -{ - while read a; do - echo "$a" | grep -s -q "^ *#.*" - if [ $? -eq 0 ]; then - continue - fi - val=`echo "$a" | sed 's/[^"]*"\(.*[^\\]\)".*/\1/'` - var=`echo "$a" | sed 's/[^"]*".*[^\\]" *\$\([^ ]*\)/\1/'` - if [ "$var" = "$1" ]; then - echo $val - return 0 - fi - done - return 1 -} - -# fetch variable $2 from file $1 -get_var() -{ - (cat $1; echo) | get_var_bis $2 -} - -# find the current step in the kernel command line -get_step() -{ - step=install -# step=`cat /proc/cmdline | sed 's/.*kastep=\([^ ]*\).*/\1/'` - if [ "$step" ]; then - echo $step > /tmp/step - return 0 - fi - return 1 -} - - -# write a new file on the tftp server -# this file is a pxelinux config file -# do this by getting the 'template file' and adding a DEFAULT at the beginning -set_step() -{ - step=$1 - - - runcom "Getting template file" tftp_get_file "ka/pxelinux.cfg/template" /tmp/template || return 1 - - echo DEFAULT $step > /tmp/newcfg - cat /tmp/template >> /tmp/newcfg - - runcom "Sending back new pxelinux config file" tftp_put_file /tmp/newcfg "ka/pxelinux.cfg/IP/$ip" || return 1 - - return 0 -} - - - -# the mount_partition calls must be done in the same shell (NOT a subshell) because the global variable below has to be updated -# idea : maybe use a file instead of this variable (and since the tac function now exists, why not ?) -mounted_fs="" - -# mount a partition UNDER /disk !!! (/disk is prepended to $2) -mount_partition() -{ - dev=$1 - point=$2 - - echo -n "Mounting $C_H$1$C_N as /mnt/disk$C_H$point$C_N" - mkdir -p /mnt/disk$point - test -d /mnt/disk$point || return 1 - runcom "..." mount $dev /mnt/disk/$point || return 1 - mounted_fs="$dev $mounted_fs" - return 0 -} - -# umount all mounted partitions under /disk, in the reverse order -umount_partitions() -{ - for dev in $mounted_fs; do - retries=0 - while ! runcom "Umounting $dev" umount $dev ; do - sleep 3 - (( retries++ )) - if [ $retries -gt 3 ]; then - echo Failed too many times. giving up. - break - fi - done - done -} - - -# recreate excluded directories -# read stdin like this : u=rwx g=rwx o=rwx uid gid filename -recreate_dirs() -{ - while read line; do - declare -a fields - fields=( $line ) - file=/mnt/disk/${fields[5]} -# echo $file -# note : it is possible that the directory exists already, if it was a mount point -# we need to set the permissions/users anyway - mkdir -p $file -# echo chmod ${fields[0]},${fields[1]},${fields[2]} $file - chmod ${fields[0]},${fields[1]},${fields[2]} $file - # argl !! chmod o+t does not work with busybox's chmod ! - # we have to handle it alone - if echo ${fields[2]} | grep -q t; then - chmod +t $file - fi - chown ${fields[3]}.${fields[4]} $file - done -} - -make_partitions() -{ - # we must be in the partfiles directory - for file in partition_tab*; do - drive=`echo $file | sed 's/partition_tab//'` - cat $file | runcom "Writing partition table for $drive using sfdisk" /sbin/sfdisk /dev/$drive -uS --force || fail "error with sfdisk" - done - - for file in fdisk_commands*; do - drive=`echo $file | sed 's/fdisk_commands//'` - runcom "Cleaning hard drive" dd if=/dev/zero of=/dev/$drive bs=1M count=5 || fail "Can t clean drive$drive" - cat $file | runcom "Writing partition table for $drive using fdisk" fdisk /dev/$drive || fail "error with fdisk" - done - -} -checkDevEntries() -{ - if ! test -r /mnt/disk/dev/hda ; then - (cd /dev && tar c *) | (cd /mnt/disk/dev && tar x) - fi -} - -write_MBRs() -{ -# we must be in the partfiles directory also - for file in MBR*; do - drive=`echo $file | sed 's/MBR//'` - runcom "Writing new MBR for $drive" dd if=$file of=/dev/$drive bs=1 count=446 - done -} - - -# Colors -# Success -C_S=$'\033[1;32m' -# Failure -C_F=$'\033[1;31m' -# Warning -C_W=$'\033[1;33m' -# Normal -C_N=$'\033[0;39m' -# Hilight -C_H=$'\033[1;39m' - - -# Clear screen, fancy startup message. -echo $'\033'[2J$'\033'[H -echo "------| $C_H"Ka"$C_N |---- Install starting..." - -temp=/tmp/ginst - -# activate dma ? -- obsolete stuff I think -# runcom "Setting HD optimizations" hdparm -c1 -d1 -K1 $HD - -delay=0 - -if ! runcom "Getting step name" get_step; then - echo "Error: Could not get current step " - fail -else - step=`cat /tmp/step` -fi - -echo Next Server is `cat /ka/tftpserver` - -echo Current step for $ip is : \"$C_H$step$C_N\" - -echo -n "Finding install type : " -case $step in - shell) - echo No install, but interactive shell - ## drop the user to an interactive shell - exec /bin/bash - ;; - install) - install_type=install - nextstep=ready - echo Install Linux - ;; - test_install) - install_type=test_install - nextstep=ready - echo TEST TEST TEST - countdown 10 - echo Install Linux TEST - ;; -esac - - -if [ -z "$install_type" ]; then - echo FATAL : Could not recognize this step name - echo "Aborting... " - fail -fi - - - -# receive the partition table, fstab, etc from the source node -mkdir /tmp/partfiles -inc_ka_session -echo Current session is $cur_ka_session -runcom "Receiving partitions information" /ka/ka-d-client -w $cur_ka_session -e "( cd /tmp/partfiles && tar xvf - )" || fail - - - - -cd /tmp/partfiles -make_partitions - - -test -f /tmp/partfiles/streams || fail "Missing streams file" -first_stream=`cat /tmp/partfiles/streams | head -n 1` - -if [ "$first_stream" = linux ]; then - rcv_linux=yes -else - rcv_linux=no -fi - - - -#if we must receive a linux system, we need to format and mount the partitions -if [ $rcv_linux = yes ]; then - # format partitions - format_partitions() - { - while read line; do - declare -a fields - fields=( $line ) - - case ${fields[2]} in - reiserfs ) - runcom "Formatting ${fields[0]} as reiserfs" mkreiserfs -f ${fields[0]} || fail - ;; - jfs ) - runcom "Formatting ${fields[0]} as jfs" mkfs.jfs ${fields[0]} || fail - ;; - - xfs ) - runcom "Formatting ${fields[0]} as xfs" mkfs.xfs -f ${fields[0]} || fail - ;; - ext3 ) - runcom "Formatting ${fields[0]} as ext3" mkfs.ext2 -j ${fields[0]} || fail - ;; - ext2 ) - runcom "Formatting ${fields[0]} as ext2" mkfs.ext2 ${fields[0]} || fail - ;; - swap ) - runcom "Formatting ${fields[0]} as swap" mkswap ${fields[0]} || fail - ;; - esac - done - } - - format_partitions < /tmp/partfiles/pfstab - - - # mount the partitions - - mount_partitions() - { - while read line; do - declare -a fields - fields=( $line ) - - case ${fields[2]} in - reiserfs ) - mount_partition ${fields[0]} ${fields[1]} || fail - ;; - xfs ) - mount_partition ${fields[0]} ${fields[1]} || fail - ;; - jfs ) - mount_partition ${fields[0]} ${fields[1]} || fail - ;; - ext3 ) - mount_partition ${fields[0]} ${fields[1]} || fail - ;; - ext2 ) - mount_partition ${fields[0]} ${fields[1]} || fail - ;; - esac - done - } - - # NOTE - # I replaced cat truc | mount_partitions by mount_partitions < truc - # because in the former case mount_partitions runs in a subshell and the $mounted_fs value is lost - mount_partitions < /tmp/partfiles/pfstab - - echo ++++++++++++++++++++++++++ - mount - echo ++++++++++++++++++++++++++ - - delay=0 -else - delay=10 -fi - -if [ $DONTWRITE != yes ]; then - for stream in `cat /tmp/partfiles/streams`; do - if [ "$stream" = "linux" ]; then - # partitions already formatted/mounted, just copy now - # untar data from the master 'on the fly' - echo -n "Linux copy is about to start " - countdown $delay - echo - inc_ka_session - /ka/ka-d-client -w $cur_ka_session -e "(cd /mnt/disk; tar --extract --read-full-records --same-permissions --numeric-owner --sparse --file - ) 2>/dev/null" || fail - - runcom "Syncing disks" sync - echo Linux copy done. - echo Creating excluded directories - cat /tmp/partfiles/excluded | recreate_dirs - #echo Setting up networking - #/ka/setup_network.sh - #delay=10 - else - # maybe receive some raw partition dumps - echo Raw copy of $stream is about to start - countdown $delay - inc_ka_session - /ka/ka-d-client -w $cur_ka_session -e "dd of=$stream bs=65536" || fail - delay=10 - fi - done - - echo "Removing computing interfaces" - rm -f /mnt/disk/etc/sysconfig/network-scripts/ifcfg-eth1 >/dev/null 2>&1 - - echo "Removing duplicated dhcp cache" - rm -f /mnt/disk/etc/dhcpc/* >/dev/null 2>&1 - - echo "Writing modules.conf" - /usr/bin/perl /ka/gen_modules_conf.pl >/mnt/disk/etc/modules.conf - - echo "Writing modprobe.conf" - chroot /mnt/disk/ /sbin/generate-modprobe.conf >/mnt/disk/etc/modprobe.conf - - echo "Running mkinitrd" - /ka/make_initrd - - cd /tmp/partfiles - write_MBRs - - - if test -f /tmp/partfiles/command; then - checkDevEntries - command_to_run=`cat /tmp/partfiles/command` - runcom "Running $command_to_run" run_chroot_command "$command_to_run" - fi - -else - echo " I would run ka-deploy(s) and then lilo/mbr " - sleep 1 -fi - -# maybe there is a last dummy ka-deploy for synchronization -if test -f /tmp/partfiles/delay; then - sleep 1 - inc_ka_session - runcom "Waiting source node signal to end installation" /ka/ka-d-client -w $cur_ka_session -e "cat" || fail -fi - -umount_partitions - - -# Update the step file on the tftp server -#runcom 'Sending back new $step' set_step $nextstep || fail - -echo -n Rebooting... -countdown 3 -do_reboot diff --git a/rescue/tree/ka/ka-d-client b/rescue/tree/ka/ka-d-client Binary files differdeleted file mode 100755 index 1ae4fa703..000000000 --- a/rescue/tree/ka/ka-d-client +++ /dev/null diff --git a/rescue/tree/ka/make_initrd b/rescue/tree/ka/make_initrd deleted file mode 100755 index 8f8a0492d..000000000 --- a/rescue/tree/ka/make_initrd +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -echo Looking for default kernel -CHROOT=/mnt/disk -IMG=`cat $CHROOT/etc/lilo.conf | grep default | cut -d "=" -f 2 | sed -e 's/\"//g'` -KERN="x" -INITRD="" -LABEL="x" - -modprobe loop - -for i in `cat $CHROOT/etc/lilo.conf`; do - - if echo $i | grep image >/dev/null; then - KERN=$CHROOT`echo $i | cut -d "=" -f 2` - INITRD="" - LABEL="x" - fi - if echo $i | grep label >/dev/null; then - LABEL=`echo $i | cut -d "=" -f 2 | sed -e 's/\"//g'` - fi - if echo $i | grep initrd >/dev/null; then - INITRD=`echo $i | cut -d "=" -f 2` - fi - if [ ${LABEL} == ${IMG} ] && [ ! -z ${INITRD} ]; then - echo "Kernel name is $KERN" - echo "Initrd name is $INITRD" - KERN_VERSION=`/usr/bin/strings $KERN | grep "^2\.[2.6]"| cut -d " " -f 1` - if [ -z $KERN_VERSION ]; then - echo "No kernel version found !" - fi - chroot $CHROOT mount /proc - mount /dev/ $CHROOT/dev -o bind -# chroot $CHROOT MAKEDEV loop -# chroot $CHROOT MAKEDEV fd -# chroot $CHROOT MAKEDEV hd -# chroot $CHROOT MAKEDEV sd -# chroot $CHROOT MAKEDEV md -# chroot $CHROOT MAKEDEV zero - chroot $CHROOT /sbin/mkinitrd -f $INITRD $KERN_VERSION - umount $CHROOT/dev - chroot $CHROOT umount /proc - exit - fi -done diff --git a/rescue/tree/ka/setup_network.sh b/rescue/tree/ka/setup_network.sh deleted file mode 100755 index 9ef6992bd..000000000 --- a/rescue/tree/ka/setup_network.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -# this script setups the network on the cloned system -# puts a correct hostname -# changes the IP if static -- for only ONE device (dunno what will happen with multiple NICs) -# needs the file /ka/hostnames - - -curdir=`pwd` - - -ip=`/sbin/ifconfig | /bin/grep -v 127.0.0.1 | /bin/grep "inet addr" | /bin/sed 's/^.*inet addr:\([^ ]*\) .*$/\1/g'` -oldip=$ip -ip=`echo $ip | sed -e 's/\./_/g'` -echo -n "Setting hostname: " -/bin/hostname $ip - - -# current hostname has been set up in rc.sysinit -ip=$oldip -echo My IP is $ip -cd /ka - -# the sed command will remove unwanted spaces -########################## -# HOSTNMAE already set on NODE -############################ -#if test -f hostnames ; then -# myname=`/bin/cat hostnames | /bin/sed -e 's/ / /g' -e 's/ *$//' | /bin/grep " $ip\$" | /bin/cut -d ' ' -f 1` -# nbfound=`echo "$myname" |/usr/bin/wc -l` -#fi## -# -#if [ $nbfound -ne 1 ] || [ -z "$myname" ]; then -# # try DNS -# echo IP not found in /ka/hostnames, Trying DNS -# myname=`/usr/bin/host $ip | /bin/grep "domain name" | /bin/cut -d " " -f 5 | /bin/sed 's/\.$//g' ` -# myname=`nslookup $ip | grep ^Name: | tail -n +2 | head -n 1 | sed 's/Name: *//'` -#fi -# -#if [ -z "$myname" ]; then -# myname=`/bin/hostname` -# echo WARNING:HOSTNAME NOT FOUND -#fi -# -#echo My hostname is $myname - -# change hostname in the network file -#old=/mnt/disk/etc/sysconfig/network.beforeka -#new=/mnt/disk/etc/sysconfig/network - -#rm -f "$old" -#mv "$new" "$old" -#/bin/cat "$old" | /bin/grep -v ^HOSTNAME= > "$new" -#echo "HOSTNAME=$myname" >> "$new" -###################### -## -###################### - - - - -# assume first NIC is the gatewaydev (right ? wrong ?) -#firstnic=`grep ^GATEWAYDEV "$new" | cut -d = -f 2 | tr -d \"` -#echo GATEWAYDEV=$firstnic - -# see if IP has to be written -#proto=`grep ^BOOTPROTO /mnt/disk/etc/sysconfig/network-scripts/ifcfg-$firstnic | cut -d = -f 2 | tr -d \"` -#echo PROTO=$proto -#if [ "$proto" != "dhcp" ]; then -# # proto is static, write the new IP in the config file -# old=/mnt/disk/etc/sysconfig/network-scripts/ifcfg-$firstnic.beforeka -# new=/mnt/disk/etc/sysconfig/network-scripts/ifcfg-$firstnic -# -# rm -f "$old" -# mv "$new" "$old" -# cat "$old" | grep -v ^IPADDR= > "$new" -# echo IPADDR=$ip >> "$new" -#fi - -cd $curdir diff --git a/rescue/tree/ka/tftpserver b/rescue/tree/ka/tftpserver deleted file mode 100644 index deed6748f..000000000 --- a/rescue/tree/ka/tftpserver +++ /dev/null @@ -1 +0,0 @@ -192.168.200.10 diff --git a/rescue/tree/sbin/fakeshutdown b/rescue/tree/sbin/fakeshutdown deleted file mode 100755 index 3511020ff..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 774101d7c..000000000 --- a/rescue/tree/sbin/modprobe +++ /dev/null @@ -1,56 +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; - } -} - -my $module_extension = cat_('/proc/version') =~ /^Linux version 2.4/ ? '.o' : '.ko'; - -my %mappings = ("usb-ohci" => "ohci-hcd", - "usb-uhci" => "uhci-hcd", - "uhci" => "uhci-hcd", - "printer" => "usblp", - "bcm4400" => "b44", - "3c559" => "3c359", - "3c90x" => "3c59x", - "dc395x_trm" => "dc395x", - "audigy" => "snd-emu10k1"); - -sub load { - my ($name, @options) = @_; - $name =~ s/\.k?o$//; - - $name = $mappings{$name} || $name; #- 2.4 -> 2.6 compat mappings - - $conf{$name}{loaded} and return; - eval { load($_, 'prereq') } foreach @{$deps{$name}}; - - system("packdrake -x /modules/modules.cz* /tmp $name$module_extension"); - -r "/tmp/$name$module_extension" or die "can't find module $name\n"; - system("/sbin/insmod /tmp/$name$module_extension"); - my $retval = $?; - system("rm /tmp/$name$module_extension"); - $retval and die("insmod $name failed"); -} - -!@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 diff --git a/rescue/tree/usr/share/symlinks b/rescue/tree/usr/share/symlinks deleted file mode 100644 index 1c34ff204..000000000 --- a/rescue/tree/usr/share/symlinks +++ /dev/null @@ -1,11 +0,0 @@ -/bin -/boot -/dev -/etc/fstab -/etc/inittab -/etc/rc.sysinit -/lib -/lib64 -/modules -/sbin -/usr |