This brings linuxrc.s390, lsznet.raw, and controlunits.sh to the latest version as posted here https://www.redhat.com/archives/anaconda-devel-list/2009-February/msg00392.html --- loader/controlunits.sh | 54 +++ loader/linuxrc.s390 | 1165 ++++++++++++++++++++++-------------------------- loader/lsznet.raw | 89 +--- 3 files changed, 593 insertions(+), 715 deletions(-) create mode 100644 loader/controlunits.sh mode change 100644 => 100755 loader/linuxrc.s390 mode change 100644 => 100755 loader/lsznet.raw diff --git a/loader/controlunits.sh b/loader/controlunits.sh new file mode 100644 index 0000000..d45386d --- /dev/null +++ b/loader/controlunits.sh @@ -0,0 +1,54 @@ +# controlunits.sh: define some common control unit mappings +# Copyright (C) IBM Corp. 2009 +# Author: Steffen Maier <maier@xxxxxxxxxx> +# +# 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; version 2 of the License only. +# +# 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 + +# The arrays (among other things) should be adapted, if any of those device +# drivers start supporting different CU types/models. + +readonly -a CU=( + 1731/01 + 1731/05 + 3088/08 + 3088/1f + 3088/1e + 3088/01 + 3088/60 +) + +readonly -a CU_DEVDRV=( + qeth + qeth + ctcm + ctcm + ctcm + lcs + lcs +) + +# Searches for a match of argument 1 on the array $CU and sets $cu_idx +# to the matched array index on success. +# Returns 0 on success, 1 on failure. +function search_cu() { + local scu=$1 + local i + for ((i=0; i < ${#CU[@]}; i++)); do + if [ "$scu" == "${CU[i]}" ]; then + cu_idx=$i + return 0 + fi + done + return 1 +} diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 old mode 100644 new mode 100755 index d9ccca6..d0dfedb --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -27,16 +27,22 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# prerequisites of this script to run inside the RHEL5.3 installer initrd: -# - copy udevsettle and udevd to initrd -# - copy lsznet.raw to initrd as /sbin/lsznet -# - create /etc/udev/udev.conf with at least one comment line as content +# prerequisites of this script to run inside the installer initrd: +# - udevadm and udevd need to be there +# - have /etc/udev/udev.conf with at least one comment line as content +# - if necessary, have udev rules +# - copy lsznet.raw and controlunits.sh to initrd +# - pack kernel modules and module-init-tools (no longer use busybox for that) +# - "multi on" in /etc/host.conf [RH bugs 486457,486461,483244] + +# TODOs: +# - make sure driver modules get loaded automatically +# - modprobe.conf entry for loading dasd_mod without setting any DASD online +# - udev rule for lcs/ctcm vs. cu3088 +# - make sure netiucv gets loaded even without udev events since on no bus VERSION=1.2 -export TEXTDOMAIN=s390installer -export TEXTDOMAINDIR=/usr/lib/locale - # helper function to execute command in arguments and print command on stdout function debug() { # uncomment the following echo "$*" to enable debug output @@ -108,7 +114,7 @@ function doreboot() exit 0 fi - echo $"about to exec shutdown -r" + echo "about to exec shutdown -r" exec /sbin/shutdown -r exit 0 } @@ -131,19 +137,18 @@ function sysecho () { function startinetd() { echo - echo $"Starting telnetd and sshd to allow login over the network." + echo "Starting sshd to allow login over the network." if [ -z "$testing" ]; then - 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 "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 fi # testing - /sbin/xinetd -stayalive -reuse -pidfile /tmp/xinetd.pid /sbin/sshd if [ -z "$RUNKS" ]; then echo - echo $"Connect now to $IPADDR and login as user root to start the installation." - echo $"E.g. using: ssh -X root@$IPADDR" + echo "Connect now to $IPADDR and login as user root to start the installation." + echo "E.g. using: ssh -X root@$IPADDR" read while : ; do /bin/sh --login @@ -157,33 +162,42 @@ function readcmsfile() # $1=dasdport $2=filename { local dev if [ $# -ne 2 ]; then return; fi - mknod /dev/dasda b 94 0 + # precondition: udevd created dasda block device node if ! sysecho /proc/cio_ignore "free $1"; then - echo $"DASD $1 could not be cleared from device blacklist" + echo "DASD $1 could not be cleared from device blacklist" return 1 fi # /proc/cio_ignore won't block on freeing devices until resensing # has been completed, so wait until the udev event queue depletes - # (without udevsettle we could wait 2 seconds unconditionally) + # (without udevadm settle we could wait 2 seconds unconditionally) #debug ls -laF /dev/.udev - udevsettle + udevadm settle + # even though the device might now be online, some of its + # sysfs attributes might not yet be available sleep 1 - insmod dasd_mod$LO dasd=$1 - insmod dasd_eckd_mod$LO - if ! cmsfscat -d /dev/dasda -a $2 > /tmp/$2; then - echo $"Could not read conf file $2 on CMS DASD $1." - fi - # maybe replace with a more robust: dev=$(printf "0.0.%04x" $((0x${1}))) + # precondition: dasd_eckd_mod driver incl. dependencies loaded, + # dasd_mod must be loaded without setting any DASD online 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 + if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then + echo "DASD $dev could not be set online" + return 1 + fi + if ! cmsfscat -d /dev/dasda -a $2 > /tmp/$2; then + echo "Could not read conf file $2 on CMS DASD $1." + fi + if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then + echo "DASD $dev could not be set offline again" + return 1 + fi + # consequences of no more module unload: loader/anaconda can no longer + # use DASD option to online DASDs and set other DASD parameters! } +# adaption of the same function in init.c (udevd gets started later) function createDevices() { awk '{ printf("mknod /dev/%s %s %s %s\n", $1, $2, $3, $4); @@ -202,6 +216,7 @@ random c 1 8 644 root:root urandom c 1 9 644 root:root rtc c 10 135 644 root:root EOF + # tty handling is different from init.c since s390 does not have all for i in 2 3 4 5 6 7 8 9 ; do ln -s console /dev/tty$i done @@ -209,6 +224,70 @@ EOF ln -s /proc/self/fd /dev/fd } +# approximately the main() function of init.c +function init_main() { + S390ARCH=$(uname -m) + if [ "$S390ARCH" = "s390" ]; then + export S390ARCH="S/390" + else + export S390ARCH="zSeries" + fi + + echo + 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 + + if [ -z "$testing" ]; then + + mount -t proc none /proc + + mount -t tmpfs none /dev + createDevices + # udevd req'd by udevadm settle (/dev/.udev/queue) + # in readcmsfile, dialog_network_table, semantic_check_subchannels. + # (important: start udevd at the right time, e.g. after setup of /dev) + echo "starting udev..." + udevd --daemon + + mount -t devpts /dev/pts /dev/pts + mount -t sysfs none /sys + # remount root fs rw + mount /dev/root / -o remount,rw + + # limit output on 3270 console + # (console_loglevel of 4 is just right to not get driver info, + # e.g. from qeth, since that would mix up with the user dialog) + echo "4 4 1 7" > /proc/sys/kernel/printk + + # make /tmp/ramfs + mount -t ramfs none /tmp + + ifconfig lo 127.0.0.1 netmask 255.0.0.0 + route add -host 127.0.0.1 dev lo + + echo -e "127.0.0.1\tlocalhost.localdomain localhost localhost4 localhost4.localdomain4" > /etc/hosts + echo -e "::1\t\tlocalhost.localdomain localhost localhost6 localhost6.localdomain6" >> /etc/hosts + + # init.c would also fork /sbin/dbus-uuidgen --ensure + # and /sbin/dbus-daemon --system + + fi # testing +} + # from here on accesses to sysfs try to follow # linux/Documentation/sysfs-rules.txt @@ -251,14 +330,14 @@ function clear_screen() { function dialog_network_table() { while : ; do - echo $"Scanning for available network devices..." + echo "Scanning for available network devices..." # This may take a long time so we show "progress": #( while true; do echo -n "."; sleep 1; done ) & #local childpid=$! read_lsznet_output #kill $childpid #echo - echo $"Autodetection found ${count} devices." + echo "Autodetection found ${count} devices." # count==0: there might still be a blacklist the user wants to clear. # do not flood user with long list if there are many devices if [ "$count" -le 15 ]; then @@ -267,7 +346,7 @@ function dialog_network_table() { else # [ $count -gt 15 ] echo while : ; do - echo $"s) show all, m) manual config:" + echo "s) show all, m) manual config:" local answer read answer case $answer in @@ -290,27 +369,27 @@ function dialog_network_table() { local cio_wc=$(wc -c /proc/cio_ignore) read cio_wc_bytes cio_wc_filename cio_wc_foo <<< "$cio_wc" if [ "$cio_wc_bytes" != "0" ]; then - echo $"Note: There is a device blacklist active! (Clearing might take long)" + echo "Note: There is a device blacklist active! (Clearing might take long)" #cat /proc/cio_ignore | tr '\n' ',' #echo else if [ "$count" -eq 0 ]; then # count==0 AND no device blacklist => manual mode - echo $"Entering manual configuration mode." + echo "Entering manual configuration mode." break fi fi fi # selection dialog while : ; do - [ "$count" -gt 0 ] && echo -n $"<num>) use config, " - [ "$cio_wc_bytes" != "0" ] && echo -n $"c) clear blacklist, " - echo $"m) manual config, r) rescan, s) shell:" + [ "$count" -gt 0 ] && echo -n "<num>) use config, " + [ "$cio_wc_bytes" != "0" ] && echo -n "c) clear blacklist, " + echo "m) manual config, r) rescan, s) shell:" local choice read choice [ -z "$choice" ] && continue if [ "$choice" = "s" ]; then - echo $"Enter 'exit' at the shell prompt to get back to the installation dialog." + echo "Enter 'exit' at the shell prompt to get back to the installation dialog." /bin/bash continue 2 fi @@ -336,7 +415,7 @@ function dialog_network_table() { esac done if [ "$choice" = "c" ]; then - echo $"Clearing device blacklist..." + echo "Clearing device blacklist..." if sysecho /proc/cio_ignore "free all"; then cio_wc_bytes=0 # /proc/cio_ignore won't block on freeing devices @@ -346,17 +425,15 @@ function dialog_network_table() { #( while true; do echo -n "."; sleep 3; done ) & #local childpid=$! #debug ls -laF /dev/.udev - udevsettle + udevadm settle # (virtual) CTC/A takes some more time to appear in sysfs # FIXME: how long to wait? 3 seconds seems to be enough. sleep 3 #kill $childpid #echo - # udevsettle only works if udevd is running (/dev/.udev/queue)! - # (without udevsettle we could wait 5-10 seconds uncond.) continue else - echo $"Device blacklist could not be cleared" + echo "Device blacklist could not be cleared" fi fi [ "$choice" = "m" ] && break @@ -366,7 +443,11 @@ function dialog_network_table() { local item cutype chp chpidtype devdrv devname chlist cardtype read item cutype chp chpidtype devdrv devname chlist cardtype <<< ${nettable[$choice]} # $NETTYPE happens to be exactly the network driver name - NETTYPE=$devdrv + if [ "$devdrv" = "ctcm" ]; then + NETTYPE="ctc" + else + NETTYPE=$devdrv + fi SUBCHANNELS=$chlist break done @@ -379,49 +460,7 @@ declare -r BUSIDFORMAT=[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] declare -r IDFORMAT=$PREFIXFORMAT.$SSIDFORMAT.$BUSIDFORMAT declare -r SUBCHANNEL_TYPE_IO=0 -# The following combinations of control unit type and model were taken from the -# Linux network device drivers for s390 on 2008-06-09 from Linux 2.6.25.4. -# The list (among other things) should be adapted, if any of those device -# drivers start supporting different CU types/models. -# (Alternatively, the list could be generated by reading the modaliases -# directly out of the device driver modules: -# modinfo qeth/cu3088 | fgrep 'alias:' -# However, this would still require a list of device driver modules.) - -declare -r -a CU=( - 1731/01 - 1731/05 - 3088/08 - 3088/1f - 3088/1e - 3088/01 - 3088/60 -) - -declare -r -a CU_DEVDRV=( - qeth - qeth - ctc - ctc - ctc - lcs - lcs -) - -# Searches for a match of argument 1 on the array $CU and sets $cu_idx -# to the matched array index on success. -# Returns 0 on success, 1 on failure. -function search_cu() { - local scu=$1 - local i - for ((i=0; i < ${#CU[@]}; i++)); do - if [ "$scu" == "${CU[i]}" ]; then - cu_idx=$i - return 0 - fi - done - return 1 -} +. /sbin/controlunits.sh function cardtype2cleartext() { local cardtype=$1 @@ -436,9 +475,9 @@ function cardtype2cleartext() { OSD_Express) echo "OSA card in OSD mode, unknown link type" ;; HSTR) echo "OSA card in OSD mode, High Speed Token Ring" ;; OSN) echo "OSA for NCP, ESCON/CDLC bridge" ;; - HiperSockets) echo "HiperSocket with CHPID type IQD" ;; + HiperSockets) echo "HiperSockets with CHPID type IQD" ;; "GuestLAN QDIO") echo "GuestLAN based on OSA (QDIO)" ;; - "GuestLAN Hiper") echo "GuestLAN based on HiperSocket" ;; + "GuestLAN Hiper") echo "GuestLAN based on HiperSockets" ;; unknown) echo "other" ;; *) echo "unknown" echo "l.$LINENO: found unknown card_type, code needs to be fixed" 1>&2 @@ -456,29 +495,6 @@ function isVM() { fi } -# echos one comparable integer built from 3 arguments in kernel version style -function kernel_version() { - [ $# -eq 3 ] || return 1 - local krn_ver=$1 krn_patch=$2 krn_sub=$3 - local version=$(( (krn_ver << 16) + (krn_patch << 8) + krn_sub )) - # <<EOF convince syntax highlighter that above shifts are no here documents - echo $version - return 0 -} - -# echos one comparable integer built from actual running kernel version -function linux_version() { - local krn_ver krn_patch krn_sub - local krn_foo krn_extra - IFS=. - read krn_ver krn_patch krn_foo < <(uname -r) - unset IFS - IFS=- - read krn_sub krn_extra <<< "$krn_foo" - unset IFS - kernel_version $krn_ver $krn_patch $krn_sub -} - # watch out: potential error message as side effect function isLayer2Default() { # Read default from sysfs because according to device @@ -487,7 +503,7 @@ function isLayer2Default() { # This only works here in installer where nobody has overwritten # the default setting with another custom value already! if [ ! -f /sys/devices/${NETTYPE}/$SCH_R_DEVBUSID/layer2 ]; then - echo $"Could not read layer mode from sysfs" + echo "Could not read layer mode from sysfs" return 1 fi local layer2 @@ -514,114 +530,37 @@ function isLayer2() { esac } -# returns true iff qeth device $SCH_R_DEVBUSID and kernel version +# returns true iff qeth device $SCH_R_DEVBUSID # is capable of supporting IPv6 # watch out: potential error message as side effect function ipv6_capable() { [ "$NETTYPE" = "qeth" ] || return 1 case $cardtype in - OSD_10GIG|OSD_1000|OSD_100|OSD_Express|"GuestLAN QDIO") return 0 ;; - HiperSockets) - if isLayer2; then - return 0 - elif [ $(linux_version) -ge $(kernel_version 2 6 26) ]; then - return 0 - else - return 1 - fi - ;; + OSD_10GIG|OSD_1000|OSD_100|OSD_Express|HiperSockets|"GuestLAN QDIO") + return 0 ;; OSD_GbE_LANE|OSD_FE_LANE|OSD_TR_LANE|OSD_ATM_LANE) return 1 ;; HSTR|OSN|unknown) return 1 ;; "GuestLAN Hiper") return 1 ;; - *) echo $"Unknown card_type to determine IPv6 support" + *) echo "Unknown card_type to determine IPv6 support" return 1 ;; esac } -function insert_module() { - local module=${1} - if grep "^${module%.ko} .*$" /proc/modules &> /dev/null ; then - # module has already been loaded => do not try to load again - return 0 - fi - if ! insmod $module; then - echo $"Could not load kernel module $module" - fi -} - -function load_kernel_modules() { - if [ ":$NETTYPE" = ":ctc" ]; then - insert_module ccwgroup$LO - insert_module cu3088$LO - insert_module fsm$LO - insert_module ctc$LO - elif [ ":$NETTYPE" = ":iucv" ]; then - insert_module fsm$LO - insert_module iucv$LO - insert_module netiucv$LO - elif [ "$NETTYPE" = "lcs" ]; then - insert_module ccwgroup$LO - insert_module cu3088$LO - insert_module lcs$LO - elif [ "$NETTYPE" = "qeth" ]; then - insert_module crypto_api$LO - insert_module xfrm_nalgo$LO - insert_module ipv6$LO - insert_module ccwgroup$LO - insert_module qdio$LO - insert_module qeth$LO - fi -} - -function remove_module() { - if ! rmmod $1; then - #echo $"Could not remove kernel module $1" - : - fi -} - -function remove_kernel_modules() { - if [ ":$NETTYPE" = ":ctc" ]; then - remove_module ctc - remove_module fsm - remove_module cu3088 - remove_module ccwgroup - elif [ ":$NETTYPE" = ":iucv" ]; then - remove_module netiucv - remove_module iucv - remove_module fsm - elif [ "$NETTYPE" = "lcs" ]; then - remove_module lcs - remove_module cu3088 - remove_module ccwgroup - elif [ "$NETTYPE" = "qeth" ]; then - remove_module qeth - remove_module qdio - remove_module ccwgroup - # The remaining 3 modules can hardly be unloaded - # since e.g. loopback holds an inet6 address and thus a reference. - # But that's no problem as long as the device drivers are removed. - remove_module ipv6 - remove_module xfrm_nalgo - remove_module crypto_api - fi -} - # sets device online _and_ retrieves DEVICE at the same time # iucv cannot be set online since it's not based on ccw(group) function set_device_online() { - echo $"Activating network device..." + echo "Activating network device..." local sysnettype case "${NETTYPE}" in qeth) sysnettype=${NETTYPE} ;; lcs|ctc) sysnettype=cu3088 ;; esac if ! [ -f /sys/devices/${sysnettype}/$SCH_R_DEVBUSID/online ]; then - echo $"Sysfs path to set device online does not exist." + echo "Sysfs path to set device online does not exist." return 1 fi if ! sysecho /sys/devices/${sysnettype}/$SCH_R_DEVBUSID/online "1"; then - echo $"Could not set device ($SUBCHANNELS) online" + echo "Could not set device ($SUBCHANNELS) online" return 1 fi local i=1 @@ -632,46 +571,46 @@ function set_device_online() { sleep 1 i=$((i+1)) if [ "$i" -gt 10 ]; then - echo $"Could not set device ($SUBCHANNELS) online within timeout" + echo "Could not set device ($SUBCHANNELS) online within timeout" return 1 fi done if [ "$NETTYPE" = "lcs" -o "$NETTYPE" = "ctc" ]; then # KH FIXME: Workaround for missing sysfs interface - # DEVICE=`cat /sys/devices/lcs/${SUBCHANNELS//,*/}/if_name` + # DEVICE=$(cat /sys/devices/lcs/${SUBCHANNELS//,*/}/if_name) # replaced with flexible solution: # https://bugzilla.redhat.com/show_bug.cgi?id=204803#c9 # "sys/bus/ccwgroup/devices/${SUBCHANNEL}/net\:* # for lcs after setting online" if [ ! -h /sys/devices/${sysnettype}/$SCH_R_DEVBUSID/net:* ]; then - echo $"Device $SUBCHANNELS does not have required sysfs attribute 'net:*'" + echo "Device $SUBCHANNELS does not have required sysfs attribute 'net:*'" return 1 fi DEVICE=$(echo /sys/devices/${sysnettype}/$SCH_R_DEVBUSID/net:*) DEVICE=${DEVICE//*:/} if [ "$DEVICE" = "" ]; then - echo $"Could not get device name for $SUBCHANNELS" + echo "Could not get device name for $SUBCHANNELS" return 1 fi else # qeth if [ ! -f /sys/devices/qeth/$SCH_R_DEVBUSID/if_name ]; then - echo $"Device $SUBCHANNELS does not have required sysfs attribute 'if_name'" + echo "Device $SUBCHANNELS does not have required sysfs attribute 'if_name'" return 1 fi # (device needs to be online to read if_name from sysfs attribute!) read DEVICE < /sys/devices/qeth/$SCH_R_DEVBUSID/if_name if [ "$DEVICE" = "" ]; then - echo $"Could not get device name for $SUBCHANNELS" + echo "Could not get device name for $SUBCHANNELS" return 1 fi if [ -f /sys/devices/qeth/$SCH_R_DEVBUSID/card_type ]; then read cardtype < /sys/devices/qeth/$SCH_R_DEVBUSID/card_type #debug echo "$cardtype" # device is now online and link type will be known - echo -n $"Detected: " + echo -n "Detected: " cardtype2cleartext "$cardtype" else - echo $"Could not read qeth network card type from sysfs." + echo "Could not read qeth network card type from sysfs." fi fi } @@ -679,12 +618,12 @@ function set_device_online() { # sets device up and blocks until device appears to be up function set_device_up() { if [ -z "$DEVICE" ]; then - echo $"Could not determine interface name to bring up device $SUBCHANNELS" + echo "Could not determine interface name to bring up device $SUBCHANNELS" return 1 fi # Device does not come up fast enough to use "ip" to configure, so block. # While OSA come up themselves after setting online, - # e.g. HiperSocket won't, so set them up explicitly for the following check + # e.g. HiperSockets won't => set them up explicitly for the following check debug ip link set up $DEVICE local i=1 while : ; do @@ -693,7 +632,7 @@ function set_device_up() { sleep 1 i=$((i+1)) if [ "$i" -gt 10 ]; then - echo $"Could not bring up device $DEVICE within timeout" + echo "Could not bring up device $DEVICE within timeout" return 1 fi done @@ -727,11 +666,13 @@ function syntax_check_domainname() { function modprobe_alias() { if [ ":$NETTYPE" = ":iucv" ]; then echo "alias $DEVICE netiucv" >> /tmp/modprobe.conf + elif [ ":$NETTYPE" = ":ctc" ]; then + echo "alias $DEVICE ctcm" >> /tmp/modprobe.conf else echo "alias $DEVICE $NETTYPE" >> /tmp/modprobe.conf fi if [ $? -ne 0 ]; then - echo $"Could not append alias for network device $DEVICE to modprobe.conf" + echo "Could not append alias for network device $DEVICE to modprobe.conf" return 1 fi return 0 @@ -752,14 +693,14 @@ function configure_ipv6_address() { # happens automatically by the driver. do NOT mess with default setting. #NO#debug ip link set dev $DEVICE arp on if ! debug ip -6 address add $IPADDR/$NETMASK dev $DEVICE; then - echo $"Could net set IPv6 address $IPADDR/$NETMASK for device $DEVICE" + echo "Could net set IPv6 address $IPADDR/$NETMASK for device $DEVICE" return 1 fi # network route has been set by above "ip address add" already # take care of MTU, which is bundled with ifconfig in the other IPv4 cases if [ -n "$MMTU" ]; then if ! debug ip link set $DEVICE $MMTU; then - echo $"Could net set maximum transfer unit ($MMTU) for device $DEVICE" + echo "Could net set maximum transfer unit ($MMTU) for device $DEVICE" return 1 fi fi @@ -771,21 +712,21 @@ function configure_ipv4_address() { if ipcalc -bmnp $ipcalc_arg > /tmp/ipcalc.$$.out 2> /dev/null; then . /tmp/ipcalc.$$.out else - echo $"Could not calculate network address and broadcast address from" - echo $" IPv4 address $IPADDR and netmask $NETMASK" + echo "Could not calculate network address and broadcast address from" + echo " IPv4 address $IPADDR and netmask $NETMASK" return 1 fi rm /tmp/ipcalc.$$.out # device needs to be online if ! debug ifconfig $DEVICE $IPADDR $MMTU netmask $NETMASK broadcast $BROADCAST; then - echo $"Could not set IPv4 address $IPADDR for device $DEVICE" - echo $" with network mask $NETMASK and broadcast address $BROADCAST" - [ -n "$MMTU" ] && echo $" and maximum transfer unit: $MMTU" + echo "Could not set IPv4 address $IPADDR for device $DEVICE" + echo " with network mask $NETMASK and broadcast address $BROADCAST" + [ -n "$MMTU" ] && echo " and maximum transfer unit: $MMTU" return 1 fi # This network route is already there after ifconfig! #if ! debug route add -net $NETWORK netmask $NETMASK dev $DEVICE; then - # echo $"Could not add network route to $NETWORK/$NETMASK on device $DEVICE" + # echo "Could not add network route to $NETWORK/$NETMASK on device $DEVICE" # return 1 #fi return 0 @@ -829,9 +770,6 @@ function rollback_config() { [ -z "$mtu_was_set" ] && unset MTU [ -z "$mmtu_was_set" ] && unset MMTU [ -z "$vswitch_was_set" ] && unset VSWITCH - # Try to silently unload modules. We ignore failures since - # load_kernel_modules only tries to load missing modules. - tv remove_kernel_modules # prevent possible reuse of an old DEVICE on restarting dialog unset DEVICE } @@ -871,9 +809,9 @@ function reenter_menu() { #[ -z "$1" ] && return 0 while : ; do if [ -n "$helptext" ]; then - echo $"0) default is previous \"$oldvalue\", 1) new value, ?) help" + echo "0) default is previous \"$oldvalue\", 1) new value, ?) help" else - echo $"0) default is previous \"$oldvalue\", 1) new value" + echo "0) default is previous \"$oldvalue\", 1) new value" fi # uncoded alternative: 2) skip parameter local answer @@ -885,7 +823,7 @@ function reenter_menu() { # temporarily for this parameter. # To put it differently: redoing does NOT present old values. redoitem="yes" - echo -n $"new value: " + echo -n "new value: " return 0 ;; "?") input="?" @@ -903,9 +841,9 @@ function workflow_item_menu() { while : ; do unset redoitem if [ "$noredo" = "noredo" ]; then - echo $"1) continue, 2) restart dialog, 3) halt, 4) shell" + echo "1) continue, 2) restart dialog, 3) halt, 4) shell" else - echo $"0) redo this parameter, 1) continue, 2) restart dialog, 3) halt, 4) shell" + echo "0) redo this parameter, 1) continue, 2) restart dialog, 3) halt, 4) shell" fi local answer read answer @@ -922,7 +860,7 @@ function workflow_item_menu() { 3) tv doshutdown exit 0 ;; - 4) echo $"Enter 'exit' at the shell prompt to get back to the installation dialog." + 4) echo "Enter 'exit' at the shell prompt to get back to the installation dialog." /bin/bash if [ "$noredo" != "noredo" ] && [ -n "$question_prefix" ]; then $question_prefix @@ -960,7 +898,7 @@ function ask() { c) handle=$OPTARG ;; f) finish=$OPTARG ;; "?") ;; # ignore invalid option - :) echo $"l.$LINENO: Missing parameter to option -$OPTARG" 1>&2 ;; + :) echo "l.$LINENO: Missing parameter to option -$OPTARG" 1>&2 ;; esac done while : ; do @@ -1034,7 +972,7 @@ function syntax_check_nettype() { 0) # string matched the pattern if [ "$NETTYPE" = "iucv" ] && ! isVM; then - echo $"IUCV network type is only available under z/VM (NETTYPE)." + echo "IUCV network type is only available under z/VM (NETTYPE)." return 1 fi return 0 @@ -1049,33 +987,33 @@ function syntax_check_nettype() { echo "l.$LINENO: unexpected return code of regex match operator =~, code needs to be fixed" 1>&2 ;; esac - echo $"Incorrect format or value for network type (NETTYPE): $NETTYPE" + echo "Incorrect format or value for network type (NETTYPE): $NETTYPE" return 1 } function question_prefix_nettype() { - echo -n $"Network type" + echo -n "Network type" } function question_choices_nettype() { if isVM; then - echo $" (qeth, lcs, ctc, iucv, ? for help). Default is qeth:" + echo " (qeth, lcs, ctc, iucv, ? for help). Default is qeth:" else - echo $" (qeth, lcs, ctc, ? for help). Default is qeth:" + echo " (qeth, lcs, ctc, ? for help). Default is qeth:" fi } function helptext_nettype() { - echo $" Help text for network type:" - echo $" qeth: OSA-Express Fast Ethernet, Gigabit Ethernet (including 1000Base-T)," - echo $" High Speed Token Ring, and ATM (running Ethernet LAN emulation)" - echo $" features in QDIO mode." - echo $" [default]" - echo $" lcs: OSA-2 Ethernet/Token Ring, OSA-Express Fast Ethernet in non-QDIO mode," - echo $" OSA-Express High Speed Token Ring in non-QDIO mode and Gigabit Ethernet" - echo $" in non-QDIO mode." - echo $" ctc: Deprecated, useful for migration." - isVM && echo $" iucv: Deprecated, useful for migration." + echo " Help text for network type:" + echo " qeth: OSA-Express Fast Ethernet, Gigabit Ethernet (including 1000Base-T)," + echo " High Speed Token Ring, and ATM (running Ethernet LAN emulation)" + echo " features in QDIO mode." + echo " [default]" + echo " lcs: OSA-2 Ethernet/Token Ring, OSA-Express Fast Ethernet in non-QDIO mode," + echo " OSA-Express High Speed Token Ring in non-QDIO mode and Gigabit Ethernet" + echo " in non-QDIO mode." + echo " ctc: Deprecated, useful for migration." + isVM && echo " iucv: Deprecated, useful for migration." } function exception_nettype() { @@ -1106,15 +1044,15 @@ function do_nettype() { function do_chandev() { echo - echo $"The CHANDEV variable isn't used anymore, please update your " - echo $".parm or the .conf file to use NETTYPE, SUBCHANNELS, etc. instead." + echo "The CHANDEV variable isn't used anymore, please update your " + echo ".parm or the .conf file to use NETTYPE, SUBCHANNELS, etc. instead." echo } ### SUBCHANNELS function syntax_check_subchannels() { - SUBCHANNELS=`echo $SUBCHANNELS | tr ABCDEF abcdef` + SUBCHANNELS=$(echo $SUBCHANNELS | tr ABCDEF abcdef) # - make subchannel question dependent on NETTYPE (2 vs. 3 subchannels) if [ "$NETTYPE" = "qeth" ]; then # - match against regex, depending on qeth @@ -1130,7 +1068,7 @@ function syntax_check_subchannels() { ;; 1) # string did not match the pattern - echo $"Incorrect format for channels (SUBCHANNELS): $SUBCHANNELS" + echo "Incorrect format for channels (SUBCHANNELS): $SUBCHANNELS" ;; 2) echo "l.$LINENO: syntax error in regex of match operator =~, code needs to be fixed" 1>&2 @@ -1169,25 +1107,25 @@ function semantic_check_subchannels() { # - check for existence of devnos in sysfs if [ ! -d "$dev_p" -a "$cio_wc_bytes" != "0" ]; then # - try to free from /proc/cio_ignore if they don't exist - echo $"Device $devbusid not present, trying to clear from blacklist and resense..." + echo "Device $devbusid not present, trying to clear from blacklist and resense..." if sysecho /proc/cio_ignore "free $devbusid"; then # /proc/cio_ignore won't block on freeing devices # until resensing has been completed, so wait until - # the udev event queue depletes (without udevsettle we + # the udev event queue depletes (without udevadm settle we # could wait 2 seconds unconditionally) #debug ls -laF /dev/.udev - udevsettle + udevadm settle # even though the device might now be online, some of its # sysfs attributes (e.g. cutype) might not yet be available sleep 1 else - echo $"Device $devbusid could not be cleared from device blacklist" + echo "Device $devbusid could not be cleared from device blacklist" fi fi # reevaluate since globbing might not have worked before device existed dev_p=$(echo /sys/devices/css$prefix/$IDFORMAT/$devbusid) if [ ! -d "$dev_p" ]; then - echo $"Device $devbusid does not exist" + echo "Device $devbusid does not exist" all_subch_good=1 continue fi @@ -1200,34 +1138,40 @@ function semantic_check_subchannels() { local type read type < $subch_p/type if [ "$type" != "$SUBCHANNEL_TYPE_IO" ]; then - echo $"Channel $subch (device $devbusid) is not of type I/O" + echo "Channel $subch (device $devbusid) is not of type I/O" all_subch_good=1 continue fi fi # - check for correct CU type/model, depending on qeth/lcs/ctc if [ ! -f $dev_p/cutype ]; then - echo $"Device $devbusid does not have required sysfs attribute 'cutype'" + echo "Device $devbusid does not have required sysfs attribute 'cutype'" all_subch_good=1 continue fi local cutype read cutype < $dev_p/cutype if search_cu $cutype; then - if [ "${CU_DEVDRV[$cu_idx]}" != "$NETTYPE" ]; then - echo $"Device $devbusid has control unit type $cutype," - echo $" which does not match your selected network type $NETTYPE" + local driver + if [ "$NETTYPE" = "ctc" ]; then + driver="ctcm" + else + driver=$NETTYPE + fi + if [ "${CU_DEVDRV[$cu_idx]}" != "$driver" ]; then + echo "Device $devbusid has control unit type $cutype," + echo " which does not match your selected network type $NETTYPE" all_subch_good=1 continue fi else - echo $"Device $devbusid has control unit type $cutype which is unknown" + echo "Device $devbusid has control unit type $cutype which is unknown" all_subch_good=1 continue fi # read CHPIDs information about subchannels if [ ! -f $subch_p/chpids ]; then - echo $"Channel $subch (device $devbusid) does not have required sysfs attribute 'chpids'" + echo "Channel $subch (device $devbusid) does not have required sysfs attribute 'chpids'" all_subch_good=1 continue fi @@ -1236,10 +1180,10 @@ function semantic_check_subchannels() { local -a chpids read -a chpids <<< "$chpid_list" if [ ${#chpids[@]} -ne 8 ]; then - echo $"sysfs reported ${#chpids[@]} CHPIDs instead of expected 8, code needs fix" + echo "sysfs reported ${#chpids[@]} CHPIDs instead of expected 8, code needs fix" fi if [ ! -f $subch_p/pimpampom ]; then - echo $"Channel $subch (device $devbusid) does not have required sysfs attribute 'pimpampom'" + echo "Channel $subch (device $devbusid) does not have required sysfs attribute 'pimpampom'" all_subch_good=1 continue fi @@ -1256,7 +1200,7 @@ function semantic_check_subchannels() { done local pimchpids=${pimchpidZ//ZZ/} if [ "x$pimchpids" == "x" ]; then - echo $"Channel $subch (device $devbusid) does not have any installed channel path" + echo "Channel $subch (device $devbusid) does not have any installed channel path" all_subch_good=1 continue fi @@ -1274,27 +1218,28 @@ function semantic_check_subchannels() { # => be sure to quote all variable accesses in test statements. # - all subchannels must be of same CU type/model if [ "$cutype" != "$sch_r_cutype" ]; then - echo $"Device $devbusid does not have the same control unit type as device $SCH_R_DEVBUSID" + echo "Device $devbusid does not have the same control unit type as device $SCH_R_DEVBUSID" comparison=1 fi # - all subchannels must have same CHPIDs if [ "$pimchpidZ" != "$sch_r_pimchipidZ" ]; then - echo $"Device $devbusid does not have the same CHPIDs as device $SCH_R_DEVBUSID" + echo "Device $devbusid does not have the same CHPIDs as device $SCH_R_DEVBUSID" comparison=1 fi # - all subchannels should have same prefix & ssid ? if [ "$prefix" != "$sch_r_prefix" \ -o "$ssid" != "$sch_r_ssid" ]; then - echo $"Device $devbusid does not have the same prefix and subchannel set ID as device $SCH_R_DEVBUSID" + echo "Device $devbusid does not have the same prefix and subchannel set ID as device $SCH_R_DEVBUSID" comparison=1 fi if [ "$i" -eq 2 ]; then local sch_w_devbusid=$devbusid local sch_w_devno=$devno + # TODO: not true for CTCM => relax # - write_devbusid == read_devbusid+1 if [ $((0x$devno)) -ne $((0x$sch_r_devno + 1)) ]; then - echo $"Device bus ID of write channel (dev $devbusid) must be one larger than" - echo $" that of read channel (dev $SCH_R_DEVBUSID)" + echo "Device bus ID of write channel (dev $devbusid) must be one larger than" + echo " that of read channel (dev $SCH_R_DEVBUSID)" comparison=1 fi elif [ "$i" -eq 3 ]; then @@ -1302,8 +1247,8 @@ function semantic_check_subchannels() { # (also seems to be handled by ccwgroup kernel subsystem) if [ "$devbusid" = "$sch_w_devbusid" \ -o "$devbusid" = "$SCH_R_DEVBUSID" ]; then - echo $"Device bus ID of data channel (dev $devbusid) must be different to that of" - echo $" read channel ($SCH_R_DEVBUSID) and write channel ($sch_w_devbusid)" + echo "Device bus ID of data channel (dev $devbusid) must be different to that of" + echo " read channel ($SCH_R_DEVBUSID) and write channel ($sch_w_devbusid)" comparison=1 fi fi @@ -1314,32 +1259,32 @@ function semantic_check_subchannels() { fi # filter potentially good subchannels ... if [ -h $dev_p/group_device ]; then - echo $"Device $devbusid is already in a ccwgroup and thus unavailable" + echo "Device $devbusid is already in a ccwgroup and thus unavailable" all_subch_good=1 continue fi if [ ! -f $dev_p/online ]; then - echo $"Device $devbusid does not have required sysfs attribute 'online'" + echo "Device $devbusid does not have required sysfs attribute 'online'" all_subch_good=1 continue fi local online read online < $dev_p/online if [ "$online" = "1" ]; then - echo $"Device $devbusid is already in use and thus unavailable" + echo "Device $devbusid is already in use and thus unavailable" all_subch_good=1 continue fi # - check availability if [ ! -f $dev_p/availability ]; then - echo $"Device $devbusid does not have required sysfs attribute 'availability'" + echo "Device $devbusid does not have required sysfs attribute 'availability'" all_subch_good=1 continue fi local availability read availability < $dev_p/availability if [ "$availability" != "good" ]; then - echo $"Device $devbusid is not available but '$availiability'" + echo "Device $devbusid is not available but '$availiability'" all_subch_good=1 continue fi @@ -1353,62 +1298,70 @@ function semantic_check_subchannels() { function handle_subchannels() { # - try to establish ccwgroup right here and fail out on error - if sysecho /sys/bus/ccwgroup/drivers/${NETTYPE}/group "$SUBCHANNELS"; then + local driver + if [ "$NETTYPE" = "ctc" ]; then + driver="ctcm" + else + driver=$NETTYPE + fi + if sysecho /sys/bus/ccwgroup/drivers/${driver}/group "$SUBCHANNELS"; then case "$NETTYPE" in qeth) # Just preliminary card_type info until device goes online! - # In fact it seems enough to separate OSA from HiperSocket. + # In fact it seems enough to separate OSA from HiperSockets. if [ -f /sys/devices/qeth/$SCH_R_DEVBUSID/card_type ]; then read cardtype < /sys/devices/qeth/$SCH_R_DEVBUSID/card_type else - echo $"Could not read qeth network card type from sysfs." + echo "Could not read qeth network card type from sysfs." fi ;; ctc|lcs) if [ -f /sys/devices/cu3088/$SCH_R_DEVBUSID/type ]; then - local type=$(cat /sys/devices/cu3088/$SCH_R_DEVBUSID/type) - [ "$type" = "CTC/A" ] && type="channel-to-channel adapter" + local type + read type < /sys/devices/cu3088/$SCH_R_DEVBUSID/type + [ "$type" = "CTC/A" ] && \ + type="channel-to-channel adapter (CTC/A)" echo "Detected: $type" else - echo $"Could not read ctc network card type from sysfs." + echo "Could not read ctc network card type from sysfs." fi ;; esac return 0 else - echo $"Channels $SUBCHANNELS could not be grouped" + echo "Channels $SUBCHANNELS could not be grouped" fi return 1 } function question_prefix_subchannels() { if [ "$NETTYPE" = "qeth" ]; then - echo -n $"Read,write,data channel" + echo -n "Read,write,data channel" else - echo -n $"Read,write channel" + echo -n "Read,write channel" fi } function question_choices_subchannels() { if [ "$NETTYPE" = "qeth" ]; then - echo $" (e.g. 0.0.0300,0.0.0301,0.0.0302 or ? for help)." + echo " (e.g. 0.0.0300,0.0.0301,0.0.0302 or ? for help)." else - echo $" (e.g. 0.0.0600,0.0.0601 or ? for help)" + echo " (e.g. 0.0.0600,0.0.0601 or ? for help)" fi } function helptext_subchannels() { if [ "$NETTYPE" = "qeth" ]; then - echo $" Help text for qeth channels:" - echo $" Enter the device bus ID of your CCW devices." - echo $" QETH needs three channels for read, write, and data," - echo $" e.g. 0.0.0300,0.0.0301,0.0.0302" + echo " Help text for qeth channels:" + echo " Enter the device bus ID of your CCW devices." + echo " QETH needs three channels for read, write, and data," + echo " e.g. 0.0.0300,0.0.0301,0.0.0302" else - echo $" Help text for lcs/ctc channels:" - echo $" Enter the device bus ID of your CCW devices." - echo $" CTC/ESCON and LCS need two channels for read and write," - echo $" e.g. 0.0.0600,0.0.0601 will configure the CTC or ESCON interface" - echo $" with the channels 0x600 and 0x601" + echo " Help text for lcs/ctc channels:" + echo " Enter the device bus ID of your CCW devices." + echo " CTC/ESCON and LCS need two channels for read and write," + echo " e.g. 0.0.0600,0.0.0601 will configure the CTC or ESCON interface" + echo " with the channels 0x600 and 0x601" fi } @@ -1436,12 +1389,12 @@ function do_subchannels() { function syntax_check_portname() { # - 1-8 characters, we convert it to upper case - PORTNAME=`echo $PORTNAME | tr '[:lower:]' '[:upper:]'` + PORTNAME=$(echo $PORTNAME | tr '[:lower:]' '[:upper:]') local portname_len=${#PORTNAME} if [ "$portname_len" -ge 1 -a "$portname_len" -le 8 ]; then return 0 fi - echo $"Incorrect string length [1..8] for portname (PORTNAME): $PORTNAME" + echo "Incorrect string length [1..8] for portname (PORTNAME): $PORTNAME" return 1 } @@ -1451,7 +1404,7 @@ function handle_portname() { if sysecho /sys/devices/${NETTYPE}/$SCH_R_DEVBUSID/portname "$PORTNAME"; then return 0 else - echo $"Portname '$PORTNAME' could not be configured for $SUBCHANNELS" + echo "Portname '$PORTNAME' could not be configured for $SUBCHANNELS" fi return 1 } @@ -1461,35 +1414,35 @@ function hint_portname() { local pname_hint read pname_hint < /sys/devices/${NETTYPE}/$SCH_R_DEVBUSID/portname if [ "$pname_hint" = "no portname required" ]; then - echo $" * Your configuration does not require a portname. *" + echo " * Your configuration does not require a portname. *" fi fi } function question_prefix_portname(){ - echo -n $"Portname" + echo -n "Portname" } function question_choices_portname(){ - echo $" (1..8 characters, or ? for help). Default is no portname:" + echo " (1..8 characters, or ? for help). Default is no portname:" } function helptext_portname(){ - echo $" Help text for portname:" + echo " Help text for portname:" # updated text describing when portname is obsolete; # taken from: # SA22-7935-09, Open Systems Adapter-Express Customer's # Guide and Reference, 10th ed. May 2008, IBM, p.17f. # SC33-8411-00, Device Drivers, Features, and Commands, # 1st ed. May 2008, IBM, p.116. - echo $" Portname of the OSA-Express feature in QDIO mode and z/VM Guest LAN." - echo $" This parameter is optional with:" - echo $" - z/VM 4.4.0 or z/VM 4.3.0 with APARs VM63308 and PQ73878" - echo $" - z800, z900 with >= Driver 3G - EC stream J11204, MCL032 (OSA level 3.33)" - echo $" - z890, z990, z9, z10 mainframes" + echo " Portname of the OSA-Express feature in QDIO mode and z/VM Guest LAN." + echo " This parameter is optional with:" + echo " - z/VM 4.4.0 or z/VM 4.3.0 with APARs VM63308 and PQ73878" + echo " - z800, z900 with >= Driver 3G - EC stream J11204, MCL032 (OSA level 3.33)" + echo " - z890, z990, z9, z10 mainframes" hint_portname - echo $" If portname is used, all operating systems sharing port must use same name." - echo $" Input empty string if you don't want to enter a portname. [default]" + echo " If portname is used, all operating systems sharing port must use same name." + echo " Input empty string if you don't want to enter a portname. [default]" } function exception_portname(){ @@ -1511,7 +1464,7 @@ function syntax_check_qeth_portno() { return 0 ;; esac - echo $"Incorrect format or value for relative port number (PORTNO): $PORTNO" + echo "Incorrect format or value for relative port number (PORTNO): $PORTNO" return 1 } @@ -1519,30 +1472,30 @@ function handle_qeth_portno() { if sysecho /sys/devices/qeth/$SCH_R_DEVBUSID/portno "$PORTNO"; then return 0 fi - echo $"Could not configure relative port number $PORTNO for $SUBCHANNELS" + echo "Could not configure relative port number $PORTNO for $SUBCHANNELS" return 1 } function question_prefix_portno() { - echo -n $"Relative port number for OSA" + echo -n "Relative port number for OSA" } function question_choices_portno() { - echo $" (0, 1, or ? for help). Default is 0:" + echo " (0, 1, or ? for help). Default is 0:" } function helptext_portno() { - echo $" Help text for relative port number for OSA with 2 ports per CHPID:" - echo $" This applies to:" - echo $" - OSA-Express3 Gigabit Ethernet on z10 systems" - echo $" - OSA-Express ATM on zSeries 800 and 900 systems" - echo $" 0 for relative port number 0 [default]" - echo $" 1 for relative port number 1" - echo $" Input empty string to not modify the default configuration." + echo " Help text for relative port number for OSA with 2 ports per CHPID:" + echo " This applies to:" + echo " - OSA-Express3 Gigabit Ethernet on z10 systems" + echo " - OSA-Express ATM on zSeries 800 and 900 systems" + echo " 0 for relative port number 0 [default]" + echo " 1 for relative port number 1" + echo " Input empty string to not modify the default configuration." } function exception_portno() { - # Writing portno of e.g. hipersocket device fails. + # Writing portno of e.g. hipersockets device fails. # Therefore, do not configure on empty default value. [ -z "$PORTNO" ] && break } @@ -1563,7 +1516,7 @@ function syntax_check_layer2() { return 0 ;; esac - echo $"Incorrect format or value for layer2 mode (LAYER2): $LAYER2" + echo "Incorrect format or value for layer2 mode (LAYER2): $LAYER2" return 1 } @@ -1574,37 +1527,41 @@ function handle_layer2() { if sysecho /sys/devices/${NETTYPE}/$SCH_R_DEVBUSID/layer2 "$LAYER2"; then return 0 else - echo $"Layer2 mode '$LAYER2' could not be configured for $SUBCHANNELS" + echo "Layer2 mode '$LAYER2' could not be configured for $SUBCHANNELS" fi return 1 } function question_prefix_layer2() { - echo -n $"Layer mode" + echo -n "Layer mode" } function question_choices_layer2() { - echo -n $" (0 for layer3, 1 for layer2, or ? for help)." + echo -n " (0 for layer3, 1 for layer2, or ? for help)." if [ "$isLayer2Default" = "yes" ]; then - echo $" Default is 1:" + echo " Default is 1:" else - echo $" Default is 0:" + echo " Default is 0:" fi } function helptext_layer2() { - echo $" Help text for OSA mode of operation: layer 2 vs. layer 3" + echo " Help text for OSA mode of operation: layer 2 vs. layer 3" if [ "$isLayer2Default" = "yes" ]; then - echo $" 0 for layer 3 mode (may not work with dhcp, tcpdump, etc.)" - echo $" 1 for layer 2 mode [default]" + echo " 0 for layer 3 mode (may not work with dhcp, tcpdump, etc.)" + echo " 1 for layer 2 mode [default]" else - echo $" 0 for layer 3 mode [default] (may not work with dhcp, tcpdump, etc.)" - echo $" 1 for layer 2 mode" + echo " 0 for layer 3 mode [default] (may not work with dhcp, tcpdump, etc.)" + echo " 1 for layer 2 mode" fi } function exception_layer2() { - [ -z "$LAYER2" ] && break + if [ -z "$LAYER2" ]; then + isLayer2Default && LAYER2=1 || LAYER2=0 + # do not break, always apply, default may differ from online layer mode + #break + fi } function do_layer2() { @@ -1627,7 +1584,7 @@ function syntax_check_macaddr() { ;; 1) # string did not match the pattern - echo $"Incorrect format for mac address (MACADDR): $MACADDR" + echo "Incorrect format for mac address (MACADDR): $MACADDR" ;; 2) echo "l.$LINENO: syntax error in regex of match operator =~, code needs to be fixed" 1>&2 @@ -1645,47 +1602,46 @@ function handle_macaddr() { if debug ifconfig $DEVICE hw ether $MACADDR; then return 0 fi - echo $"MAC address $MACADDR could not be configured for" - echo $" $SUBCHANNELS (network device $DEVICE)" + echo "MAC address $MACADDR could not be configured for" + echo " $SUBCHANNELS (network device $DEVICE)" return 1 } function question_prefix_macaddr() { - echo -n $"Unique MAC address" + echo -n "Unique MAC address" } function question_choices_macaddr() { - echo -n $" (e.g. 02:00:00:00:00:00, ? for help)." - # for virtual OSAs macaddr is optional and defaults to not specifying one - if [ -z "${cardtype//OSD_*/}" ]; then - echo - else - echo $" Default is automatic:" - fi + macaddr_default=$(ifconfig $DEVICE | grep 'HWaddr' | sed 's/.*HWaddr \([[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]\).*/\1/') + echo " (e.g. 02:00:00:00:00:00, ? for help). Default is $macaddr_default:" } function helptext_macaddr() { - echo $" Help text for MAC address:" - echo $" This is required for real OSA in layer 2 mode." - echo $" If connecting to a layer 2 VSWITCH, a MAC address is automatically assigned." - echo -n $" You may accept the automatic MAC address with an empty input." + echo " Help text for MAC address:" if [ -z "${cardtype//OSD_*/}" ]; then - echo + echo " For real OSA in layer 2 mode, a random MAC address is automatically assigned." else - echo $" [default]" + echo " If connecting to a layer 2 VSWITCH, a MAC address is automatically assigned." fi - echo $" You may override the automatic MAC address with non-empty input." - echo $" An example MAC address would be: 02:00:00:00:00:00" + echo " You may accept the automatic MAC address with an empty input. [default]" + echo " If the automatic address is not unique, please provide a MAC address." + [ -z "${cardtype//OSD_*/}" ] && \ + echo " For real OSA, the provided address must be different from that of the OSA." + echo " You may override the automatic MAC address with non-empty input." + echo " An example MAC address would be: 02:00:00:00:00:00" } function exception_macaddr() { - # for real OSAs macaddr is required - if [ -n "${cardtype//OSD_*/}" ]; then - # for virtual OSAs macaddr is optional - if [ -z "$MACADDR" ]; then + if [ -z "$MACADDR" ]; then + if [ -z "${cardtype//OSD_*/}" ]; then + # keep random default MAC address of real OSA, + # so the OSA comes up with the same MAC each time in the future + MACADDR=$macaddr_default + else + # virtual OSA in layer2 is GuestLAN or VSWITCH VSWITCH=1 - break fi + break fi } @@ -1708,10 +1664,10 @@ function syntax_check_ctcprot() { return 0 ;; x2) - echo $"CTC tty's are not usable for this installation (CTCPROT)" + echo "CTC tty's are not usable for this installation (CTCPROT)" ;; *) - echo $"Incorrect format or value for CTC protocol (CTCPROT): $CTCPROT" + echo "Incorrect format or value for CTC protocol (CTCPROT): $CTCPROT" ;; esac return 1 @@ -1722,24 +1678,24 @@ function handle_ctcprot() { if sysecho /sys/devices/cu3088/${SCH_R_DEVBUSID}/protocol "$CTCPROT"; then return 0 fi - echo $"Could not configure CTC protocol $CTCPROT for $SUBCHANNELS" + echo "Could not configure CTC protocol $CTCPROT for $SUBCHANNELS" return 1 } function question_prefix_ctcprot() { - echo -n $"CTC protocol" + echo -n "CTC protocol" } function question_choices_ctcprot() { - echo $" (0, 1, 3, or ? for help). Default is 0:" + echo " (0, 1, 3, or ? for help). Default is 0:" } function helptext_ctcprot() { - echo $" Help text for CTC protocol:" - echo $" Protocol which should be used for the CTC interface" - echo $" 0 for compatibility with p.e. VM TCP service machine [default]" - echo $" 1 for enhanced package checking for Linux peers" - echo $" 3 for compatibility with OS/390 or z/OS peers" + echo " Help text for CTC protocol:" + echo " Protocol which should be used for the CTC interface" + echo " 0 for compatibility with p.e. VM TCP service machine [default]" + echo " 1 for enhanced package checking for Linux peers" + echo " 3 for compatibility with OS/390 or z/OS peers" } function do_ctcprot() { @@ -1767,7 +1723,7 @@ function syntax_check_lcs_portno() { echo "l.$LINENO: unexpected return code of regex match operator =~, code needs to be fixed" 1>&2 ;; esac - echo $"Incorrect format for LCS port number (PORTNAME): $PORTNAME" + echo "Incorrect format for LCS port number (PORTNAME): $PORTNAME" return 1 } @@ -1776,21 +1732,21 @@ function handle_lcs_portno() { if sysecho /sys/devices/cu3088/$SCH_R_DEVBUSID/portno "$PORTNAME"; then return 0 fi - echo $"Could not configure relative port number $PORTNAME for $SUBCHANNELS" + echo "Could not configure relative port number $PORTNAME for $SUBCHANNELS" return 1 } function question_prefix_lcs_portno() { - echo -n $"Relative port number of your LCS device" + echo -n "Relative port number of your LCS device" } function question_choices_lcs_portno() { - echo $" (number or ? for help). Default is 0:" + echo " (number or ? for help). Default is 0:" } function helptext_lcs_portno() { - echo $" Help text for relative port number of LCS device:" - echo $" Required for OSA-Express ATM cards only." + echo " Help text for relative port number of LCS device:" + echo " Required for OSA-Express ATM cards only." } function exception_lcs_portno() { @@ -1810,10 +1766,10 @@ function do_lcs_portno() { function syntax_check_peerid() { if [ "${#PEERID}" -lt 0 -o "${#PEERID}" -gt 8 ]; then - echo $"Incorrect string length [0..8] for IUCV connection to peer (PEERID): $PEERID" + echo "Incorrect string length [0..8] for IUCV connection to peer (PEERID): $PEERID" return 1 fi - PEERID=`echo $PEERID | tr '[:lower:]' '[:upper:]'` + PEERID=$(echo $PEERID | tr '[:lower:]' '[:upper:]') [[ "$PEERID" =~ ^[[:alnum:]$]{0,8}$ ]] case $? in 0) @@ -1830,13 +1786,13 @@ function syntax_check_peerid() { echo "l.$LINENO: unexpected return code of regex match operator =~, code needs to be fixed" 1>&2 ;; esac - echo $"Incorrect format for IUCV connection to peer (PEERID): $PEERID" + echo "Incorrect format for IUCV connection to peer (PEERID): $PEERID" return 1 } function handle_peerid() { if ! sysecho /sys/bus/iucv/drivers/netiucv/connection "$PEERID"; then - echo $"Could not create new IUCV connection to peer $PEERID" + echo "Could not create new IUCV connection to peer $PEERID" return 1 fi # find netiucv with proper guest user ID in @@ -1848,41 +1804,41 @@ function handle_peerid() { [ "$user" = "$PEERID" ] && break done < <(ls -1 /sys/devices/iucv/netiucv[0-9]*/user 2> /dev/null) if [ "$user" != "$PEERID" ]; then - echo $"Could not find configured connection to peer $PEERID" + echo "Could not find configured connection to peer $PEERID" return 1 fi local netiucv=${userpath%%/user} netiucv=${netiucv##*/} if [ "$netiucv" = "" ]; then - echo $"Could not get netiucv instance for peer $PEERID" + echo "Could not get netiucv instance for peer $PEERID" return 1 fi if [ ! -h /sys/devices/iucv/${netiucv}/net:* ]; then - echo $"Device $netiucv does not have required sysfs attribute 'net:*'" + echo "Device $netiucv does not have required sysfs attribute 'net:*'" return 1 fi DEVICE=$(echo /sys/devices/iucv/${netiucv}/net:*) DEVICE=${DEVICE//*:/} if [ "$DEVICE" = "" ]; then - echo $"Could not get device name for $netiucv" + echo "Could not get device name for $netiucv" return 1 fi return 0 } function question_prefix_peerid() { - echo -n $"Peer ID of the VM guest to connect to" + echo -n "Peer ID of the VM guest to connect to" } function question_choices_peerid() { - echo $" (0..8 characters or ? for help):" + echo " (0..8 characters or ? for help):" } function helptext_peerid() { - echo $" Help text for the peer ID of the VM guest you want to connect to:" - echo $" User ID of a VM guest you want to connect to." - echo $" 0..8 alphabetic/numeric characters or dollar-signs '$'." - echo $" Your input will be converted to uppercase." + echo " Help text for the peer ID of the VM guest you want to connect to:" + echo " User ID of a VM guest you want to connect to." + echo " 0..8 alphabetic/numeric characters or dollar-signs '$'." + echo " Your input will be converted to uppercase." } function do_peerid() { @@ -1894,28 +1850,28 @@ function do_peerid() { ### HOSTNAME function syntax_check_hostname() { - syntax_check_domainname "$HOSTNAME" $"Incorrect format for hostname (HOSTNAME): $HOSTNAME" + syntax_check_domainname "$HOSTNAME" "Incorrect format for hostname (HOSTNAME): $HOSTNAME" } function handle_hostname() { if ! hostname $HOSTNAME; then - echo $"Could not configure hostname $HOSTNAME" + echo "Could not configure hostname $HOSTNAME" return 1 fi return 0 } function question_prefix_hostname() { - echo -n $"Hostname of your new Linux guest" + echo -n "Hostname of your new Linux guest" } function question_choices_hostname() { - echo $" (FQDN e.g. s390.redhat.com or ? for help):" + echo " (FQDN e.g. s390.redhat.com or ? for help):" } function helptext_hostname() { - echo $" Help text for hostname:" - echo $" Enter the full qualified domain name of your host." + echo " Help text for hostname:" + echo " Enter the full qualified domain name of your host." } function do_hostname() { @@ -1936,33 +1892,31 @@ function syntax_check_ipaddr() { ipv6="yes" return 0 fi - echo $"Incorrect format for IP address (IPADDR): $IPADDR" + echo "Incorrect format for IP address (IPADDR): $IPADDR" return 1 } function question_prefix_ipaddr() { - echo -n $"IPv4 address" - [ "$ipv6_capable" = "yes" ] && echo -n $" / IPv6 addr." + echo -n "IPv4 address" + [ "$ipv6_capable" = "yes" ] && echo -n " / IPv6 addr." } function question_choices_ipaddr() { - echo -n $" (e.g. 10.0.0.2" - [ "$ipv6_capable" = "yes" ] && echo -n $" / 2001:0DB8::" - echo $" or ? for help)" + echo -n " (e.g. 10.0.0.2" + [ "$ipv6_capable" = "yes" ] && echo -n " / 2001:0DB8::" + echo " or ? for help)" } function helptext_ipaddr() { - echo $" Help text for IP address:" - echo $" Enter a valid IPv4 address of your new Linux guest (e.g. 10.0.0.2)" + echo " Help text for IP address:" + echo " Enter a valid IPv4 address of your new Linux guest (e.g. 10.0.0.2)" if [ "$ipv6_capable" = "yes" ]; then - echo $" or alternatively a valid IPv6 address without CIDR prefix (e.g. 2001:0DB8::)" - echo $" IPv6 is supported on:" - echo $" - Ethernet interfaces of the OSA-Express adapter running in QDIO mode." - echo $" - HiperSockets layer 2 interfaces" - [ $(linux_version) -ge $(kernel_version 2 6 26) ] && \ - echo $" - HiperSockets layer 3 interfaces" - echo $" - z/VM guest LAN interfaces running in QDIO mode." - echo $" IPv6 is not supported on HiperSocket guest LAN, OSA-Express Token Ring, ATM." + echo " or alternatively a valid IPv6 address without CIDR prefix (e.g. 2001:0DB8::)" + echo " IPv6 is supported on:" + echo " - Ethernet interfaces of the OSA-Express adapter running in QDIO mode." + echo " - HiperSockets interfaces" + echo " - z/VM guest LAN interfaces running in QDIO mode." + echo " IPv6 is not supported on HiperSockets guest LAN, OSA-Express Token Ring, ATM." fi } @@ -1983,18 +1937,18 @@ function syntax_check_netmask_v4() { ipcalc_arg="$IPADDR/$NETMASK" return 0 fi - echo $"Incorrect value for network prefix [1..32] (NETMASK): $NETMASK" + echo "Incorrect value for network prefix [1..32] (NETMASK): $NETMASK" return 1 elif checkipv4 $NETMASK; then ipcalc_arg="$IPADDR $NETMASK" return 0 fi - echo $"Incorrect format or value for network mask (NETMASK): $NETMASK" + echo "Incorrect format or value for network mask (NETMASK): $NETMASK" return 1 } function question_prefix_netmask() { - echo -n $"IPv4 netmask or CIDR prefix" + echo -n "IPv4 netmask or CIDR prefix" } function hint_netmask_v4() { @@ -2007,13 +1961,13 @@ function hint_netmask_v4() { # <<EOF convince syntax highlighter that above shifts are no here documents if [ $(( ip & 0x80000000 )) -eq $(( 0x00000000 )) ]; then # class a - echo $"255.0.0.0" + echo "255.0.0.0" elif [ $(( ip & 0xC0000000 )) -eq $(( 0x80000000 )) ]; then # class b - echo $"255.255.0.0" + echo "255.255.0.0" elif [ $(( ip & 0xE0000000 )) -eq $(( 0xC0000000 )) ]; then # class c - echo $"255.255.255.0" + echo "255.255.255.0" else # some other class that should not be used as host address return 1 @@ -2022,24 +1976,24 @@ function hint_netmask_v4() { } function question_choices_netmask() { - echo -n $" (e.g. 255.255.255.0 or 1..32 or ? for help)" + echo -n " (e.g. 255.255.255.0 or 1..32 or ? for help)" local default=$(hint_netmask_v4) if [ -n "$default" ]; then - echo $". Default is $default:" + echo ". Default is $default:" else - echo $":" - echo $"The IP address you entered previously should probably not be used for a host." + echo ":" + echo "The IP address you entered previously should probably not be used for a host." fi } function helptext_netmask() { - echo $" Help text for IPv4 netmask or CIDR prefix:" - echo $" Enter a valid IPv4 netmask or CIDR prefix (e.g. 255.255.255.0 or 1..32)" + echo " Help text for IPv4 netmask or CIDR prefix:" + echo " Enter a valid IPv4 netmask or CIDR prefix (e.g. 255.255.255.0 or 1..32)" local default=$(hint_netmask_v4) if [ -n "$default" ]; then - echo $" Default is $default" + echo " Default is $default" else - echo $"The IP address you entered previously should probably not be used for a host." + echo "The IP address you entered previously should probably not be used for a host." fi } @@ -2065,16 +2019,16 @@ function syntax_check_prefix_v6() { return 0 fi fi - echo $"Incorrect value for network prefix [1..128] (NETMASK): $NETMASK" + echo "Incorrect value for network prefix [1..128] (NETMASK): $NETMASK" return 1 } function question_prefix_netmask_v6() { - echo -n $"CIDR prefix for the IPv6 address" + echo -n "CIDR prefix for the IPv6 address" } function question_choices_netmask_v6() { - echo $" (1..128):" + echo " (1..128):" } function do_netmask_v6() { @@ -2098,11 +2052,11 @@ function configure_ipv4_gateway() { ip -4 route del default dev $DEVICE >& /dev/null [ -z "$GATEWAY" ] && return 0 if ! tv route add default gw $GATEWAY dev $DEVICE; then - echo $"Could net set default route on device $DEVICE via gateway $GATEWAY" + echo "Could net set default route on device $DEVICE via gateway $GATEWAY" return 1 fi # BH FIXME: Workaround for manual MACADDR, need ping to update arp table - echo $"Trying to reach gateway $GATEWAY..." + echo "Trying to reach gateway $GATEWAY..." if [ "$NETTYPE" = "ctc" ]; then # (virtual) CTC(/A) seems to need some time to get functional local i=1 @@ -2110,13 +2064,13 @@ function configure_ipv4_gateway() { ping -c 1 $GATEWAY >& /dev/null && break i=$((i+1)) if [ "$i" -gt 3 ]; then - echo $"Could not reach gateway $GATEWAY within timeout" + echo "Could not reach gateway $GATEWAY within timeout" return 1 fi done else if ! ping -c 1 $GATEWAY >& /dev/null; then - echo $"Could not reach your default gateway $GATEWAY" + echo "Could not reach your default gateway $GATEWAY" return 1 fi fi @@ -2142,29 +2096,29 @@ function hint_ipv4_gateway() { local hi_b=$(( (hi & 0x00FF0000) >> 16 )) local hi_c=$(( (hi & 0x0000FF00) >> 8 )) local hi_d=$(( (hi & 0x000000FE) )) - echo $" Depending on your network design patterns, the default gateway" - echo $" might be $lo_a.$lo_b.$lo_c.$lo_d or $hi_a.$hi_b.$hi_c.$hi_d" + echo " Depending on your network design patterns, the default gateway" + echo " might be $lo_a.$lo_b.$lo_c.$lo_d or $hi_a.$hi_b.$hi_c.$hi_d" } function question_prefix_gateway() { - echo -n $"IPv4 address of your default gateway" + echo -n "IPv4 address of your default gateway" } function question_choices_gateway() { - echo $" or ? for help:" + echo " or ? for help:" } function helptext_gateway() { - echo $" Help text for IPv4 default gateway:" - echo $" For HiperSockets with internal traffic only you may want to leave this empty" - echo $" and choose continue afterwards to go on without gateway." + echo " Help text for IPv4 default gateway:" + echo " For HiperSockets with internal traffic only you may want to leave this empty" + echo " and choose continue afterwards to go on without gateway." hint_ipv4_gateway } function finish_gateway() { if ! checkipv4 $GATEWAY; then # above checkipv4 is silent, so make up for syntax error - echo $"Incorrect format for IPv4 address of gateway (GATEWAY): $GATEWAY" + echo "Incorrect format for IPv4 address of gateway (GATEWAY): $GATEWAY" workflow_item_menu fi if configure_ipv4_gateway; then @@ -2203,37 +2157,37 @@ function configure_ipv6_gateway() { # ip -6 route show | grep ^default # However, we currently use manual IPv6 configuration only.) if ! debug ip -6 route add ::/0 dev $DEVICE via $GATEWAY; then - echo $"Could net set default route on device $DEVICE" - echo $" via gateway $GATEWAY" + echo "Could net set default route on device $DEVICE" + echo " via gateway $GATEWAY" return 1 fi # BH FIXME: Workaround for manual MACADDR, need ping to update arp table - echo $"Trying to reach gateway $GATEWAY..." + echo "Trying to reach gateway $GATEWAY..." if ! ping6 -c 1 $GATEWAY >& /dev/null; then - echo $"Could not reach your default gateway $GATEWAY" + echo "Could not reach your default gateway $GATEWAY" return 1 fi return 0 } function question_prefix_gateway_v6() { - echo -n $"IPv6 address of your default gateway" + echo -n "IPv6 address of your default gateway" } function question_choices_gateway_v6() { - echo $":" + echo ":" } function helptext_gateway_v6() { - echo $" Help text for IPv6 default gateway:" - echo $" For HiperSockets with internal traffic only you may want to leave this empty" - echo $" and choose continue afterwards to go on without gateway." + echo " Help text for IPv6 default gateway:" + echo " For HiperSockets with internal traffic only you may want to leave this empty" + echo " and choose continue afterwards to go on without gateway." } function finish_gateway_v6() { if ! checkipv6 $GATEWAY; then # above checkipv6 is silent, so make up for syntax error - echo $"Incorrect format for IPv6 address of gateway (GATEWAY): $GATEWAY" + echo "Incorrect format for IPv6 address of gateway (GATEWAY): $GATEWAY" workflow_item_menu fi if configure_ipv6_gateway; then @@ -2259,37 +2213,37 @@ function configure_ipv4_ptp() { configure_ipv4_gateway return $? fi - echo $"Could not set IPv4 address $IPADDR for device $DEVICE" - echo $" to peer $GATEWAY" - [ -n "$MMTU" ] && echo $" and maximum transfer unit: $MMTU" + echo "Could not set IPv4 address $IPADDR for device $DEVICE" + echo " to peer $GATEWAY" + [ -n "$MMTU" ] && echo " and maximum transfer unit: $MMTU" return 1 } function question_prefix_ptp_gateway() { - echo -n $"IPv4 address of your point-to-point partner" + echo -n "IPv4 address of your point-to-point partner" } function question_choices_ptp_gateway() { - echo $" or ? for help:" + echo " or ? for help:" # no hinting possible here } function helptext_ptp_gateway() { - echo $" Help text for point-to-point partner:" - echo $" IPv4 address of your CTC / ESCON / IUCV point-to-point partner." + echo " Help text for point-to-point partner:" + echo " IPv4 address of your CTC / ESCON / IUCV point-to-point partner." } function finish_ptp_gateway() { if checkipv4 $GATEWAY; then if [ "$GATEWAY" = "$IPADDR" ]; then - echo $"IPv4 address of partner should probably be different from the guest's address" + echo "IPv4 address of partner should probably be different from the guest's address" workflow_item_menu && break else break fi else # above checkipv4 is silent, so make up for syntax error - echo $"Incorrect format for IPv4 address of partner (GATEWAY): $GATEWAY" + echo "Incorrect format for IPv4 address of partner (GATEWAY): $GATEWAY" workflow_item_menu && break fi # too early to actually configure gateway @@ -2305,7 +2259,7 @@ function do_ptp_gateway() { function syntax_check_dns() { if [ -z "$DNS" ]; then - echo $"You might encounter problems without a nameserver, especially with FTP installs" + echo "You might encounter problems without a nameserver, especially with FTP installs" return 1 fi local dnsitem @@ -2313,14 +2267,14 @@ function syntax_check_dns() { if [ "$ipv6" ]; then while read dnsitem; do if ! checkipv6 $dnsitem; then - echo $"Not a valid IPv6 address for DNS server: $dnsitem" + echo "Not a valid IPv6 address for DNS server: $dnsitem" allgood="no" fi done < <(echo $DNS | sed 's/,/\n/g') else while read dnsitem; do if ! checkipv4 $dnsitem; then - echo $"Not a valid IPv4 address for DNS server: $dnsitem" + echo "Not a valid IPv4 address for DNS server: $dnsitem" allgood="no" fi done < <(echo $DNS | sed 's/:/\n/g') @@ -2337,11 +2291,11 @@ function handle_dns() { [ -z "$DNS" ] && return 0 local dnsitem local allgood="yes" - echo $"Trying to reach DNS servers..." + echo "Trying to reach DNS servers..." if [ "$ipv6" ]; then while read dnsitem; do if ! ping6 -c 1 $dnsitem >& /dev/null; then - echo $"Could not ping DNS server (might still serve DNS requests): $dnsitem" + echo "Could not ping DNS server (might still serve DNS requests): $dnsitem" allgood="no" # this should not be a hard failure since some network # environments may prevent pings to DNS servers @@ -2355,15 +2309,15 @@ function handle_dns() { # However, nslookup fails with "Resolver Error 0 (no error)" # at this stage of the setup progress => not useful if ! ping -c 1 $dnsitem >& /dev/null; then - echo $"Could not ping DNS server: $dnsitem" + echo "Could not ping DNS server: $dnsitem" # if nslookup $dnsitem $dnsitem >& /dev/null; then -# echo $" but could resolve DNS server with itself: $dnsitem" +# echo " but could resolve DNS server with itself: $dnsitem" # else -# echo $"Could not resolve DNS server with itself: $dnsitem" +# echo "Could not resolve DNS server with itself: $dnsitem" # allgood="no" # fi # elif ! nslookup $dnsitem $dnsitem >& /dev/null; then -# echo $"Could not resolve DNS server with itself: $dnsitem" +# echo "Could not resolve DNS server with itself: $dnsitem" allgood="no" fi done < <(echo $DNS | sed 's/:/\n/g') @@ -2377,34 +2331,34 @@ function handle_dns() { function question_prefix_dns() { if [ "$ipv6" ]; then - echo -n $"IPv6 addresses of DNS servers" + echo -n "IPv6 addresses of DNS servers" else - echo -n $"IPv4 addresses of DNS servers" + echo -n "IPv4 addresses of DNS servers" fi } function question_choices_dns() { if [ "$ipv6" ]; then - echo $" (separated by commas ',' or ? for help):" + echo " (separated by commas ',' or ? for help):" else - echo $" (separated by colons ':' or ? for help):" + echo " (separated by colons ':' or ? for help):" fi } function helptext_dns() { - echo $" Help text for DNS servers:" + echo " Help text for DNS servers:" if [ "$ipv6" ]; then - echo $" Enter IPv6 addresses of DNS servers separated by commas ','" + echo " Enter IPv6 addresses of DNS servers separated by commas ','" else - echo $" Enter IPv4 addresses of DNS servers separated by colons ':'" + echo " Enter IPv4 addresses of DNS servers separated by colons ':'" fi - echo $" Default are no DNS servers at all." - echo $" However, you might encounter problems without a nameserver," - echo $" especially with FTP installs." + echo " Default are no DNS servers at all." + echo " However, you might encounter problems without a nameserver," + echo " especially with FTP installs." if [ "$ipv6" ]; then - echo $" An example with 2 servers would be: 2001:0DB8::42,2001:0DB8::BE:AF" + echo " An example with 2 servers would be: 2001:0DB8::42,2001:0DB8::BE:AF" else - echo $" An example with 2 servers would be: 10.0.0.250:10.1.1.1" + echo " An example with 2 servers would be: 10.0.0.250:10.1.1.1" fi } @@ -2421,7 +2375,7 @@ function syntax_check_searchdns() { local dnsitem local allgood="yes" while read dnsitem; do - syntax_check_domainname "$dnsitem" $"Not a valid DNS search domain: $dnsitem" || allgood="no" + syntax_check_domainname "$dnsitem" "Not a valid DNS search domain: $dnsitem" || allgood="no" done < <(echo $SEARCHDNS | sed 's/:/\n/g') if [ "$allgood" = "yes" ]; then return 0 @@ -2431,18 +2385,18 @@ function syntax_check_searchdns() { } function question_prefix_searchdns() { - echo -n $"DNS search domains" + echo -n "DNS search domains" } function question_choices_searchdns() { - echo $" (separated by colons ':' or ? for help):" + echo " (separated by colons ':' or ? for help):" } function helptext_searchdns() { - echo $" Help text for DNS search domains:" - echo $" Enter search domains according to hostname syntax separated by colons." - echo $" Default are no DNS search domains at all." - echo $" An example would be: subdomain.domain.com:domain.com" + echo " Help text for DNS search domains:" + echo " Enter search domains according to hostname syntax separated by colons." + echo " Default are no DNS search domains at all." + echo " An example would be: subdomain.domain.com:domain.com" } function do_searchdns() { @@ -2473,7 +2427,7 @@ function parse_dasd() { 0) ;; # string matched the pattern 1) # string did not match the pattern if [ -z "$handle" ]; then - echo $"Incorrect format for lower bound of DASD range $range: $lo" + echo "Incorrect format for lower bound of DASD range $range: $lo" allgood="no" fi ;; @@ -2487,7 +2441,7 @@ function parse_dasd() { 0) ;; # string matched the pattern 1) # string did not match the pattern if [ -z "$handle" ]; then - echo $"Incorrect format for upper bound of DASD range $range: $hi" + echo "Incorrect format for upper bound of DASD range $range: $hi" allgood="no" fi ;; @@ -2497,13 +2451,13 @@ function parse_dasd() { fi if [ "$handle" = "yes" ]; then if ! sysecho /proc/cio_ignore "free $range"; then - echo $"Could not free DASD device $range from device blacklist" + echo "Could not free DASD device $range from device blacklist" allgood="no" fi fi if [ "${features//*)/}" != "" ]; then if [ -z "$handle" ]; then - echo $"Missing closing parenthesis at features of DASD range $range: ($features" + echo "Missing closing parenthesis at features of DASD range $range: ($features" allgood="no" fi fi @@ -2513,7 +2467,7 @@ function parse_dasd() { case $feature in ro|diag|erplog) continue ;; *) if [ -z "$handle" ]; then - echo $"Unknown DASD feature for device range $range: $feature" + echo "Unknown DASD feature for device range $range: $feature" allgood="no" fi ;; @@ -2523,7 +2477,9 @@ function parse_dasd() { esac done < <(echo $DASD | sed 's/,/\n/g') if [ "$handle" = "yes" ]; then - udevsettle + udevadm settle + # even though the device might now be online, some of its + # sysfs attributes might not yet be available sleep 1 fi if [ "$allgood" = "yes" ]; then @@ -2544,18 +2500,18 @@ function handle_dasd() { } function question_prefix_dasd() { - echo -n $"DASD range" + echo -n "DASD range" } function question_choices_dasd() { - echo $" (e.g. 200-203,205 or ? for help). Default is autoprobing:" + echo " (e.g. 200-203,205 or ? for help). Default is autoprobing:" } function helptext_dasd() { - echo $" Help text for DASD range:" - echo $" Comma separated list of ranges of device bus IDs." - echo $" Default is autoprobing (not recommended)." - echo $" Examples would be: 200-203 or 200,201,202,203 or 0.0.0200-0.0.0203,0.0.0205" + echo " Help text for DASD range:" + echo " Comma separated list of ranges of device bus IDs." + echo " Default is autoprobing (not recommended)." + echo " Examples would be: 200-203 or 200,201,202,203 or 0.0.0200-0.0.0203,0.0.0205" } function exception_dasd() { @@ -2587,14 +2543,14 @@ function syntax_check_fcp() { devno=${fcp[0]} wwpn=${fcp[2]} lun=${fcp[4]} - echo $"Deprecated number of FCP arguments (5 instead of 3): " - echo $" $i=\"${!i}\"" - echo $" should instead be: " - echo $" $i=\"$devno $wwpn $lun\"" + echo "Deprecated number of FCP arguments (5 instead of 3): " + echo " $i=\"${!i}\"" + echo " should instead be: " + echo " $i=\"$devno $wwpn $lun\"" ;; *) - echo $"Unsupported number of FCP arguments (${#fcp[@]} instead of 3) in:" - echo $" $i=\"${!i}\"" + echo "Unsupported number of FCP arguments (${#fcp[@]} instead of 3) in:" + echo " $i=\"${!i}\"" allgood="no" continue ;; @@ -2603,8 +2559,8 @@ function syntax_check_fcp() { case $? in 0) ;; # string matched the pattern 1) # string did not match the pattern - echo $"Incorrect format for FCP device $devno in:" - echo $" $i=\"${!i}\"" + echo "Incorrect format for FCP device $devno in:" + echo " $i=\"${!i}\"" allgood="no" ;; 2) @@ -2619,8 +2575,8 @@ function syntax_check_fcp() { case $? in 0) ;; # string matched the pattern 1) # string did not match the pattern - echo $"Incorrect format for FCP WWPN $wwpn in:" - echo $" $i=\"${!i}\"" + echo "Incorrect format for FCP WWPN $wwpn in:" + echo " $i=\"${!i}\"" allgood="no" ;; 2) echo "l.$LINENO: syntax error in regex of match operator =~, code needs to be fixed" 1>&2 ;; @@ -2632,8 +2588,8 @@ function syntax_check_fcp() { case $? in 0) ;; # string matched the pattern 1) # string did not match the pattern - echo $"Incorrect format for FCP LUN $lun in:" - echo $" $i=\"${!i}\"" + echo "Incorrect format for FCP LUN $lun in:" + echo " $i=\"${!i}\"" allgood="no" ;; 2) @@ -2699,7 +2655,7 @@ function final_check() { # optionally consider "continue" as default # but then again the user may inadvertently continue echo - echo $"c) continue, p) parm file/configuration, n) network state, r) restart, s) shell" + echo "c) continue, p) parm file/configuration, n) network state, r) restart, s) shell" local answer read answer case $answer in @@ -2717,7 +2673,7 @@ function final_check() { fi ;; r) break ;; - s) echo $"Enter 'exit' at the shell prompt to get back to the installation dialog." + s) echo "Enter 'exit' at the shell prompt to get back to the installation dialog." /bin/bash ;; esac @@ -2727,101 +2683,43 @@ function final_check() { ### MAIN ### -S390ARCH=`uname -m` -if [ "$S390ARCH" = "s390" ]; then - export S390ARCH="S/390" -else - export S390ARCH="zSeries" -fi +init_main -echo -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 +# Parse configuration +if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then + readcmsfile $CMSDASD $CMSCONFFILE + source /tmp/$CMSCONFFILE #2>/dev/null 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 - -if [ -z "$testing" ]; then - - mount -t proc none /proc - mount -t tmpfs none /dev - createDevices - mount -t devpts /dev/pts /dev/pts - mount -t sysfs none /sys - # remount root fs rw - mount /dev/root / -o remount,rw - - # limit output on x3270 console - # (console_loglevel of 4 is just right to not get driver info, e.g. from qeth, - # since that would mix up with the user dialog) - echo "4 4 1 7" > /proc/sys/kernel/printk - - # make /tmp/ramfs - mount -t ramfs none /tmp - - ifconfig lo 127.0.0.1 netmask 255.0.0.0 - route add -host 127.0.0.1 dev lo - - echo -e "127.0.0.1\tlocalhost.localdomain localhost" > /etc/hosts - echo -e "::1\t\tlocalhost6.localdomain6 localhost6" >> /etc/hosts - - LO="" - - [ -L /sbin/insmod ] && LO=".ko" - - # udevd req'd by udevsettle in readcmsfile, dialog_network_table, and - # semantic_check_subchannels. - # (important to start udevd at the right time, e.g. after setup of /dev) - udevd --daemon - - # Parse configuration - if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then - readcmsfile $CMSDASD $CMSCONFFILE - source /tmp/$CMSCONFFILE #2>/dev/null - fi - -fi # testing - -### MAIN (continuation) ### if [ -r /sys/firmware/ipl/ipl_type ]; then - if [ "`cat /sys/firmware/ipl/ipl_type`" = "fcp" ]; then - while [ 1 ]; do - echo $"Your IPL device is set to FCP." - echo $"Would you like to perform a CD-ROM/DVD-ROM installation? (y/n)" + #local ipl_type + read ipl_type < /sys/firmware/ipl/ipl_type + if [ "$ipl_type" = "fcp" ]; then + while : ; do + echo "Your IPL device is set to FCP." + echo "Would you like to perform a CD-ROM/DVD-ROM installation? (y/n)" + #local do_cd_install read do_cd_install case $do_cd_install in y|Y|[Yy][Ee][Ss]) - insert_module qdio$LO - insert_module scsi_mod$LO - insert_module scsi_transport_fc$LO - insert_module zfcp$LO - CD_DEVICE="`cat /sys/firmware/ipl/device`" - WWPN="`cat /sys/firmware/ipl/wwpn`" - LUN="`cat /sys/firmware/ipl/lun`" + # precondition: zfcp driver incl. dependencies loaded + #local CD_DEVICE WWPN LUN + read CD_DEVICE < /sys/firmware/ipl/device + read WWPN < /sys/firmware/ipl/wwpn + read LUN < /sys/firmware/ipl/lun if sysecho /proc/cio_ignore "free $CD_DEVICE"; then - udevsettle + udevadm settle + # even though device might now be online, some of its + # sysfs attributes might not yet be available sleep 1 else - echo $"Device $CD_DEVICE could not be cleared from device blacklist" + echo "Device $CD_DEVICE could not be cleared from device blacklist" fi - echo 1 > /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/online - [ $? == 0 ] || echo $"Could not set FCP device $CD_DEVICE online" - echo $WWPN > /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/port_add - [ $? == 0 ] || echo $"Could not add WWPN $WWPN on FCP device $CD_DEVICE" - echo $LUN > /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/$WWPN/unit_add - [ $? == 0 ] || echo $"Could not add LUN $LUN at WWPN $WWPN on FCP device $CD_DEVICE" + sysecho /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/online 1 \ + || echo "Could not set FCP device $CD_DEVICE online" + # port (WWPN) appears automatically + sysecho /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/$WWPN/unit_add $LUN \ + || echo "Could not add LUN $LUN at WWPN $WWPN on FCP device $CD_DEVICE" break ;; n|N|[Nn][Oo]) @@ -2829,7 +2727,7 @@ if [ -r /sys/firmware/ipl/ipl_type ]; then ;; *) echo - echo $"*** INVALID ANSWER: $do_cd_install" + echo "*** INVALID ANSWER: $do_cd_install" echo unset do_cd_install ;; @@ -2846,7 +2744,6 @@ fi # [ -z "${cardtype//OSD_*/}" ] can be used to check for real OSA -# Parse configuration # Check for missing parameters, prompt for them if necessary while : ; do @@ -2859,10 +2756,10 @@ while : ; do -o -z "$RUNKS" -a \( -z "$NETTYPE" -o -z "$SUBCHANNELS" \) ] && \ dialog_network_table if isVM; then - echo $"* NOTE: To enter default or empty values press enter twice. *" + echo "* NOTE: To enter default or empty values press enter twice. *" fi do_nettype - tv load_kernel_modules + # precondition: driver (qeth/lcs/ctcm/netiucv) loaded incl. dependencies # only works, if ipv6 kernel module has been loaded before: [ "$NETTYPE" = "qeth" ] && tv disable_ipv6_autoconf if [ "$NETTYPE" != "iucv" ]; then @@ -2886,7 +2783,7 @@ while : ; do fi do_layer2 # set device online to know the device name - # and to know if it's OSD/HiperSocket/GuestLAN BUT do not + # and to know if it's OSD/HiperSockets/GuestLAN BUT do not # try to ifconfig the device up since that requires # setting the mac address before (if applicable). set_device_online || workflow_item_menu noredo @@ -2963,16 +2860,13 @@ while : ; do do_dasd - echo $"Initial configuration completed." + echo "Initial configuration completed." final_check && break rollback_config reenter="yes" done # outer dialog loop -#echo $"Starting portmap." -#portmap - if [ -z "$testing" ]; then # convert to space-separated lists @@ -2989,18 +2883,13 @@ if [ -z "$testing" ]; then for i in $RESOLVDNS; do echo "nameserver $i"; done >> /etc/resolv.conf fi - # make sure we have an /etc/hosts file (required for telnetd) + # make sure we have an /etc/hosts file (originally required for telnetd) if [ ! -z "$HOSTNAME" -a ! -z "$IPADDR" ]; then - echo -e "$IPADDR\t$HOSTNAME `echo $HOSTNAME | cut -d '.' -f 1`" >> /etc/hosts + echo -e "$IPADDR\t$HOSTNAME $(echo $HOSTNAME | cut -d '.' -f 1)" >> /etc/hosts fi fi # testing -if [ -z "$testing" ]; then - # undo startup of udevd, only needed it for possible calls of udevsettle - killall udevd -fi # testing - if [ -n "$DASD" ]; then echo "DASD=$DASD" > /tmp/dasd_ports fi @@ -3015,16 +2904,6 @@ done # cio_ignore handling for FCP should happen when the content of /tmp/fcpconfig # will actually be processed which is in anaconda's zfcp.py ZFCP::readConfig() -if [ -z "$testing" ]; then - - grep -q ext3 /proc/filesystems - if [ "$?" != "0" ]; then - insmod jbd$LO - insmod ext3$LO - fi - -fi # testing - # TODO/FIXME: also need to pass IPv6 decision to loader/anaconda # [ "$ipv6" ] && echo "IPV6=yes" @@ -3032,8 +2911,6 @@ fi # testing cat > /tmp/install.cfg << EOF LANG="$LANG" S390ARCH="$S390ARCH" -TEXTDOMAIN="$TEXTDOMAIN" -TEXTDOMAINDIR="$TEXTDOMAINDIR" PORTNAME="$PORTNAME" HOSTNAME="$HOSTNAME" DEVICE="$DEVICE" @@ -3051,12 +2928,12 @@ ONBOOT="yes" CTCPROT="$CTCPROT" EOF if [ "$ipv6" ]; then - echo DNS=\"`echo $DNS | cut -d ',' -f 1`\" >> /tmp/install.cfg + echo DNS=\"$(echo $DNS | cut -d ',' -f 1)\" >> /tmp/install.cfg else - echo DNS=\"`echo $DNS | cut -d ':' -f 1`\" >> /tmp/install.cfg + echo DNS=\"$(echo $DNS | cut -d ':' -f 1)\" >> /tmp/install.cfg fi cat >> /tmp/install.cfg << EOF -export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR +export LANG PORTNAME S390ARCH export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU export NETWORK NETMASK BROADCAST DNS SEARCHDNS export PEERID ONBOOT SUBCHANNELS CTCPROT @@ -3066,7 +2943,14 @@ EOF if [ -z "$testing" ]; then cat /tmp/install.cfg >> /etc/profile fi # testing -cat > /tmp/netinfo << EOF + +NETSCRIPTS="/etc/sysconfig/network-scripts" +IFCFGFILE="$NETSCRIPTS/ifcfg-$DEVICE" +if [ ! -d "$NETSCRIPTS" ]; then + mkdir -p $NETSCRIPTS +fi + +cat > $IFCFGFILE << EOF DEVICE=$DEVICE ONBOOT=yes BOOTPROTO=static @@ -3077,34 +2961,35 @@ MTU=$MTU SUBCHANNELS=$SUBCHANNELS EOF if [ "$ipv6" ]; then - [ "$DNS" != "" ] && echo "DNS=`echo $DNS | cut -d ',' -f 1`" >> /tmp/netinfo -else - [ "$DNS" != "" ] && echo "DNS=`echo $DNS | cut -d ':' -f 1`" >> /tmp/netinfo -fi -[ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> /tmp/netinfo -[ "$PEERID" != "" ] && echo "PEERID=$PEERID" >> /tmp/netinfo -[ "$PORTNAME" != "" ] && echo "PORTNAME=$PORTNAME" >> /tmp/netinfo -[ "$CTCPROT" != "" ] && echo "CTCPROT=$CTCPROT" >> /tmp/netinfo -[ "$LAYER2" != "" ] && echo "LAYER2=$LAYER2" >> /tmp/netinfo -[ "$MACADDR" != "" ] && echo "MACADDR=$MACADDR" >> /tmp/netinfo -[ "$PORTNO" != "" ] && echo "PORTNO=$PORTNO" >> /tmp/netinfo -# also needs support in stage2 to make PORTNO persistent, -# i.e. OPTION="portno=1" in /etc/sysconfig/network-scripts/ifcfg-<netdevname> -# this is done by the loader starting with RHEL 5.3 -if [ "$ipv6" ]; then - cat >> /tmp/netinfo << EOF + cat >> $IFCFGFILE << EOF IPV6INIT=yes IPV6_AUTOCONF=no IPV6ADDR=$IPADDR/$NETMASK +IPV6_DEFAULTGW=$GATEWAY EOF # FIXME: /etc/sysconfig/network:IPV6_DEFAULTGW=$GATEWAY # /etc/sysconfig/network:NETWORKING_IPV6=yes else - cat >> /tmp/netinfo << EOF + cat >> $IFCFGFILE << EOF IPADDR=$IPADDR NETMASK=$NETMASK EOF fi +if [ "$ipv6" ]; then + [ "$DNS" != "" ] && echo "DNS=$(echo $DNS | cut -d ',' -f 1)" >> $IFCFGFILE +else + [ "$DNS" != "" ] && echo "DNS=$(echo $DNS | cut -d ':' -f 1)" >> $IFCFGFILE +fi +[ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> $IFCFGFILE +[ "$PEERID" != "" ] && echo "PEERID=$PEERID" >> $IFCFGFILE +[ "$PORTNAME" != "" ] && echo "PORTNAME=$PORTNAME" >> $IFCFGFILE +[ "$CTCPROT" != "" ] && echo "CTCPROT=$CTCPROT" >> $IFCFGFILE +[ "$LAYER2" != "" ] && echo "LAYER2=$LAYER2" >> $IFCFGFILE +[ "$MACADDR" != "" ] && echo "MACADDR=$MACADDR" >> $IFCFGFILE +[ "$PORTNO" != "" ] && echo "PORTNO=$PORTNO" >> $IFCFGFILE +# also needs support in stage2 (loader.c,(net.c)) to make PORTNO persistent, +# i.e. OPTION="portno=1" in /etc/sysconfig/network-scripts/ifcfg-<netdevname> +# (see loader of RHEL 5.3) if [ -z "$testing" ]; then diff --git a/loader/lsznet.raw b/loader/lsznet.raw old mode 100644 new mode 100755 index 5b3df91..ac9bd07 --- a/loader/lsznet.raw +++ b/loader/lsznet.raw @@ -23,73 +23,29 @@ readonly DEBUG=0 # nothing to be changed below here -export TEXTDOMAIN=lsznet.raw - readonly CMD=${0##*/} function error() { - echo $"$CMD: ERROR: $*" 1>&2 + echo "$CMD: ERROR: $*" 1>&2 exit 1; } # currently requires bash version 3.0 or later -# (this seems reasonable since bash-3.0 has been shipped with -# RHEL 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7; -# bash-3.1 with RHEL 5.0, 5.1; and bash-3.2 with RHEL 5.2) -if [ ${BASH_VERSINFO[0]} -lt 3 -o \ - ${BASH_VERSINFO[1]} -lt 0 ]; then - error $"only works with BASH version 3.0 or later (current version used is ${BASH_VERSION})" -fi -# the script was designed for Linux kernel 2.6 and might work with newer ones -kernel_version=$(uname -r) -IFS=. -read krn_ver krn_patch krn_foo <<< "$kernel_version" -unset IFS -if [ $krn_ver -lt 2 -o $krn_patch -lt 6 ]; then - error $"only works for kernel versions 2.6 or probably later" -fi +. /sbin/controlunits.sh -# The following combinations of control unit type and model were taken from the -# Linux network device drivers for s390 on 2008-06-09 from Linux 2.6.25.4. -# The list (among other things) should be adapted, if any of those device +# The arrays (among other things) should be adapted, if any of those device # drivers start supporting different CU types/models. -# (Alternatively, the list could be generated by reading the modaliases -# directly out of the device driver modules: -# modinfo qeth/cu3088 | fgrep 'alias:' -# However, this would still require a list of device driver modules.) -readonly -a CU=( - 1731/01 - 1731/05 - 3088/08 - 3088/1f - 3088/1e - 3088/01 - 3088/60 - 3088/61 -) # $CU_CARDTYPE array is the only one which may contain entries with spaces readonly -a CU_CARDTYPE=( "OSA (QDIO)" - "HiperSocket" + "HiperSockets" "CTC adapter" "escon channel" "ficon channel" "LCS p390" "LCS OSA" - "LCS CLAW" -) - -readonly -a CU_DEVDRV=( - qeth - qeth - ctc - ctc - ctc - lcs - lcs - lcs ) readonly -a CU_DEVNAME=( @@ -100,7 +56,6 @@ readonly -a CU_DEVNAME=( ctc eth eth - eth ) readonly -a CU_GROUPCHANNELS=( @@ -111,8 +66,8 @@ readonly -a CU_GROUPCHANNELS=( 2 2 2 - 2 ) + readonly -a CHPIDTYPES=( [10]=OSE [11]=OSD @@ -131,21 +86,6 @@ function debug() { [ $DEBUG -ge $level ] && echo "$*" 1>&2 } -# Searches for a match of argument 1 on the array $CU and sets $cu_idx -# to the matched array index on success. -# Returns 0 on success, 1 on failure. -function search_cu() { - local scu=$1 - local i - for ((i=0; i < ${#CU[@]}; i++)); do - if [ $scu == ${CU[i]} ]; then - cu_idx=$i - return 0 - fi - done - return 1 -} - # Returns symbolic name of CHPID type in $chpidtype_symbolic, # if an entry in the array $CHPIDTYPES has been found at index of argument 1. # Returns "?" otherwise. @@ -198,10 +138,10 @@ function build_list() { continue ;; 2) - error $"syntax error in regex of match operator =~, code needs to be fixed" + error "syntax error in regex of match operator =~, code needs to be fixed" ;; *) - error $"unexpected return code of regex match operator =~, code needs to be fixed" + error "unexpected return code of regex match operator =~, code needs to be fixed" ;; esac debug 5 " sysfs directory matched regex $dir" @@ -218,7 +158,7 @@ function build_list() { read chpid_list < $subch_p/chpids read -a chpids <<< "$chpid_list" if [ ${#chpids[@]} -ne 8 ]; then - error $"sysfs reported ${#chpids[@]} CHPIDs instead of expected 8" + error "sysfs reported ${#chpids[@]} CHPIDs instead of expected 8" fi read pim pam pom foo < $subch_p/pimpampom pimchpidZ="" @@ -250,13 +190,13 @@ function build_list() { read chptype < $chpid_p/type # filter and output... if search_cu $cutype; then - if [ "${CU_DEVDRV[$cu_idx]}" == "ctc" ]; then + if [ "${CU_DEVDRV[$cu_idx]}" == "ctcm" ]; then # assume CTC are mostly virtual and ignore chpid from sysfs chpidtype_symbolic="-" else search_chpt $chptype fi - echo $pimchpids $devbusid $STARTPATH/$dev_p $cutype $chpidtype_symbolic $chptype ${CU_DEVDRV[$cu_idx]} ${CU_DEVNAME[$cu_idx]} ${CU_GROUPCHANNELS[$cu_idx]} $cu_idx ${CU_CARDTYPE[$cu_idx]} + echo $pimchpids $devbusid $cutype $chpidtype_symbolic ${CU_DEVDRV[$cu_idx]} ${CU_DEVNAME[$cu_idx]} ${CU_GROUPCHANNELS[$cu_idx]} ${CU_CARDTYPE[$cu_idx]} else debug 5 " skip non-network device $devbusid CU $cutype" fi @@ -278,7 +218,7 @@ function search_groups() { local w_prefix w_ssid w_devno local d_prefix d_ssid d_devno local prefix ssid devno x - local chp devbusid dev_p cutype chpidtypename chptype devdrv devname groupchs cu_idx cardtype + local chp devbusid cutype chpidtypename devdrv devname groupchs cardtype # remembered last state variables for possible ccwgroup: local r_prefix="Z" local r_ssid="Z" @@ -288,9 +228,8 @@ function search_groups() { local count=0 local item=1 local skipped=0 - # currently unused are: dev_p,chptype, cu_idx. - while read chp devbusid dev_p cutype chpidtypename chptype devdrv devname groupchs cu_idx cardtype; do - debug 1 " # $chp $devbusid $dev_p $cutype $chpidtypename $chptype $devdrv $devname $groupchs $cu_idx $cardtype" + while read chp devbusid cutype chpidtypename devdrv devname groupchs cardtype; do + debug 1 " # $chp $devbusid $cutype $chpidtypename $devdrv $devname $groupchs $cardtype" IFS=. read prefix ssid devno x <<< "$devbusid" unset IFS @@ -348,7 +287,7 @@ function search_groups() { chlist=$r_prefix.$r_ssid.$r_devno,$w_prefix.$w_ssid.$w_devno,$d_prefix.$d_ssid.$d_devno ;; *) - error $"unknown number of channels for group, code needs to be fixed" + error "unknown number of channels for group, code needs to be fixed" ;; esac echo $item $cutype $chp $chpidtypename $devdrv $devname $chlist "$cardtype" -- 1.6.3.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list