File 0056-81cio_ignore-handle-cio_ignore-commandline.patch of Package dracut.892

From 3e263f6bfa21d9b5b102dfa73d0bdf2c17de41dc Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 4 Jun 2014 13:27:41 +0200
Subject: [PATCH] 81cio_ignore: handle cio_ignore commandline

References: bnc#874902

Signed-off-by: Thomas Renninger <trenn@suse.de>
---
 modules.d/81cio_ignore/module-setup.sh | 39 ++++++++++++++++++++++++++++++++++
 modules.d/81cio_ignore/parse-zipl.sh   | 29 +++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 modules.d/81cio_ignore/module-setup.sh
 create mode 100644 modules.d/81cio_ignore/parse-zipl.sh

diff --git a/modules.d/81cio_ignore/module-setup.sh b/modules.d/81cio_ignore/module-setup.sh
new file mode 100644
index 0000000..a812649
--- /dev/null
+++ b/modules.d/81cio_ignore/module-setup.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# called by dracut
+check() {
+# do not add this module by default
+	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
+}
+
+cmdline() {
+	local zipl_dasd
+	zipl_dasd=`find_mount /boot/zipl`
+	printf " rd.zipl_dasd=%s\n" "$zipl_dasd "
+}
+
+# called by dracut
+install() {
+	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
+}
+installkernel() {
+	instmods ext4
+}
diff --git a/modules.d/81cio_ignore/parse-zipl.sh b/modules.d/81cio_ignore/parse-zipl.sh
new file mode 100644
index 0000000..5f7aa58
--- /dev/null
+++ b/modules.d/81cio_ignore/parse-zipl.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# -*- 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
+CIO_REMOVE_LIST=$ZIPL_DIR/active_devices.txt
+
+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
+	mount -t ext2 -o ro $ZIPL_DEV $ZIPL_DIR
+	if [ -f $CIO_REMOVE_LIST ] ; then
+#
+#	File exist
+#
+		while read dev etc; do
+		    [ "$dev" = "#" -o "$dev" = "" ] && continue
+		    cio_ignore --remove $dev
+		done < $CIO_REMOVE_LIST
+	fi
+	umount $ZIPL_DIR
+else
+	warn "No rd.zipl_dasd boot parameter found"
+fi
-- 
1.8.4.5