1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
#! /bin/sh
#
# Copyright (C) 2000,2001,2002 by
# Bernhard Rosenkraenzer <bero@redhat.com>
# Oliver Paukstadt <opaukstadt@millenux.com>
# Karsten Hopp <karsten@redhat.de>
# Florian La Roche <laroche@redhat.com>
# Nils Philippsen <nils@redhat.de>
# Helge Deller <hdeller@redhat.de>
# David Sainty <dsainty@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
VERSION=1.01
export TEXTDOMAIN=s390installer
export TEXTDOMAINDIR=/usr/lib/locale
debugshell()
{
echo $"You have defined DEBUG, so here is a shell. You can use 'exit'"
echo $"to go on with the normal installation process."
/bin/sh
}
startinetd()
{
echo
echo $"Starting telnetd and sshd to allow login over the network."
echo $"Welcome to the Red Hat Linux install environment $VERSION for $S390ARCH" > /etc/issue.net
echo $"Welcome to the Red Hat Linux install environment $VERSION for $S390ARCH" > /etc/motd
echo >> /etc/motd
echo $"Now run 'loader' to install Red Hat Linux." >> /etc/motd
echo >> /etc/motd
/sbin/xinetd -stayalive -reuse -pidfile /tmp/xinetd.pid
/sbin/sshd
while : ; do
echo
echo $"Please connect now to $IPADDR and start 'loader' from this shell."
ls -l /bin/sh | grep -q bash && /bin/sh --login || /bin/sh -l
done
}
S390ARCH=`uname -m`
if [ "$S390ARCH" = "s390" ]; then
export S390ARCH="S/390"
else
export S390ARCH="zSeries"
fi
echo $"Starting the $S390ARCH initrd to configure networking. Version is $VERSION"
# set up env vars as we do in init.c
if [ `uname -m` = "s390x" ]; then
LD_LIBRARY_PATH=/lib64:/usr/lib64:/usr/X11R6/lib64:/usr/kerberos/lib64:/lib:/usr/lib:/usr/X11R6/lib:/usr/kerberos/lib
else
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib:/usr/kerberos/lib
fi
export LD_LIBRARY_PATH
PATH="PATH=/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin:/mnt/sysimage/usr/sbin:/mnt/sysimage/sbin:/mnt/sysimage/usr/X11R6/bin"
export PATH
HOME=/
export HOME
PYTHONPATH=/tmp/updates
export PYTHONPATH
# limit output on x3270 console
mount -t proc none /proc
mount -t devpts /dev/pts /dev/pts
echo "1 4 1 1" > /proc/sys/kernel/printk
mkdir /OCO
mount -t ext2 /dev/ram /OCO >/dev/null 2>&1
# if there is no second initrd, remove mountpoint because
# anaconda checks for its existance:
if [ "$?" != "0" ]; then
rm -rf /OCO 2>/dev/null
fi
ifconfig lo 127.0.0.1 netmask 255.0.0.0
route add -host 127.0.0.1 dev lo 2>/dev/null
[ -n "$DEBUG" ] && debugshell
LO=""
[ -L /sbin/insmod ] && LO=".o"
# read in configuration as set by the parm file
if [ -n "$HOST" ]; then
set -- `echo $HOST |sed 's/:/ /g'`
HOSTNAME=$1
DEVICE=$2
NETTYPE=`echo $DEVICE |sed -e 's/[0-9].*//'`
IPADDR=$3
if [ ":$NETTYPE" = ":iucv" ]; then
IUCV="iucv=$4"
GATEWAY=$5
MTU=$6
elif [ ":$NETTYPE" = ":ctc" -o ":$NETTYPE" = ":escon" ]; then
GATEWAY=$4
MTU=$5
else
echo $4 | grep -q "\." && MTU=$4 || echo "Invalid MTU $4, skipping"
fi
fi
if [ -n "$MTU" ]; then
MMTU="mtu $MTU"
else
if [ "$NETTYPE" = "ctc" ]; then
MMTU="mtu 4096"
MTU="4096"
IMTU="1"
fi
fi
if [ -n "$NETWORK" ]; then
set -- `echo $NETWORK | sed 's/:/ /g'`
NETWORKIP=$1
NETMASK=$2
BROADCAST=$3
if [ ":$NETTYPE" != ":ctc" -a ":$NETTYPE" != ":iucv" -a ":$NETTYPE" != ":escon" ]; then
GATEWAY=$4
fi
fi
# Parse configuration
# Check for missing parameters, prompt for them if necessary
while [ -z "$HOSTNAME" ]; do
echo $"Please enter the FQDN of your new Linux guest (e.g. s390.redhat.com):"
read HOSTNAME
done
while [ -z "$NETTYPE" ]; do
echo $"Please enter which kind of network device do you intend to use"
echo " (e.g. ctc, escon, iucv, eth, hsi, tr):"
read NETTYPE
done
DEVICE=${NETTYPE}0
if [ ":$NETTYPE" != ":iucv" ]; then # iucv is the only interface without chandev config
while [ -z "$CHANDEV" ]; do
echo $"Please enter parameters you need to pass to the channel device layer."
echo $"This includes the I/O ports of your ctc, escon, qeth, hsi and lcs devices."
echo $"Additional parameters for QETH devices such as the portname"
echo $"should be entered at the next prompt, not here !"
echo $"(e.g. \"ctc0,0x600,0x601\" will activate the ctc0 interface at I/O"
echo $"ports 0x600,0x601):"
read CHANDEV
done
echo "$CHANDEV" |grep -q "qeth"
if [ "$?" = "0" ]; then
if [ -z "$QETHPARM" ]; then
echo $"Each OSA-Express feature in QDIO mode must be associated with a port name"
echo $"Please enter additional parameters for your QETH device"
echo $"(e.g. \"add_parms,0x10,{lo_devno,hi_devno},portname:port_name\")"
echo $"Press enter if you don't want to enter additional parameters"
read QETHPARM
if [ -z "$QETHPARM" ]; then
echo $"You have been warned, but this will not work without an associated portname"
fi
fi
fi
echo "$CHANDEV" |grep -q "hsi"
if [ "$?" = "0" ]; then
if [ -z "$QETHPARM" ]; then
echo $"Please enter additional parameters for your HSI device"
echo $"(e.g. \"add_parms,0x10,{lo_devno,hi_devno},portname:port_name\")"
echo $"Press enter if you don't want to enter additional parameters"
read QETHPARM
fi
fi
[ -n "$CHANDEV" ] && echo "$CHANDEV" >/proc/chandev
[ -n "$QETHPARM" ] && echo "$QETHPARM" >/proc/chandev
[ -n "$CHANDEV" ] && echo "reprobe" >/proc/chandev
fi
if [ ":$NETTYPE" = ":eth" ] || [ ":$NETTYPE" = ":tr" ] || [ ":$NETTYPE" = ":hsi" ]; then
while [ -z "$IPADDR" ]; do
echo $"Please enter the IP address of your new Linux guest:"
read IPADDR
done
while [ -z "$NETWORK" ]; do
echo $"Enter the network address of the new Linux guest:"
read NETWORK
done
while [ -z "$NETMASK" ]; do
echo $"Enter the netmask for the new Linux guest (e.g. 255.255.255.0):"
read NETMASK
done
while [ -z "$BROADCAST" ]; do
echo $"Enter the broadcast address for the new Linux guest:"
read BROADCAST
done
fi
if [ ":$NETTYPE" = ":eth" ] || [ ":$NETTYPE" = ":tr" ] || [ ":$NETTYPE" = ":hsi" ]; then
while [ -z "$GATEWAY" ]; do
echo $"Please enter your default gateway:"
read GATEWAY
done
if echo "$CHANDEV" |grep -q "lcs"; then
LCS="on"
fi
# qeth and nettype!= eth is hipersockets !
if echo "$CHANDEV" |grep -q "qeth"; then
if echo "$NETTYPE" |grep -q "eth"; then
QETH="on"
elif echo "$NETTYPE" |grep -q "hsi"; then
HSI="on"
elif echo "$NETTYPE" |grep -q "tr"; then
TR="on"
fi
fi
else # ctc0, escon0, iucv0
while [ -z "$GATEWAY" ]; do
echo $"Enter the IP of your ctc/escon/iucv point-to-point partner:"
read GATEWAY
done
if [ "$NETTYPE" = "ctc" ]; then
MMTU="mtu 4096"
MTU="4096"
IMTU="1"
else
echo $"Enter the maximal transfer unit (MTU) for this connection or leave empty:"
read MTU
if [ -n "$MTU" ]; then
MMTU="mtu 4096"
fi
fi
if [ ":$NETTYPE" = ":iucv" ]; then
while [ -z "$IUCV" ]; do
echo $"Enter iucv kernel module options (usually iucv=HOST,"
echo $"where HOST is TCPIP for VM, \$TCPIP for VIF):"
read IUCV
done
fi
fi
# configure network-interface
KERNELVERSION=`cat /proc/version | awk '{ print $3 }'`
if [ ":$NETTYPE" = ":ctc" -o ":$NETTYPE" = ":escon" ]; then
insmod ctc$LO $CTC
ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY
route add -host $IPADDR dev $DEVICE 2>/dev/null
elif [ ":$NETTYPE" = ":iucv" ]; then
insmod netiucv$LO $IUCV
ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY
route add -host $IPADDR dev $DEVICE 2>/dev/null
else # lcs, tr, qeth, hsi or older kernel without opensource-lcs
if [ "$DEVICE" = "eth0" -a "$HSI" = "on" ]; then
DEVICE="hsi0"
fi
insmod ipv6$LO
if [ -n "$LCS" ]; then
insmod -f lcs$LO
if [ "$?" = "1" ]; then
echo $"warning: no lcs module found in the first initrd, "
echo $" looking for second initrd"
else
ifconfig $DEVICE $IPADDR $MMTU netmask $NETMASK broadcast $BROADCAST
route add -net $NETWORK netmask $NETMASK dev $DEVICE 2>/dev/null
fi
fi
if [ -d "/OCO" ]; then
if [ -n "$LCS" ]; then
if [ -f /OCO/$KERNELVERSION/kernel/drivers/s390/net/lcs.o ]; then
insmod -f /OCO/$KERNELVERSION/kernel/drivers/s390/net/lcs$LO
else
echo $"error: no lcs module found"
fi
else # qeth or hsi
if [ -f /OCO/$KERNELVERSION/kernel/drivers/s390/qdio.o -a -f /OCO/$KERNELVERSION/kernel/drivers/s390/net/qeth.o ]; then
insmod -f /OCO/$KERNELVERSION/kernel/drivers/s390/qdio$LO
insmod -f /OCO/$KERNELVERSION/kernel/drivers/s390/net/qeth$LO
else
echo $"error: The qdio and the qeth modules are needed for this"
echo $"They cannot be found in /OCO/$KERNELVERSION/kernel/drivers/s390/, skipping..."
fi
fi
ifconfig $DEVICE $IPADDR $MMTU netmask $NETMASK broadcast $BROADCAST
route add -net $NETWORK netmask $NETMASK dev $DEVICE 2>/dev/null
fi
fi
route add default gw $GATEWAY dev $DEVICE 2>/dev/null
if [ -z "$DNS" ]; then
echo $"Please enter your DNS server(s), separated by colons (:):"
read DNS
fi
if [ -z "$DNS" ]; then
echo $"You might encounter problems without a nameserver, especially"
echo $"with FTP installs"
fi
if [ -n "$DNS" -a -z "$SEARCHDNS" ]; then
echo $"Please enter your DNS search domain(s) (if any), separated by colons (:):"
read SEARCHDNS
fi
[ -n "$HOSTNAME" ] && hostname $HOSTNAME
# show interfaces and routing table
ifconfig -a
route -n
[ -n "$DEBUG" ] && debugshell
echo $"Starting portmap."
portmap
# convert to space-separated lists
if [ -n "$SEARCHDNS" ]; then
SEARCHDNS=`echo $SEARCHDNS |sed -e 's/:/ /g'`
for i in "$SEARCHDNS"; do echo "search $i"; done >> /etc/resolv.conf
fi
if [ -n "$DNS" ]; then
DNS=`echo $DNS |sed -e 's/:/ /g'`
for i in "$DNS"; do echo "nameserver $i"; done >> /etc/resolv.conf
fi
grep -q ext3 /proc/filesystems
if [ "$?" != "0" ]; then
insmod jbd$LO
insmod ext3$LO
fi
# Don't add MTU to the installed system's config. It was
# set to 4096 for the installer only
if [ "$IMTU" = "1" ]; then
MTU=
fi
# transfer options into install environment
cat > /tmp/install.cfg << EOF
LANG="$LANG"
S390ARCH="$S390ARCH"
TEXTDOMAIN="$TEXTDOMAIN"
TEXTDOMAINDIR="$TEXTDOMAINDIR"
CHANDEV="$CHANDEV"
QETHPARM="$QETHPARM"
HOSTNAME="$HOSTNAME"
DEVICE="$DEVICE"
NETTYPE="$NETTYPE"
IPADDR="$IPADDR"
GATEWAY="$GATEWAY"
MTU="$MTU"
NETWORK="$NETWORK"
NETMASK="$NETMASK"
BROADCAST="$BROADCAST"
INTERACTIVE="$INTERACTIVE"
DNS="$DNS"
SEARCHDNS="$SEARCHDNS"
FORCEDASDFORMAT="$FORCEDASDFORMAT"
LCS="$LCS"
QETH="$QETH"
HSI="$HSI"
TR="$TR"
IUCV="$IUCV"
CTC="$CTC"
ROOTPW="$ROOTPW"
CROOTPW="$CROOTPW"
ONBOOT="yes"
export LANG CHANDEV QETHPARM S390ARCH TEXTDOMAIN TEXTDOMAINDIR HSI
export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU
export NETWORK NETMASK BROADCAST DNS SEARCHDNS
export LCS QETH IUCV ROOTPW CROOTPW ONBOOT
export TR
EOF
# immediately read it in again to export these into the shell below
. /tmp/install.cfg
cat /tmp/install.cfg >> /etc/profile
cat > /tmp/netinfo << EOF
DEVICE=$DEVICE
ONBOOT=yes
BOOTPROTO=static
IPADDR=$IPADDR
NETMASK=$NETMASK
GATEWAY=$GATEWAY
BROADCAST=$BROADCAST
HOSTNAME=$HOSTNAME
DOMAIN=
MTU=$MTU
EOF
# so that the vars get propagated into the sshd shells
cat >> /etc/profile <<EOF
LD_LIBRARY_PATH=$LD_LIBRARY_PATH
PATH=$PATH
HOME=$HOME
PYTHONPATH=$PYTHONPATH
export LD_LIBRARY_PATH PATH HOME PYTHONPATH
EOF
echo $DEVICE | grep ctc && echo "REMIP=$GATEWAY" >> /tmp/netinfo
echo $DEVICE | grep ctc && echo "export REMIP=$GATEWAY" >> /etc/profile
[ -n "$DEBUG" ] && debugshell
startinetd
umount -a
umount /proc
exit 0
# ;;; Local Variables: ***
# ;;; mode: sh ***
# ;;; tab-width:3 ***
# ;;; end: ***
# vim:ts=3:sw=3
|