diff options
-rw-r--r-- | rescue/tree/ka/gen_modules_conf.pl | 150 | ||||
-rwxr-xr-x | rescue/tree/ka/install.sh | 17 | ||||
-rwxr-xr-x | rescue/tree/ka/make_initrd | 29 | ||||
-rwxr-xr-x | rescue/tree/ka/setup_network.sh | 10 |
4 files changed, 198 insertions, 8 deletions
diff --git a/rescue/tree/ka/gen_modules_conf.pl b/rescue/tree/ka/gen_modules_conf.pl new file mode 100644 index 000000000..e45b6e65b --- /dev/null +++ b/rescue/tree/ka/gen_modules_conf.pl @@ -0,0 +1,150 @@ +$kinds2all_modules = { + 'network' => [ + '3c501', + '3c503', + '3c505', + '3c507', + '3c509', + '3c515', + '82596', + 'abyss', + 'ac3200', + 'acenic', + 'aironet4500_card', + 'at1700', + 'atp', + 'com20020-pci', + 'cs89x0', + 'de600', + 'de620', + 'r8169', + 'defxx', + 'orinoco_plx', + 'depca', + 'dgrs', + 'dmfe', + 'e100', + 'e1000', + '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', + 'sk98lin', + 'smc-ultra', + 'smc9194', + 'starfire', + 'tg3', + 'tlan', + 'tmspci', + 'tulip', + 'via-rhine', + 'wd', + 'winbond-840', + 'yellowfin', + 'ns83820', + 'iph5526', + '3c59x', + '8139too', + 'sundance', + 'dl2k', + 'pegasus', + 'kaweth', + 'usbnet', + 'catc', + 'CDCEther' + ], + 'scsi' => [ + '3w-xxxx', + 'AM53C974', + 'BusLogic', + 'NCR53c406a', + 'a100u2w', + 'advansys', + 'aha152x', + 'aha1542', + 'aha1740', + 'atp870u', + 'dc395x_trm', + 'dtc', + 'fdomain', + 'g_NCR5380', + 'in2000', + 'initio', + 'pas16', + 'pci2220i', + 'psi240i', + 'qla1280', + 'qla2x00', + 'qlogicfas', + 'qlogicfc', + 'seagate', + 'sim710', + 'sym53c416', + 't128', + 'tmscsim', + 'u14-34f', + 'ultrastor', + 'wd7000', + 'eata', + 'eata_pio', + 'eata_dma', + '53c7,8xx', + 'aic7xxx', + 'pci2000', + 'qlogicisp', + 'sym53c8xx', + 'DAC960', + 'dpt_i2o', + 'megaraid', + 'aacraid', + 'ataraid', + 'cciss', + 'cpqarray', + 'gdth', + 'i2o_block', + 'qla2200', + 'qla2300', + 'cpqfc', + 'ips', + 'ppa', + 'imm' + ] + }; +my @l = map { /^(\S+)\s*:/ ? $1 : () } `lspcidrake`; + +my %kinds2modules = map { + $_ => [ intersection(\@l, $kinds2all_modules->{$_}) ]; +} keys %$kinds2all_modules; + +if (my @scsi = @{$kinds2modules{scsi}}) { + print "probeall scsi_hostadapter ", join(" ", @scsi), "\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/install.sh b/rescue/tree/ka/install.sh index d1a660630..1e9c17c6d 100755 --- a/rescue/tree/ka/install.sh +++ b/rescue/tree/ka/install.sh @@ -9,6 +9,9 @@ # $Header$ # $Id$ # $Log$ +# 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 # @@ -481,12 +484,15 @@ if [ $rcv_linux = yes ]; then fields=( $line ) case ${fields[2]} in + reiserfs ) + runcom "Formatting ${fields[0]} as reiserfs" mkfs.reiserfs -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 ${fields[0]} || fail + 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 @@ -513,6 +519,9 @@ if [ $rcv_linux = yes ]; then fields=( $line ) case ${fields[2]} in + reiserfs ) + mount_partition ${fields[0]} ${fields[1]} || fail + ;; xfs ) mount_partition ${fields[0]} ${fields[1]} || fail ;; @@ -584,9 +593,11 @@ else sleep 1 fi - +echo "Writing modules.conf" +/usr/bin/perl /ka/gen_modules_conf.pl >/mnt/disk/etc/modules.conf runcom "Syncing disks" sync - +echo "Running mkinitrd" +/ka/make_initrd umount_partitions # maybe there is a last dummy ka-deploy for synchronization diff --git a/rescue/tree/ka/make_initrd b/rescue/tree/ka/make_initrd new file mode 100755 index 000000000..84425d77c --- /dev/null +++ b/rescue/tree/ka/make_initrd @@ -0,0 +1,29 @@ +#!/bin/bash +echo Looking for default kernel +IMG=`cat /etc/lilo.conf | grep default | cut -d "=" -f 2` +KERN="x" +INITRD="" +LABEL="x" +for i in `cat /etc/lilo.conf`; do +if echo $i | grep image >/dev/null; then + KERN=`echo $i | cut -d "=" -f 2` +fi +if echo $i | grep label >/dev/null; then + LABEL=`echo $i | cut -d "=" -f 2` +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=`strings $KERN | grep "^2\.[2.4]"| cut -d " " -f 1` + if [ -z $KERN_VERSION ]; then + echo "No kernel version found !" + read + fi + echo Running mkinitrd -f $INITRD $KERN_VERSION + exit +fi +done diff --git a/rescue/tree/ka/setup_network.sh b/rescue/tree/ka/setup_network.sh index 718e065f9..347f89f45 100755 --- a/rescue/tree/ka/setup_network.sh +++ b/rescue/tree/ka/setup_network.sh @@ -36,8 +36,8 @@ fi echo My hostname is $myname # change hostname in the network file -old=/disk/etc/sysconfig/network.beforeka -new=/disk/etc/sysconfig/network +old=/mnt/disk/etc/sysconfig/network.beforeka +new=/mnt/disk/etc/sysconfig/network rm -f "$old" mv "$new" "$old" @@ -49,12 +49,12 @@ firstnic=`grep ^GATEWAYDEV "$new" | cut -d = -f 2 | tr -d \"` echo GATEWAYDEV=$firstnic # see if IP has to be written -proto=`grep ^BOOTPROTO /disk/etc/sysconfig/network-scripts/ifcfg-$firstnic | cut -d = -f 2 | tr -d \"` +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=/disk/etc/sysconfig/network-scripts/ifcfg-$firstnic.beforeka - new=/disk/etc/sysconfig/network-scripts/ifcfg-$firstnic + 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" |