Blame SOURCES/0138-RHBZ-1288660-fix-mpathconf-allow.patch

4728c8
---
4728c8
 multipath/mpathconf |   37 ++++++++++++++++++++++++++-----------
4728c8
 1 file changed, 26 insertions(+), 11 deletions(-)
4728c8
4728c8
Index: multipath-tools-130222/multipath/mpathconf
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipath/mpathconf
4728c8
+++ multipath-tools-130222/multipath/mpathconf
4728c8
@@ -42,6 +42,19 @@ function usage
4728c8
 	echo ""
4728c8
 }
4728c8
 
4728c8
+function add_wwid
4728c8
+{
4728c8
+	INDEX=0
4728c8
+	while [ "$INDEX" -lt "$WWIDS" ] ; do
4728c8
+		if [ "$1" = "${WWID_LIST[$INDEX]}" ] ; then
4728c8
+			return
4728c8
+		fi
4728c8
+		((INDEX++))
4728c8
+	done
4728c8
+	WWID_LIST[$WWIDS]="$1"
4728c8
+	((WWIDS++))
4728c8
+}
4728c8
+
4728c8
 function get_dm_deps
4728c8
 {
4728c8
 	shift 3
4728c8
@@ -59,11 +72,9 @@ function get_dm_deps
4728c8
 function set_dm_wwid
4728c8
 {
4728c8
 	if [[ "$1" =~ ^part[[:digit:]]+-mpath- ]] ; then
4728c8
-		WWID_LIST[$WWIDS]="${1##part*-mpath-}"
4728c8
-		((WWIDS++))
4728c8
+		add_wwid "${1##part*-mpath-}"
4728c8
 	elif [[ "$1" =~ ^mpath- ]] ; then
4728c8
-		WWID_LIST[$WWIDS]="${1##mpath-}"
4728c8
-		((WWIDS++))
4728c8
+		add_wwid "${1##mpath-}"
4728c8
 	else
4728c8
 		get_dm_deps `dmsetup deps -u $1`
4728c8
 	fi
4728c8
@@ -82,8 +93,7 @@ function set_wwid
4728c8
 	if [ -n "$UUID" ] ; then
4728c8
 		set_dm_wwid $UUID
4728c8
 	else
4728c8
-		WWID_LIST[$WWIDS]="$1"
4728c8
-		((WWIDS++))
4728c8
+		add_wwid "$1"
4728c8
 	fi
4728c8
 }
4728c8
 
4728c8
@@ -198,13 +208,13 @@ function validate_args
4728c8
 
4728c8
 function add_blacklist_exceptions
4728c8
 {
4728c8
-	echo "blacklist_exceptions {" >> $TMPFILE
4728c8
 	INDEX=0
4728c8
 	while [ "$INDEX" -lt "$WWIDS" ] ; do
4728c8
-		echo "	wwid \"${WWID_LIST[$INDEX]}\"" >> $TMPFILE
4728c8
+		sed -i '/^blacklist_exceptions[[:space:]]*{/ a\
4728c8
+	wwid '"\"${WWID_LIST[$INDEX]}\""'
4728c8
+' $TMPFILE
4728c8
 		((INDEX++))
4728c8
 	done
4728c8
-	echo "}" >> $TMPFILE
4728c8
 }
4728c8
 
4728c8
 umask 0077
4728c8
@@ -350,9 +360,14 @@ if [ "$ENABLE" = 2 ]; then
4728c8
 		sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/	wwid ".*"/' $TMPFILE
4728c8
 	fi
4728c8
 	if [ "$HAVE_EXCEPTIONS" = 1 ]; then
4728c8
-		sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/d' $TMPFILE
4728c8
+		sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ {/^[[:space:]]*wwid/ d}' $TMPFILE
4728c8
+	else
4728c8
+		cat >> $TMPFILE <<- _EOF_
4728c8
+
4728c8
+blacklist_exceptions {
4728c8
+}
4728c8
+_EOF_
4728c8
 	fi
4728c8
-	echo $HAVE_WWID_DISABLE
4728c8
 	add_blacklist_exceptions
4728c8
 elif [ "$ENABLE" = 1 ]; then
4728c8
 	if [ "$HAVE_DISABLE" = 1 ]; then