Blame SOURCES/0219-cms-cmssetup.sh-fixed-indention.patch

a56a5e
From 49a23aa4261a896303d7923d5c94c9840739022f Mon Sep 17 00:00:00 2001
a56a5e
From: Harald Hoyer <harald@redhat.com>
a56a5e
Date: Fri, 12 Sep 2014 09:57:13 +0200
a56a5e
Subject: [PATCH] cms/cmssetup.sh: fixed indention
a56a5e
a56a5e
(cherry picked from commit d68163551226d302677e358e721560d8d651a30f)
a56a5e
---
a56a5e
 modules.d/80cms/cmssetup.sh | 260 ++++++++++++++++++++++----------------------
a56a5e
 1 file changed, 130 insertions(+), 130 deletions(-)
a56a5e
a56a5e
diff --git a/modules.d/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh
a56a5e
index c9e1331..7dd481b 100755
a56a5e
--- a/modules.d/80cms/cmssetup.sh
a56a5e
+++ b/modules.d/80cms/cmssetup.sh
a56a5e
@@ -44,147 +44,147 @@ function dasd_settle() {
a56a5e
 }
a56a5e
 
a56a5e
 function dasd_settle_all() {
a56a5e
-    for dasdccw in $(while read line; do echo ${line%%(*}; done < /proc/dasd/devices) ; do
a56a5e
+    for dasdccw in $(while read line; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
a56a5e
         if ! dasd_settle $dasdccw ; then
a56a5e
             echo $"Could not access DASD $dasdccw in time"
a56a5e
             return 1
a56a5e
         fi
a56a5e
     done
a56a5e
     return 0
a56a5e
-    }
a56a5e
+}
a56a5e
 
a56a5e
 # prints a canonocalized device bus ID for a given devno of any format
a56a5e
-    function canonicalize_devno()
a56a5e
-    {
a56a5e
-        case ${#1} in
a56a5e
-            3) echo "0.0.0${1}" ;;
a56a5e
-            4) echo "0.0.${1}" ;;
a56a5e
-            *) echo "${1}" ;;
a56a5e
-        esac
a56a5e
-        return 0
a56a5e
-    }
a56a5e
+function canonicalize_devno()
a56a5e
+{
a56a5e
+    case ${#1} in
a56a5e
+        3) echo "0.0.0${1}" ;;
a56a5e
+        4) echo "0.0.${1}" ;;
a56a5e
+        *) echo "${1}" ;;
a56a5e
+    esac
a56a5e
+    return 0
a56a5e
+}
a56a5e
 
a56a5e
 # read file from CMS and write it to /tmp
a56a5e
-    function readcmsfile() # $1=dasdport $2=filename
a56a5e
-    {
a56a5e
-        local dev
a56a5e
-        local numcpus
a56a5e
-        local devname
a56a5e
-        local ret=0
a56a5e
-        if [ $# -ne 2 ]; then return; fi
a56a5e
+function readcmsfile() # $1=dasdport $2=filename
a56a5e
+{
a56a5e
+    local dev
a56a5e
+    local numcpus
a56a5e
+    local devname
a56a5e
+    local ret=0
a56a5e
+    if [ $# -ne 2 ]; then return; fi
a56a5e
     # precondition: udevd created dasda block device node
a56a5e
-        if ! dasd_cio_free -d $1 ; then
a56a5e
-            echo $"DASD $1 could not be cleared from device blacklist"
a56a5e
-            return 1
a56a5e
-        fi
a56a5e
+    if ! dasd_cio_free -d $1 ; then
a56a5e
+        echo $"DASD $1 could not be cleared from device blacklist"
a56a5e
+        return 1
a56a5e
+    fi
a56a5e
 
a56a5e
-        modprobe dasd_mod dasd=$CMSDASD
a56a5e
-        modprobe dasd_eckd_mod
a56a5e
-        udevadm settle
a56a5e
+    modprobe dasd_mod dasd=$CMSDASD
a56a5e
+    modprobe dasd_eckd_mod
a56a5e
+    udevadm settle
a56a5e
 
a56a5e
     # precondition: dasd_eckd_mod driver incl. dependencies loaded,
a56a5e
     #               dasd_mod must be loaded without setting any DASD online
a56a5e
-        dev=$(canonicalize_devno $1)
a56a5e
-        numcpus=$(
a56a5e
-	    while read line; do
a56a5e
-	        if strstr "$line" "# processors"; then
a56a5e
-		    echo ${line##*:};
a56a5e
-		    break;
a56a5e
-	        fi;
a56a5e
-	    done < /proc/cpuinfo
a56a5e
-        )
a56a5e
-
a56a5e
-        if [ ${numcpus} -eq 1 ]; then
a56a5e
-            echo 1 > /sys/bus/ccw/devices/$dev/online
a56a5e
-        else
a56a5e
-            if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
a56a5e
-                echo $"DASD $dev could not be set online"
a56a5e
-                return 1
a56a5e
-            fi
a56a5e
-            udevadm settle
a56a5e
-            if ! dasd_settle $dev ; then
a56a5e
-                echo $"Could not access DASD $dev in time"
a56a5e
-                return 1
a56a5e
-            fi
a56a5e
+    dev=$(canonicalize_devno $1)
a56a5e
+    numcpus=$(
a56a5e
+        while read line; do
a56a5e
+            if strstr "$line" "# processors"; then
a56a5e
+                echo ${line##*:};
a56a5e
+                break;
a56a5e
+            fi;
a56a5e
+        done < /proc/cpuinfo
a56a5e
+    )
a56a5e
+
a56a5e
+    if [ ${numcpus} -eq 1 ]; then
a56a5e
+        echo 1 > /sys/bus/ccw/devices/$dev/online
a56a5e
+    else
a56a5e
+        if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
a56a5e
+            echo $"DASD $dev could not be set online"
a56a5e
+            return 1
a56a5e
         fi
a56a5e
-
a56a5e
         udevadm settle
a56a5e
+        if ! dasd_settle $dev ; then
a56a5e
+            echo $"Could not access DASD $dev in time"
a56a5e
+            return 1
a56a5e
+        fi
a56a5e
+    fi
a56a5e
 
a56a5e
-        devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
a56a5e
-        devname=${devname:-dasda}
a56a5e
+    udevadm settle
a56a5e
 
a56a5e
-        [[ -d /mnt ]] || mkdir /mnt
a56a5e
-        if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
a56a5e
-	    cat /mnt/$2 > /run/initramfs/$2
a56a5e
-            umount /mnt || umount -l /mnt
a56a5e
-            udevadm settle
a56a5e
-        else
a56a5e
-            echo $"Could not read conf file $2 on CMS DASD $1."
a56a5e
-            ret=1
a56a5e
-        fi
a56a5e
+    devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
a56a5e
+    devname=${devname:-dasda}
a56a5e
 
a56a5e
-        if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
a56a5e
-            echo $"DASD $dev could not be set offline again"
a56a5e
-        #return 1
a56a5e
-        fi
a56a5e
+    [[ -d /mnt ]] || mkdir /mnt
a56a5e
+    if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
a56a5e
+        cat /mnt/$2 > /run/initramfs/$2
a56a5e
+        umount /mnt || umount -l /mnt
a56a5e
         udevadm settle
a56a5e
+    else
a56a5e
+        echo $"Could not read conf file $2 on CMS DASD $1."
a56a5e
+        ret=1
a56a5e
+    fi
a56a5e
+
a56a5e
+    if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
a56a5e
+        echo $"DASD $dev could not be set offline again"
a56a5e
+        #return 1
a56a5e
+    fi
a56a5e
+    udevadm settle
a56a5e
 
a56a5e
     # unbind all dasds to unload the dasd modules for a clean start
a56a5e
-        ( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
a56a5e
-        udevadm settle
a56a5e
-        modprobe -r dasd_eckd_mod
a56a5e
-        udevadm settle
a56a5e
-        modprobe -r dasd_diag_mod
a56a5e
-        udevadm settle
a56a5e
-        modprobe -r dasd_mod
a56a5e
-        udevadm settle
a56a5e
-        return $ret
a56a5e
-    }
a56a5e
-
a56a5e
-    processcmsfile()
a56a5e
-    {
a56a5e
-        source /tmp/cms.conf
a56a5e
-        SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
a56a5e
-
a56a5e
-        if [[ $NETTYPE ]]; then
a56a5e
-	    (
a56a5e
-	        echo -n $NETTYPE,$SUBCHANNELS
a56a5e
-	        [[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
a56a5e
-	        [[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
a56a5e
-	        [[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
a56a5e
-	        echo
a56a5e
-	    ) >> /etc/ccw.conf
a56a5e
-
a56a5e
-	    OLDIFS=$IFS
a56a5e
-	    IFS=,
a56a5e
-	    read -a subch_array <<< "indexzero,$SUBCHANNELS"
a56a5e
-	    IFS=$OLDIFS
a56a5e
-	    devbusid=${subch_array[1]}
a56a5e
-            if [ "$NETTYPE" = "ctc" ]; then
a56a5e
-                driver="ctcm"
a56a5e
-            else
a56a5e
-                driver=$NETTYPE
a56a5e
-            fi
a56a5e
-
a56a5e
-	    printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
a56a5e
-        # remove the default net rules
a56a5e
-            rm -f -- /etc/udev/rules.d/91-default-net.rules
a56a5e
-	    [[ -f /etc/udev/rules.d/90-net.rules ]] \
a56a5e
-	        || printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
a56a5e
-            udevadm control --reload
a56a5e
-	    znet_cio_free
a56a5e
-        fi
a56a5e
+    ( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
a56a5e
+    udevadm settle
a56a5e
+    modprobe -r dasd_eckd_mod
a56a5e
+    udevadm settle
a56a5e
+    modprobe -r dasd_diag_mod
a56a5e
+    udevadm settle
a56a5e
+    modprobe -r dasd_mod
a56a5e
+    udevadm settle
a56a5e
+    return $ret
a56a5e
+}
a56a5e
 
a56a5e
-        if [[ $DASD ]]; then
a56a5e
-	    echo $DASD | normalize_dasd_arg > /etc/dasd.conf
a56a5e
-	    echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
a56a5e
-	    dasd_cio_free
a56a5e
+processcmsfile()
a56a5e
+{
a56a5e
+    source /tmp/cms.conf
a56a5e
+    SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
a56a5e
+
a56a5e
+    if [[ $NETTYPE ]]; then
a56a5e
+        (
a56a5e
+            echo -n $NETTYPE,$SUBCHANNELS
a56a5e
+            [[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
a56a5e
+            [[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
a56a5e
+            [[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
a56a5e
+            echo
a56a5e
+        ) >> /etc/ccw.conf
a56a5e
+
a56a5e
+        OLDIFS=$IFS
a56a5e
+        IFS=,
a56a5e
+        read -a subch_array <<< "indexzero,$SUBCHANNELS"
a56a5e
+        IFS=$OLDIFS
a56a5e
+        devbusid=${subch_array[1]}
a56a5e
+        if [ "$NETTYPE" = "ctc" ]; then
a56a5e
+            driver="ctcm"
a56a5e
+        else
a56a5e
+            driver=$NETTYPE
a56a5e
         fi
a56a5e
 
a56a5e
-        unset _do_zfcp
a56a5e
-        for i in ${!FCP_*}; do
a56a5e
-	    echo "${!i}" | while read port rest; do
a56a5e
-                case $port in
a56a5e
+        printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
a56a5e
+        # remove the default net rules
a56a5e
+        rm -f -- /etc/udev/rules.d/91-default-net.rules
a56a5e
+        [[ -f /etc/udev/rules.d/90-net.rules ]] \
a56a5e
+            || printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
a56a5e
+        udevadm control --reload
a56a5e
+        znet_cio_free
a56a5e
+    fi
a56a5e
+
a56a5e
+    if [[ $DASD ]]; then
a56a5e
+        echo $DASD | normalize_dasd_arg > /etc/dasd.conf
a56a5e
+        echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
a56a5e
+        dasd_cio_free
a56a5e
+    fi
a56a5e
+
a56a5e
+    unset _do_zfcp
a56a5e
+    for i in ${!FCP_*}; do
a56a5e
+        echo "${!i}" | while read port rest; do
a56a5e
+            case $port in
a56a5e
                 *.*.*)
a56a5e
                     ;;
a56a5e
                 *.*)
a56a5e
@@ -193,23 +193,23 @@ function dasd_settle_all() {
a56a5e
                 *)
a56a5e
                     port="0.0.$port"
a56a5e
                     ;;
a56a5e
-                esac
a56a5e
-                echo $port $rest >> /etc/zfcp.conf
a56a5e
-            done
a56a5e
-	    _do_zfcp=1
a56a5e
+            esac
a56a5e
+            echo $port $rest >> /etc/zfcp.conf
a56a5e
         done
a56a5e
-        [[ $_do_zfcp ]] && zfcp_cio_free
a56a5e
-        unset _do_zfcp
a56a5e
-    }
a56a5e
+        _do_zfcp=1
a56a5e
+    done
a56a5e
+    [[ $_do_zfcp ]] && zfcp_cio_free
a56a5e
+    unset _do_zfcp
a56a5e
+}
a56a5e
 
a56a5e
-    [[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
a56a5e
-    [[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
a56a5e
+[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
a56a5e
+[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
a56a5e
 
a56a5e
 # Parse configuration
a56a5e
-    if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
a56a5e
-        if readcmsfile $CMSDASD $CMSCONFFILE; then
a56a5e
-            ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
a56a5e
-            ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
a56a5e
-            processcmsfile
a56a5e
-        fi
a56a5e
+if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
a56a5e
+    if readcmsfile $CMSDASD $CMSCONFFILE; then
a56a5e
+        ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
a56a5e
+        ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
a56a5e
+        processcmsfile
a56a5e
     fi
a56a5e
+fi