File 0069-81cio_ignore-skip-module-if-cio_ignore-is-not-active.patch of Package dracut.892

From d5bbccaaff904eb0dbbd2e5407278e69436e559b Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 17 Jun 2014 11:09:59 +0200
Subject: 81cio_ignore: skip module if cio_ignore is not active

When cio_ignore is not active we should skip the entire module
during boot; otherwise it'll lead to adverse effects.

References: bnc#882685

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 modules.d/81cio_ignore/module-setup.sh | 45 ++++++++++++++++++++--------------
 modules.d/81cio_ignore/parse-zipl.sh   | 11 ++++++---
 2 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/modules.d/81cio_ignore/module-setup.sh b/modules.d/81cio_ignore/module-setup.sh
index a812649..52cb188 100644
--- a/modules.d/81cio_ignore/module-setup.sh
+++ b/modules.d/81cio_ignore/module-setup.sh
@@ -5,35 +5,44 @@
 # called by dracut
 check() {
 # do not add this module by default
-	local arch=$(uname -m)
-	[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
-	return 0
+    local arch=$(uname -m)
+    [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
+    return 0
 }
 
 find_mount() {
-	local dev mnt etc wanted_dev
-	wanted_dev="$(readlink -e -q $1)"
-	while read dev mnt etc; do
-		[ "$mnt" = "$wanted_dev" ] && echo "$dev" && return 0
-	done < /proc/mounts
-	return 1
+    local dev mnt etc wanted_dev zipl_dev
+    wanted_dev="$(readlink -e -q $1)"
+    while read dev mnt etc; do
+        [ "$mnt" = "$wanted_dev" ] && zipl_dev="$dev" && break
+    done < /etc/fstab
+    if [ -z "$zipl_dev" ] ; then
+        return 1
+    fi
+    if [ -e ${wanted_dev}/active_devices.txt ] ; then
+        echo "$zipl_dev"
+        return 0
+    fi
+    return 1
 }
 
 cmdline() {
-	local zipl_dasd
-	zipl_dasd=`find_mount /boot/zipl`
-	printf " rd.zipl_dasd=%s\n" "$zipl_dasd "
+    local zipl_dasd
+    zipl_dasd=`find_mount /boot/zipl`
+    if [ -n "$zipl_dasd" ] ; then
+	printf " rd.zipl_dasd=%s " $zipl_dasd
+    fi
 }
 
 # called by dracut
 install() {
-	if [[ $hostonly_cmdline == "yes" ]];then
-		echo $(cmdline) >"${initdir}/etc/cmdline.d/01zipl_dasd.conf"
-	fi
+    if [[ $hostonly_cmdline == "yes" ]];then
+	echo $(cmdline) >"${initdir}/etc/cmdline.d/01zipl_dasd.conf"
+    fi
 
-	inst_hook pre-mount 10 "$moddir/parse-zipl.sh"
-	inst_multiple cio_ignore mount umount mkdir
+    inst_hook pre-mount 10 "$moddir/parse-zipl.sh"
+    inst_multiple cio_ignore mount umount mkdir
 }
 installkernel() {
-	instmods ext4
+    instmods ext4
 }
diff --git a/modules.d/81cio_ignore/parse-zipl.sh b/modules.d/81cio_ignore/parse-zipl.sh
index 5f7aa58..9d68c52 100644
--- a/modules.d/81cio_ignore/parse-zipl.sh
+++ b/modules.d/81cio_ignore/parse-zipl.sh
@@ -2,17 +2,20 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
-ZIPL_DEV="$(getarg rd.zipl_dasd)"
-ZIPL_DIR=/tmp/zipl
+ZIPL_DEV=$(getarg rd.zipl_dasd)
+ZIPL_DIR=/boot/zipl
 CIO_REMOVE_LIST=$ZIPL_DIR/active_devices.txt
 
-if [ -n $ZIPL_DEV ];then
+if ! getarg cio_ignore ; then
+    return
+fi
+if [ -n "$ZIPL_DEV" ];then
 	info "Waiting for zipl device $ZIPL_DEV"
 	wait_for_dev -n "$ZIPL_DEV"
 #
 #	mount device and read devices
 #
-	[ -d $ZIPL_DIR ] ||  mkdir $ZIPL_DIR
+	[ -d $ZIPL_DIR ] ||  mkdir -p $ZIPL_DIR
 	mount -t ext2 -o ro $ZIPL_DEV $ZIPL_DIR
 	if [ -f $CIO_REMOVE_LIST ] ; then
 #
-- 
1.8.4.5