summaryrefslogtreecommitdiffstats
path: root/rescue/tree/ka
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2004-04-02 14:03:41 +0000
committerAntoine Ginies <aginies@mandriva.com>2004-04-02 14:03:41 +0000
commit54ddee710c26cb9c11f20cf6ae066c017139615b (patch)
tree3a2237158024ee35cf5b80fecc0eb9720452f331 /rescue/tree/ka
parentb48a5f4ad711f389f0613a754454b683a1220708 (diff)
downloaddrakx-54ddee710c26cb9c11f20cf6ae066c017139615b.tar
drakx-54ddee710c26cb9c11f20cf6ae066c017139615b.tar.gz
drakx-54ddee710c26cb9c11f20cf6ae066c017139615b.tar.bz2
drakx-54ddee710c26cb9c11f20cf6ae066c017139615b.tar.xz
drakx-54ddee710c26cb9c11f20cf6ae066c017139615b.zip
first relsease
Diffstat (limited to 'rescue/tree/ka')
-rw-r--r--rescue/tree/ka/gen_modules_conf.pl156
-rw-r--r--rescue/tree/ka/hostnames225
-rwxr-xr-xrescue/tree/ka/install.sh595
-rwxr-xr-xrescue/tree/ka/ka-d-clientbin0 -> 17048 bytes
-rwxr-xr-xrescue/tree/ka/make_initrd49
-rwxr-xr-xrescue/tree/ka/setup_network.sh65
-rw-r--r--rescue/tree/ka/tftpserver1
7 files changed, 1091 insertions, 0 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..ca721482a
--- /dev/null
+++ b/rescue/tree/ka/gen_modules_conf.pl
@@ -0,0 +1,156 @@
+$kinds2all_modules = {
+ 'usb' => [
+ 'usb-uhci',
+ 'usb-ohci',
+ 'ehci-hcd'
+ ],
+ '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',
+ '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',
+ 'tlan',
+ 'tmspci',
+ 'tulip',
+ 'via-rhine',
+ 'tg3',
+ 'bcm5700',
+ 'bcm5820',
+ 'bcm4400',
+ 'crc32',
+ 'wd',
+ 'winbond-840',
+ 'yellowfin',
+ 'ns83820',
+ 'iph5526',
+ '3c59x',
+ '8139too',
+ 'sundance',
+ 'dl2k',
+ 'pegasus',
+ 'kaweth',
+ 'usbnet',
+ 'catc',
+ 'CDCEther'
+ ],
+ 'scsi' => [
+ '3w-xxxx',
+ 'AM53C974',
+ 'NCR53c406a',
+ 'a100u2w',
+ 'advansys',
+ 'aha1740',
+ 'atp870u',
+ 'dc395x_trm',
+ 'dtc',
+ 'fdomain',
+ 'g_NCR5380',
+ 'in2000',
+ 'initio',
+ 'pas16',
+ 'pci2220i',
+ 'psi240i',
+ 'qla1280',
+ 'qla2x00',
+ 'qlogicfas',
+ 'qlogicfc',
+ 'seagate',
+ 'sym53c416',
+ 'u14-34f',
+ 'ultrastor',
+ 'eata',
+ 'eata_pio',
+ 'eata_dma',
+ '53c7,8xx',
+ 'aic7xxx',
+ 'pci2000',
+ 'qlogicisp',
+ 'sym53c8xx',
+ 'mptscsih',
+ 'mptbase',
+ '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";
+}
+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
new file mode 100644
index 000000000..e30fac24a
--- /dev/null
+++ b/rescue/tree/ka/hostnames
@@ -0,0 +1,225 @@
+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
new file mode 100755
index 000000000..efc8169b8
--- /dev/null
+++ b/rescue/tree/ka/install.sh
@@ -0,0 +1,595 @@
+#!/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.2 2004/04/02 14:03:41 aginies
+# first relsease
+#
+# 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 /disk << EOF
+lilo
+EOF
+
+
+}
+
+
+run_chroot_command()
+{
+
+ chroot /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 /disk$C_H$point$C_N"
+ mkdir -p /disk$point
+ test -d /disk$point || return 1
+ runcom "..." mount $dev /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=/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//'`
+ cat $file | runcom "Writing partition table for $drive using fdisk" fdisk /dev/$drive || fail "error with fdisk"
+ done
+
+}
+checkDevEntries()
+{
+ if ! test -r /disk/dev/hda ; then
+ (cd /dev && tar c *) | (cd /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
+
+ ext3 )
+ runcom "Formatting ${fields[0]} as ext3" mke2fs -j ${fields[0]} || fail
+ ;;
+ ext2 )
+ runcom "Formatting ${fields[0]} as ext2" mke2fs ${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
+ ext3 )
+ insmod /modules/jbd.o
+ insmod /modules/ext3.o
+ 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 /disk; tar --extract --read-full-records --same-permissions --numeric-owner --sparse --file - )" || fail
+ 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
+
+ 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
+
+
+runcom "Syncing disks" sync
+
+umount_partitions
+
+# 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
+
+
+# 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
new file mode 100755
index 000000000..c1dd2c610
--- /dev/null
+++ b/rescue/tree/ka/ka-d-client
Binary files differ
diff --git a/rescue/tree/ka/make_initrd b/rescue/tree/ka/make_initrd
new file mode 100755
index 000000000..d6f15a951
--- /dev/null
+++ b/rescue/tree/ka/make_initrd
@@ -0,0 +1,49 @@
+#!/bin/bash
+echo Looking for default kernel
+CHROOT=/mnt/disk
+IMG=`cat $CHROOT/etc/lilo.conf | grep default | cut -d "=" -f 2`
+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`
+ 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
+
+ chroot $CHROOT mount /proc
+ 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 mkinitrd -f $INITRD $KERN_VERSION
+ chroot $CHROOT umount /proc
+
+ exit
+ fi
+done
diff --git a/rescue/tree/ka/setup_network.sh b/rescue/tree/ka/setup_network.sh
new file mode 100755
index 000000000..718e065f9
--- /dev/null
+++ b/rescue/tree/ka/setup_network.sh
@@ -0,0 +1,65 @@
+#!/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`
+
+
+# current hostname has been set up in rc.sysinit
+ip=`hostname | tr _ .`
+
+echo My IP is $ip
+cd /ka
+
+# the sed command will remove unwanted spaces
+if test -f hostnames ; then
+ myname=`cat hostnames | sed -e 's/ / /g' -e 's/ *$//' | grep " $ip\$" | cut -d ' ' -f 1`
+ nbfound=`echo "$myname" | wc -l`
+fi
+
+if [ $nbfound -ne 1 ] || [ -z "$myname" ]; then
+ # try DNS
+ echo IP not found in /ka/hostnames, Trying DNS
+ myname=`host $ip | grep "domain name" | cut -d " " -f 5`
+# myname=`nslookup $ip | grep ^Name: | tail -n +2 | head -n 1 | sed 's/Name: *//'`
+fi
+
+if [ -z "$myname" ]; then
+ myname=`hostname`
+ echo WARNING:HOSTNAME NOT FOUND
+fi
+
+echo My hostname is $myname
+
+# change hostname in the network file
+old=/disk/etc/sysconfig/network.beforeka
+new=/disk/etc/sysconfig/network
+
+rm -f "$old"
+mv "$new" "$old"
+cat "$old" | 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 /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
+
+ 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
new file mode 100644
index 000000000..deed6748f
--- /dev/null
+++ b/rescue/tree/ka/tftpserver
@@ -0,0 +1 @@
+192.168.200.10