File 0501-dasd_fix_ssid_bigger_zero.patch of Package dracut.12460

From d8b28c14e3f350acdda42a0cc2c60ce71b9c53a2 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.com>
Date: Tue, 23 Aug 2016 12:56:53 +0200
Subject: [PATCH] Fix DASD with SSID greater than 0

bsc#989313

Signed-off-by: Thomas Renninger <trenn@suse.com>
---
 modules.d/95dasd_rules/parse-dasd.sh | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/modules.d/95dasd_rules/parse-dasd.sh b/modules.d/95dasd_rules/parse-dasd.sh
index 1cc621f..67ed802 100755
--- a/modules.d/95dasd_rules/parse-dasd.sh
+++ b/modules.d/95dasd_rules/parse-dasd.sh
@@ -84,13 +84,14 @@ for dasd_arg in $(getargs rd.dasd=); do
                     OLDIFS="$IFS"
                     IFS="-"
                     set -- $range
-                    start=${1#0.0.}
+                    prefix=${1%.*}
+                    start=${1##*.}
                     shift
-                    end=${1#0.0.}
+                    end=${1##.}
                     shift
                     IFS="$OLDIFS"
                     for dev in $(seq $(( 16#$start )) $(( 16#$end )) ) ; do
-                        create_udev_rule $(printf "0.0.%04x" "$dev")
+                        create_udev_rule $(printf "%s.%04x" "$prefix" "$dev")
                     done
                     ;;
                 *)
@@ -98,8 +99,16 @@ for dasd_arg in $(getargs rd.dasd=); do
                     if [ "$dev" != "$1" ] ; then
                         ro=1
                     fi
-                    dev=${dev#0.0.}
-                    create_udev_rule $(printf "0.0.%04x" $(( 16#$dev )) )
+                    OLDIFS="$IFS"
+                    IFS="."
+                    set -- $dev
+                    sid=$1
+                    shift
+                    ssid=$1
+                    shift
+                    chan=$1
+                    IFS="$OLDIFS"
+                    create_udev_rule $(printf "%01x.%01x.%04x" $(( 16#$sid )) $(( 16#$ssid )) $(( 16#$chan )) )
                     shift
                     ;;
             esac
-- 
2.6.6

openSUSE Build Service is sponsored by