📄 linuxrc.s390
字号:
#! /bin/sh## Copyright (C) 2000-2004 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.1export TEXTDOMAIN=s390installerexport TEXTDOMAINDIR=/usr/lib/locale# check IP address format# param: IP string# return: 0 (valid IP) or 1 (invalid IP)checkip(){ ip=$1 echo $ip | awk -F'.' '{ if (NF != 4) { exit 1 } i=1; while (i<=NF) { if ($i>255 || $i<0) { exit 1 }; i=i+1; } exit 0 }' return $?}doshutdown(){ exec /sbin/shutdown exit 0}doreboot(){ exec /sbin/shutdown -r exit 0}sysecho () { file=$1 shift i=1 while [ $i -le 10 ] ; do if [ ! -f $file ]; then sleep 1 i=$((i+1)) else break fi done [ -f $file ] && echo $* > $file}# jump through some hoops to find out the LCS interface namegetlcsifname() { local dirs driver readport ifname ifname="" dirs=`/bin/ls -d /sys/class/net/eth* /sys/class/net/tr* 2>/dev/null` for i in $dirs; do driver=`readlink $i/driver` driver=`basename $driver` if [ "$driver" == "lcs" ]; then readport=`readlink $i/device` readport=`basename $readport` if [ "$readport" == "$1" ]; then ifname=`basename $i` break fi fi done if [ -n "$ifname" ]; then DEVICE=$ifname else echo "Could not detect LCS interface, aborting..." exit fi}startinetd(){ echo echo $"Starting telnetd and sshd to allow login over the network." echo $"Welcome to the anaconda install environment $VERSION for $S390ARCH" > /etc/issue.net echo $"Welcome to the anaconda install environment $VERSION for $S390ARCH" > /etc/motd echo >> /etc/motd /sbin/xinetd -stayalive -reuse -pidfile /tmp/xinetd.pid /sbin/sshd if [ -z "$RUNKS" ]; then echo echo $"Connect now to $IPADDR to start the installation." read while : ; do /bin/sh --login [ $? = 0 ] || break done fi}# read file from CMS and write it to /tmpreadcmsfile() # $1=dasdport $2=filename{ local dev if [ $# -ne 2 ]; then return; fi mknod /dev/dasda b 94 0 insmod dasd_mod$LO dasd=$1 insmod dasd_eckd_mod$LO cmsfscat -d /dev/dasda -a $2 > /tmp/$2 if [ ${#1} == 3 ]; then dev="0.0.0${1}" elif [ ${#1} == 4 ]; then dev="0.0.${1}" fi sysecho /sys/bus/ccw/drivers/dasd-eckd/$dev/online 0 rmmod dasd_eckd_mod rmmod dasd_mod}setupdevice(){ if [ -z "$SUBCHANNELS" -o -z "$NETTYPE" ]; then echo $"SUBCHANNELS or NETTYPE empty, cannot continue." exit 1 fi SYSDIR=${SUBCHANNELS//,*/} # get first subchannel. This is where the device can be brought online sysecho /sys/bus/ccwgroup/drivers/${NETTYPE}/group "$SUBCHANNELS" if [ -n "$PORTNAME" ]; then if [ "$NETTYPE" = "lcs" ]; then sysecho /sys/bus/ccwgroup/drivers/${NETTYPE}/${SYSDIR}/portno "$PORTNAME" else sysecho /sys/bus/ccwgroup/drivers/${NETTYPE}/${SYSDIR}/portname "$PORTNAME" fi fi if [ -n "$CTCPROT" -a "$NETTYPE" = "ctc" ]; then sysecho /sys/bus/ccwgroup/drivers/ctc/${SYSDIR}/protocol "$CTCPROT" fi if [ -n "$LAYER2" -a "$NETTYPE" = "qeth" ]; then sysecho /sys/bus/ccwgroup/drivers/qeth/${SYSDIR}/layer2 "$LAYER2" fi sysecho /sys/bus/ccwgroup/drivers/${NETTYPE}/${SYSDIR}/online 1}createDevices(){ awk '{ printf("mknod /dev/%s %s %s %s\n", $1, $2, $3, $4); printf("chmod %s /dev/%s\n", $5, $1); printf("chown %s /dev/%s\n", $6, $1); }' <<EOF | sh console c 5 1 600 root:root null c 1 3 666 root:root zero c 1 5 666 root:root mem c 1 1 600 root:root ptmx c 5 2 666 root:root tty c 5 0 666 root:root tty0 c 4 0 600 root:tty tty1 c 4 1 600 root:tty random c 1 8 644 root:root urandom c 1 9 644 root:root rtc c 10 135 644 root:rootEOF for i in 2 3 4 5 6 7 8 9 ; do ln -s console /dev/tty$i done mkdir /dev/pts}S390ARCH=`uname -m`if [ "$S390ARCH" = "s390" ]; then export S390ARCH="S/390"else export S390ARCH="zSeries"fiecho $"Starting the $S390ARCH initrd to configure networking. Version is $VERSION"# set up env vars as we do in init.cif [ `uname -m` = "s390x" ]; then LD_LIBRARY_PATH=/lib64:/usr/lib64:/usr/X11R6/lib64:/usr/kerberos/lib64:/lib:/usr/lib:/usr/X11R6/lib:/usr/kerberos/libelse LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib:/usr/kerberos/libfiexport LD_LIBRARY_PATHPATH="$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 PATHHOME=/export HOMEPYTHONPATH=/tmp/updatesexport PYTHONPATHmount -t proc none /procmount -t tmpfs none /devcreateDevicesmount -t devpts /dev/pts /dev/ptsmount -t sysfs none /sys# remount root fs rwmount /dev/root / -o remount,rw# limit output on x3270 console (well, not really -- need debugging now)echo "8 4 1 1" > /proc/sys/kernel/printk# make /tmp/ramfsmount -t ramfs none /tmpifconfig lo 127.0.0.1 netmask 255.0.0.0route add -host 127.0.0.1 dev lo 2>/dev/nullLO=""[ -L /sbin/insmod ] && LO=".ko"if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then readcmsfile $CMSDASD $CMSCONFFILE source /tmp/$CMSCONFFILE #2>/dev/nullfi# Parse configuration# Check for missing parameters, prompt for them if necessarywhile [ -z "$NETTYPE" ]; do echo $"Which kind of network device do you intend to use" echo $" (e.g. ctc, iucv, qeth, lcs)." echo $"Enter 'qeth' for OSA-Express Fast Ethernet, Gigabit Ethernet" echo $" (including 1000Base-T), High Speed Token Ring, and ATM " echo $" (running Ethernet LAN emulation) features in QDIO mode." echo $"Enter 'lcs' for OSA颅2 Ethernet/Token Ring, OSA-Express Fast Ethernet in" echo $" non-QDIO mode, OSA-Express High Speed Token Ring in non-QDIO mode and" echo $" Gigabit Ethernet in non-QDIO mode." read NETTYPEdoneif [ "$NETTYPE" != "iucv" ]; then # iucv is the only interface without ccw config if [ -n "$CHANDEV" ]; then echo echo $"The CHANDEV variable isn't used anymore, please update your " echo $".parm or the .conf file" echo fi while [ -z "$SUBCHANNELS" ]; do echo $"Enter the bus ID and the device number of your CCW devices." echo $"CTC/ESCON and LCS need two subchannels:" echo $"(e.g. \"0.0.0600,0.0.0601\" will configure the CTC or ESCON interface" echo $"with the subchannels 0x600 and 0x601)" echo $"QETH needs three subchannels p.e. 0.0.0300,0.0.0301,0.0.0302" read SUBCHANNELS done SUBCHANNELS=`echo $SUBCHANNELS | /sbin/busybox tr ABCDEF abcdef` if [ "$NETTYPE" = "qeth" ]; then if [ -z "$PORTNAME" ]; then echo $"Portname of the OSA-Express feature in QDIO mode and z/VM Guest LAN" echo $"This parameter is optional with z/VM 4.4.0 or z/VM 4.3.0 with" echo $"APARs VM63308 and PQ73878" echo $"Press enter if you don't want to enter a portname" read PORTNAME fi if [ -z "$LAYER2" ]; then echo $"Enter the mode of operation for the OSA device" echo $"0 for layer 3 mode (default)" echo $"1 for layer 2 mode" read LAYER2 fi fifi while [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; do echo $"Enter the FQDN of your new Linux guest (e.g. s390.redhat.com):" read HOSTNAMEdonewhile [ -z "$IPADDR" ]; do echo $"Enter a valid IP address of your new Linux guest:" read IPADDR checkip $IPADDR ret=$? if [ $ret -eq 1 ]; then echo -n "Invalid IP address format. " unset IPADDR fidonewhile [ -z "$NETWORK" ]; do echo $"Enter a valid network address of the new Linux guest:" read NETWORK checkip $NETWORK ret=$?
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -